/monorepo
Deployment

CI/CD

Continuous Integration and Deployment pipelines.

We recommend using GitHub Actions for CI/CD pipelines to ensure code quality and automate deployments.

Workflows

Pull Request Checks

Triggered on pull requests to main or develop.

  1. Lint: Runs pnpm lint to check for code style issues.
  2. Test: Runs pnpm test to execute unit tests.
  3. Build: Runs pnpm build to ensure the application compiles correctly.

Deployment

Triggered on push to main or release tags.

  1. Build Docker Images: Builds images for API and Frontends.
  2. Push to Registry: Pushes to ECR or Docker Hub.
  3. Deploy: Updates the Kubernetes cluster or AWS CDK stack.

Client Application Deployment

We have a dedicated workflow deploy-clients.yaml that deploys the frontend applications to AWS S3 and invalidates CloudFront caches. This workflow triggers automatically after a successful Build / Lint / Test run.

Configuration

To enable this workflow, you must configure the following Variables in your GitHub Repository Environment. This workflow uses AWS OIDC authentication for improved security.

Variables:

  • AWS_REGION: The AWS region (e.g., us-east-1).
  • PIPELINE_ROLE_ARN: The ARN of the IAM Role created for the pipeline (e.g., arn:aws:iam::123456789012:role/PipelineStack-PipelineRole...).
  • CLIENTS_BUCKET: The name of the S3 bucket created by CDK (e.g., client-side-atlas-bucket-cdn).
  • DISTRIBUTION_ID_ACCOUNTS: The CloudFront Distribution ID for the Accounts app.
  • DISTRIBUTION_ID_APP: The CloudFront Distribution ID for the main App.

Retrieving Values

After deploying the infrastructure using CDK (pnpm deploy:clients and pnpm deploy:pipeline), check the CloudFormation outputs in the AWS Console or the CLI output for:

  • PipelineStack.PipelineRoleArn -> Use for PIPELINE_ROLE_ARN
  • ClientsStack.AppDistributionDistributionId -> Use for DISTRIBUTION_ID_APP
  • ClientsStack.AccountsDistributionDistributionId -> Use for DISTRIBUTION_ID_ACCOUNTS
  • The bucket name can be found in infra/aws/stacks/clients-stack.ts or the CloudFormation resources.

Turborepo Optimization

Our pipelines leverage Turborepo's caching mechanisms. If a commit only affects apps/docs, the pipeline will skip testing and building apps/api, significantly reducing CI time.