Boilerplate for a project using React frontend with a Terraform controlled backend API.
- Cloud - AWS ECS Fargate, Cloudfront, Route53, SSL Certificate
- API - Flask, Celery, Websockets
- Frontend - React
- Docker - Container developer environment
- Terraform - Cloud infrastructure
- direnv - Environment variable management
- jq - JSON cli processor
Setup domain that is already registered in AWS Route53 in env.dist:
export PROJECT_DOMAIN="example.com"
Create AWS Terraform shared environment for shared state locking. The file backend_config.tf
is generated with Terraform setup information. NOTE:
Run from the terraform directory
$ cd terraform
terraform $ make bootstrap
Terraform will create all the necessary resources on AWS. Environment variables will be saved to the file aws.env
, and the environment will need to be refreshed after running this step.
NOTE: Run from the terraform directory
$ cd terraform
$ make init
$ make plan
$ make apply
If you recieve InvalidViewerCertificate
the first time your run plan/apply, run terraform plan apply process a second time. The SSL certificate needs to be validated when created and takes a bit of time.
$ make plan apply
Deploy the backend containers to the ECR and update the two services. NOTE: Run from the root directory of the project
$ dist-backend-build
$ dist-backend-deploy
Deploy the frontend react app to a serverless cloudfront distribution
$ dist-frontend-build
$ dist-frontend-deploy
Get coffee...
Tear down and remove all AWS infastructure components. NOTE: Run from the Terraform directory
$ cd terraform
$ make destroy
Get coffee...