Backend for a production-ready AI SaaS platform built around an agent-based architecture powered by LangChain.
The system exposes a unified conversational endpoint (/api/v1/messages) where users interact with an AI agent capable of maintaining context across chats, reasoning over inputs, and orchestrating tools to generate dynamic responses. The agent uses LangChain for prompt orchestration, memory management, and integration with external tools and data sources.
It supports:
- Context-aware multi-turn conversations with persistent memory
- Retrieval and analysis of user files stored in S3
- Agent-driven tool usage and extensibility
- Structured workflows for building AI-powered features beyond simple chat
The API is fully documented and testable via Scalar at /docs, exposing all available routes with an interactive interface for exploration and debugging.
Designed with production in mind, the project demonstrates:
- Scalable architecture on Kubernetes (EKS)
- Infrastructure as Code with Terraform
- Containerization with Docker and ECR
- Managed database with PostgreSQL (RDS)
- Secure networking using VPC, IAM, and CloudFront
- CI/CD pipelines via GitHub Actions
- Clean architecture and strong separation of concerns
- Type-safe backend using TypeScript and Prisma
⚠️ This project uses real cloud infrastructure (AWS). Make sure you have the proper credentials and permissions.
Set your AWS credentials in environment variables:
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
- Login to your Terraform account (HCP Terraform)
- Update the AWS region if needed inside the Terraform files
Run Terraform to create the required resources:
bun run iac:init
bun run iac:apply
After provisioning, update your .env using .env.example file with all required values, including:
- Database credentials (generated by Terraform)
- Any other service/environment variables
Run the deployment scripts:
sh k8s/scripts/secrets.sh
sh k8s/scripts/deploy.sh
bunx prisma migrate deploy
bun dev