This repository contains the source code, deployment and infrastructure configuration for a React and Nest.js application. In this project, the infrastructure is provisioned on AWS using terraform and the delivery and integration of the application is automated using GitHub actions. Also, static code analysis is performed using SonarQube.
Tools used in the development of this application:
To run the application locally, follow these steps:
- Clone the repository
- On Auth0, create an Application and an API. Add the the keys to the environment variable of the client and backend application.
# apps/api/.env
CLIENT_ORIGIN_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=<Auth0-api-issuer-base-url>
AUTH0_AUDIENCE=http://localhost:8000
# apps/client/.env
VITE_API_URL=http://localhost:8000/api/v1
VITE_AUTH0_DOMAIN=<Auth0-application-domain-name>
VITE_AUTH0_CLIENT_ID=<Auth0-application-client-id>
VITE_AUTH0_CALLBACK_URL=http://localhost:3000/callback
VITE_API_AUTH0_AUDIENCE=http://localhost:8000
Alternatively, you can setup the doppler cli and configure a development and production environment
- To start services:
docker compose up
- Setup AWS Credentials
- Create an S3 bucket to store the terraform state and add the name of the bucket to the "infra/main" file (backend "s3").
- Initialize Terraform
terraform init
- Create a workspace (development or production)
ENV=development make tf-create-workspace
- Using the environment, run:
TF_COMMAND=plan ENV=development make tf
- To apply changes, run:
TF_COMMAND=apply ENV=development make tf
- To destroy changes, run:
TF_COMMAND=destroy ENV=development make tf
- Create new Auth API "Applications > APIs > Create New API"
- Add to environment variables:
AUTH0_ISSUER_BASE_URL=
AUTH0_AUDIENCE=
- Create application - Application type: "Single Page Web Application"
- Add "Allowed Callback URLs". e.g. "http://localhost:3000/callback"
- Add "Allowed Logout URLs". e.g. "http://localhost:3000"
- Add "Allowed Web Origins". e.g. "http://localhost:3000"
- Add to environment variables:
VITE_AUTH0_DOMAIN=
VITE_AUTH0_CLIENT_ID=