React and NestJS S3 and Lambda Deployments
An AWS code pipeline is created for each application. This pipeline is responsible for deploying the infrastructure and the application code. The pipeline is triggered when a new commit is pushed to the specified branch of the application's repository.
Architectures
React and NestJS S3 and Lambda

React and NestJS S3 and Lambda with Database

Static Files
Static files of the React application are deployed to an S3 bucket. The deployed bucket is private and all static files are served using CloudFront.
Lambda Servers
Lambda servers handle API requests and other server-side logic for the NestJS service. When the application is deployed with a database, the lambda servers are placed in a private subnet and are not directly accessible from the internet. When the application is deployed without a database, the lambda servers are not deployed in a VPC, but the URL used to trigger the lambda function requires IAM authentication.
Lambda Warmers
A lambda warmer function is used to call the server lambda functions. This is done to reduce the cold start time of the lambda functions. The lambda warmer function is triggered by an EventBridge event and is scheduled to run every 5 minutes. The dashboard allows you to configure the number of servers to keep warm.
Secrets
Secrets are stored in AWS Secrets Manager and are exposed to the lambda servers as environment variables. The Zonké
dashboard allows you to add, update, and delete secrets for the NestJS services. Secrets are only stored in your AWS
account and are encrypted at rest and in transit. The React application can access these secrets using the
process.env
object and directly from Secrets Manager.
Database
The NestJS services can be connected to a database. The database is deployed using RDS and is accessible from the lambda servers. Database credentials are stored in AWS Secrets Manager and, just like other service secrets, they are exposed to the lambda servers as secrets. The database is placed in an isolated subnet and is only accessible from the lambda servers.
ORMs and Database Migrations
NestJS services using an ORM (currently only Prisma is supported) can run database migrations during deployment. A migration lambda function is created and triggered by the pipeline during application deployment. You do not need to configure anything in your codebase to run migrations.