Prerequisites
Before starting local development, you need to:- Deploy AWS resources using CDK (see Deploy using CDK)
- Have Node.js and Python 3 installed on your machine
- Have AWS CLI configured with appropriate credentials
Backend Development
Environment Setup
The backend is written in Python with FastAPI.- Create a Poetry environment:
Configure Environment Variables
Set the following environment variables based on your CDK deployment outputs:Configure OpenSearch Permissions
Local development requires OpenSearch data access permissions. Configure this in eithercdk/cdk.json or cdk/parameter.ts:
aoss:DescribeCollectionItemsaoss:CreateCollectionItemsaoss:DeleteCollectionItemsaoss:UpdateCollectionItems
aoss:DescribeIndexaoss:ReadDocumentaoss:WriteDocumentaoss:CreateIndexaoss:DeleteIndexaoss:UpdateIndex
Launch Local Server
Start the FastAPI server:Run Unit Tests
Frontend Development
You can locally modify and launch the frontend using AWS resources (API Gateway, Cognito, etc.) deployed with CDK.Setup Steps
- Deploy the AWS environment using CDK
- Copy the environment template:
-
Fill in
.env.localwith values from your CDK deployment output (e.g.,BedrockChatStack.AuthUserPoolClientIdXXXXX) - Start the development server:
Setup Pre-commit Hook (Recommended)
We use Lefthook for automatic type-checking and linting at commit time. While optional, it’s recommended for an efficient development experience.Install Lefthook
Refer to the official installation guide. For macOS with Homebrew:Install Poetry for Python Linting
Required formypy and black linting: