A monorepo template for an AWS-hosted, Astro-generated static website with an API in AWS Lambda, complete with infrastructure code, CI/CD automations, multiple environments, and optional basic auth protection.
💲 >= $0.55 🌟 Monthly AWS cost (🌐 DNS Zone + ECR + 🔧 usage)
A high-level App infrastructure diagram illustrating service integrations and user flows.
A high-level Deployer infrastructure diagram illustrating service integrations and developer flows.
Learn more infrastructure details from the documentation.
website/- Frontend projectapi/- Backend API projectinfra/- Common Infrastructure projectdeployer/- Cloud deployer projecte2etest/- End2end test projectapitest/- API test projectconfig.json- Config fileMakefile- Task automations
Learn more about monorepo architecture from the documentation.
- Start new repository from this template.
- Update config.json as necessary.
- Deploy infrastructure.
- Setup CI/CD.
- Edit
fe/srcfiles,git add,git commit,git push, etc. - Validate
stgdeployment and run: releaseworkflow.
Start with deploying AWS shared resources and deploy infrastructure for stg and prd environments.
make infra-deploy-certificate
make infra-deploy-github-oidc
make deployer-infra ENV=stg
make api-build ENV=stg VERSION=local
make api-deploy ENV=stg
make website-infra-deploy ENV=stg
make website-fe-build ENV=stg
make website-fe-deploy ENV=stgUpdate s3bucket and cloudfrontId in config.json with values returned in stack outputs.
To enable the deployment workflow, configure the following Environments and Environment Variables in your GitHub repository settings:
- Environments:
prd- Productionstg- Staging
- Environment variables:
AWS_REGION- AWS region environment is deployed toAWS_ROLE- AWS CI/CD Role ARNSOURCE_BUCKET- S3 bucket for deployment packages
Use CICDRoleArn and SourceBucket values from make deployer-infra outputs to update AWS_ROLE and SOURCE_BUCKET environment variables for a corresponding environment in repository settings.
Use make to run tasks in this project:
make
# Available targets:
# api-% - API targets
# infra-% - Infra targets
# website-% - Website targets
# e2etest-% - E2Etest targets
# apitest-% - APItest targets
# deployer-% - Deployer targets
make infra
# Available targets:
# deploy-certificate - deploy ACM certificate
# deploy-github-oidc - deploy GitHub OIDC
# test - test infrastructure templates
make deployer
# Available targets:
# image - build deployer image
# infra - deploy infrastructure
# infra-lint - lint infrastructure templates
make website
# Available targets:
# fe-% - Frontend targets
# infra-% - Infrastructure targets
make website-fe
# Available targets:
# build - build frontend
# deploy - deploy frontend
# init - init dependencies
# init-test - init test dependencies
# test - run tests
# npm-run-% - run any npm script
# npm-% - run any npm command
make website-infra
# Available targets:
# test - test infrastructure templates
# deploy - deploy infrastructure
make api
# Available targets:
# init - init dependencies
# test - test api and infrastructure
# build - build api lambdas
# package - package api and infrastructure
# deploy - deploy packaged api and infrastructure
make apitest
# Available targets:
# run - run api tests
# init - init dependencies
# init-test - init test dependencies
# test - run tests
# npm-run-% - run any npm script
# npm-% - run any npm command
make e2etest
# Available targets:
# run - run e2e tests
# init - init dependencies
# init-test - init test dependencies
# test - run tests
# npm-run-% - run any npm script
# npm-% - run any npm commandThis project is licensed under the MIT License - see the LICENSE file for details.