Giter Club home page Giter Club logo

typescript-firestore-terraform-realworld-backend's Introduction

RealWorld Example App

TypeScript codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

Demo    RealWorld

This codebase was created to demonstrate a fully fledged backend application built with TypeScript including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the TypeScript community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

This is an Express.js based web-application, written in TypeScript, that implements the RealWorld API endpoints.

It depends on Firestore, a Serverless document database available on Google Cloud. Hence, this app can only be deployed on the Google Cloud platform.

System Design

system Design Diagram

Getting started

  1. Install Node.js and npm.
  2. Install Docker.
  3. Run npm start.

Testing

  1. Run npm test.

Deployment

Google Cloud

Bootstrap

This process creates the projects, creates the Artifact Registry repository (in the Bootstrap project), enables the Cloud Build API, grants the iam.securityAdmin to the Cloud Build Service Account, sets up the Build Pipeline in the development project and the Deployment pipeline in the production project.

  1. Create an Organization on Google Cloud.
  2. Create a Folder on your Organization to create your projects in.
  3. Create a Billing Account.
  4. Install terraform.
  5. Install the gcloud CLI.
  6. Run gcloud auth login.
  7. Run gcloud auth application-default login.
  8. Make sure you own a domain name and have access to it's DNS configuration. This will be necessary to enable HTTPS.
  9. cd into the deployment/google-cloud/terraform/bootstrap.
  10. Comment out the entire contents of the backend.tf file.
  11. Create a terraform.tfvars file and add your variables' values.
  12. Run terraform init.
  13. Run terraform apply -target=module.bootstrap_project.google_project_service.enable_apis.
  14. Wait a few minutes until the APIs are enabled.
  15. Run terraform apply -target=module.bootstrap_project.
  16. Uncomment the backend.tf file's contents and update the bucket argument to the value of the tfstate_bucket output.
  17. Run terraform init and type yes.
  18. Run terraform apply -target=module.project.
  19. Manually connect the Github repositories via the console in CloudBuild. Do not create a Trigger, just click DONE once the repository is connected.
  20. Run terraform apply.

Build

  1. A Cloud Build shoud run to build and push a container image to Artifact Registry everytime you push a commit to the branch corresponding to the value you set for the github_repo_branch variable.
  2. It will also deploy the system into a "Development" environment.
  3. After the system is deployed, set up HTTPS for the created Load Balancers.

Build Pipeline

Tag and Deployment

  1. Create a Release on Github and tag the commit with a value matching the regex you used as the value of the github_repo_commit_tag variable.
  2. This will run the Tag pipeline to tag the artifacts.
  3. It will also trigger a Deployment to Production.

Tag Pipeline

Deployment Pipeline

typescript-firestore-terraform-realworld-backend's People

Contributors

marcusmonteirodesouza avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.