A Note on Your Database
It is critical to understand that the LaunchKit AWS CDK stack provisions your application infrastructure (compute, CDN, networking, etc.), but it does not provision a database. This is intentional and follows best practices. Separating your stateless application from your stateful database allows for independent scaling, updates, and management, which is crucial for a production environment. You must provision your own production-grade Postgres database before starting this guide.Prerequisites
Before you can deploy, ensure you have the following set up:- AWS Account & Credentials: You need an active AWS account. The easiest way to provide credentials is to install the AWS CLI and run
aws configure
. - Node.js and NPM: Ensure you have Node.js (v18.x or later) installed.
- AWS CDK Toolkit: The CDK command-line tool must be installed globally. If you don’t have it, run:
Deployment Steps
Step 1: Provision a Production Database
If you haven’t already, create a production Postgres database. We recommend a managed service for reliability and ease of use. Popular options include: Once your database is created, find and copy its connection string. It will look something like this:postgresql://user:password@host:port/database
.
Step 2: Configure Production Secrets
The deployment script reads its configuration from an environment file. It’s best practice to create a separate file for production secrets.-
In the root of your project, create a copy of the example environment file:
-
Open the new
.env.prod
file and fill in all the required variables for your production environment (Stripe, Resend, etc.). -
Most importantly, add the database connection string you obtained in Step 1:
Step 3: Install CDK Dependencies
The CDK infrastructure code is in its own directory with its own dependencies.-
Navigate to the CDK directory:
-
Install its dependencies:
Step 4: Deploy the Stack to AWS
From within thecdk
directory, run the deployment command. This command tells the CDK to use the variables from your .env.prod
file.
After Deployment
Once the process is complete, the CDK will output theDistributionDomain
. This is the public CloudFront URL for your live application. You can find it in the “Outputs” section of your terminal.
Optional: Custom Domain
The feature to automatically configure a custom domain via the CDK is coming soon. For now, you can manually point your domain to the application by creating aCNAME
record in your DNS provider that points to the CloudFront distribution domain provided in the CDK output.
Next Steps
Congratulations! You have a fully deployed, production-ready SaaS application. Now is a great time to learn more about the architecture you just deployed.Next: Core Concepts
Explore the architecture of LaunchKit AWS to understand how the frontend,
backend, and infrastructure all work together.