Deployment Configuration
Clone the repository and configure the environment variables required for deploying your AI SaaS platform
Deployment Configuration
This guide covers setting up your GitHub repository and configuring both the CDK context and environment variables required to deploy your AI SaaS platform. Setting up these configurations correctly is essential for a successful deployment of all infrastructure components.
Creating Your GitHub Personal Access Token
Create a GitHub Personal Access Token
Follow these steps to create a GitHub personal access token for AWS Amplify deployment:
-
Log in to GitHub: Go to github.com and sign in to your account.
-
Access Developer Settings:
- Click on your profile photo in the top-right corner
- Select "Settings" from the dropdown menu
- Scroll down and click on "Developer settings" in the left sidebar
- Click on "Personal access tokens" → "Tokens (classic)"
-
Generate a New Token:
- Click "Generate new token" → "Generate new token (classic)"
- Note: You may need to confirm your password
-
Configure Token Settings:
- Token name: Enter a descriptive name (e.g., "AI SaaS Amplify Deployment")
- Expiration: Choose an appropriate expiration (30 days, 60 days, or custom)
- Scopes: Select the following permissions:
- ✓
repo
(Full control of private repositories) - ✓
admin:repo_hook
(Full control of repository hooks)
- ✓
-
Create Token:
- Scroll to the bottom and click "Generate token"
-
Copy Your Token:
- IMPORTANT: Copy the generated token immediately
- GitHub will only show this token once
- Store it securely for use in your .env file
Treat your token like a password. Never share it publicly or commit it to version control. If you believe your token has been compromised, revoke it immediately in GitHub and create a new one.
Repository Setup
Access Your Pre-Created Repository
After purchasing the AI SaaS Boilerplate, a private repository will be automatically created for you under the deployframe-official
organization with a unique identifier.
- Check your email for a GitHub repository invitation
- The repository will be named:
deployframe-official/deployframe-boilerplate-XXXXXXXXX
(where XXXXXXXXX is your unique identifier) - Click the invitation link in your email to accept access to the repository
- You will have admin access to this repository
The repository is created specifically for you and contains the complete AI SaaS Boilerplate codebase. You have full admin access and can manage it as needed.
Clone Your Repository
Clone the repository that was created for you to your local machine:
Replace XXXXXXXXX
with your actual unique identifier from the repository name you received.
When cloning your private repository, you'll be prompted for authentication. Use your GitHub username as the username and the personal access token you created earlier as the password (GitHub has disabled password authentication for Git operations since August 2021).
Set Up Project Environment Variables
Set up environment variables for project paths that will be used throughout the deployment process:
These environment variables will allow you to run deployment commands from any directory within your project, making the process more flexible and user-friendly.
Create and Set Up the Development Branch
The repository initially contains only the main
branch. Create a dev
branch for development deployment:
This creates a new dev
branch locally, switches to it, and pushes it to the remote repository with upstream tracking. By default, the deployment will target the dev
branch since the default configuration uses stage=dev
.
It's recommended to start with the development environment first before deploying to production.
Navigate to the CDK Directory
The repository has a monorepo structure with separate folders for frontend, backend, and infrastructure (CDK). Navigate to the CDK directory where we'll configure the deployment:
Understanding the Configuration Approach
The AI SaaS Boilerplate uses environment variables for all configuration settings including the application name. This approach has several advantages:
- Consistency: All configuration is managed in one place through environment variables
- Security: Sensitive information like API keys aren't stored in version control
- CI/CD Friendly: Environment variables are easy to integrate with CI/CD systems like GitHub Actions
- Flexibility: Environment-specific settings can vary between development, staging, and production
For the initial core deployment, we'll use placeholder values for third-party services like Stripe and Google OAuth. You'll update these with real values after verifying the core infrastructure.
Setting Up Environment Variables
Create Environment Variables File
Create a file named .env
in your project's cdk
directory:
Make sure to replace placeholders with your actual values:
- Set your actual AWS account ID from the previous step
- Update GITHUB_REPO with your actual unique repository identifier (replace XXXXXXXXX)
- Add your GitHub personal access token to GITHUB_TOKEN
- You can customize APP_NAME to your preferred application name
- Leave DOMAIN_NAME and OPENAI_API_KEY empty for initial deployment
- Other placeholder values (like Stripe and Google OAuth) can be updated later
The .env
file should not be committed to version control. Make sure to add it to your .gitignore
file.
Understanding Key Configuration Variables
Here's an explanation of the key configuration options used in the deployment process:
Environment Variables (in .env)
Variable | Description | Example |
---|---|---|
APP_NAME | Application name for resource naming and stack identification | ai-saas |
AWS_DEFAULT_REGION | The AWS region for deployment | eu-west-2 |
AWS_ACCOUNT_ID | Your AWS account ID | 123456789012 |
STAGE | Deployment environment (dev, prod) | dev |
DOMAIN_NAME | Domain for the application (can be empty initially) | `` |
GITHUB_OWNER | GitHub organization name (deployframe-official) | deployframe-official |
GITHUB_REPO | Your unique repository name | deployframe-boilerplate-XXXXXXXXX |
GITHUB_TOKEN | GitHub personal access token | ghp_xxxxxxxxxxxx |
GITHUB_DEV_BRANCH | Branch name to use for development environment | dev |
GITHUB_PROD_BRANCH | Branch name to use for production environment | main |
STRIPE_API_PUBLIC_KEY | Stripe publishable key | pk_test_... |
STRIPE_API_SECRET_KEY | Stripe secret key | sk_test_... |
STRIPE_WEBHOOK_SECRET_KEY | Stripe webhook signing secret | whsec_... |
GOOGLE_OAUTH_CLIENT_ID | Google OAuth client ID | ....apps.googleusercontent.com |
GOOGLE_OAUTH_CLIENT_SECRET | Google OAuth client secret | Secret value |
GOOGLE_ANALYTICS_ID | Google Analytics tracking ID | G-XXXXXXXXXX |
OPENAI_API_KEY | OpenAI API key for AI services | `` |
YOUTUBE_API_KEY | Youtube API key for AI services | `` |
Authentication Email Templates
The authentication system uses customizable email templates for user verification:
Template | Description | Location |
---|---|---|
verification_email_subject.txt | Subject line for verification emails | cdk/lib/core/auth/templates/ |
verification_email_body.txt | Body content for verification emails | cdk/lib/core/auth/templates/ |
These templates support the following placeholders:
{app_name}
- Automatically replaced with your application name from the APP_NAME environment variable{####}
- Replaced with the verification code (required in the email body)
The system includes default templates that work well for most deployments. The templates are loaded at deployment time and can be customized if needed for specific branding requirements.
Next Steps
Now that you've configured both your CDK context and environment variables required for deployment, you're ready to proceed to the Core Deployment Process section to deploy the infrastructure using these settings.