Welcome to the CoverAI monorepo workspace. This project is structured as a premium, highly optimized full-stack monorepo integrating a high-performance Python FastAPI backend, a Next.js 14 React frontend, shared schemas, and database container stacks.
coverai/
├── apps/
│ ├── web/ → Next.js 14 frontend (App Router, strict TypeScript, Tailwind CSS)
│ └── api/ → FastAPI backend (Python 3.11, Poetry, SQLAlchemy 2.0 Async)
├── packages/
│ ├── shared-types/ → Centralized Zod schemas & types for validation (User, Vehicle, Policy, Claim)
│ └── ui/ → Workspace-shared visual components (built with shadcn/ui "new-york" preset)
├── .env.example → Core template configuration for credentials and connections
├── docker-compose.yml → Local multi-service infrastructure (postgres, redis, api, web)
├── turbo.json → Workspace pipeline configuration for Turborepo caching
├── Makefile → Orchestration entrypoints for development operations
├── .gitignore → Workspace ignore definitions for Node, Python, IDEs, and credentials
└── README.md → Developer instructions and platform guides
Make sure you have the following installed on your machine:
- Node.js (v18 or newer, v20+ recommended)
- pnpm (v9 or newer, workspace manager)
- Python 3.11+
- Poetry (Python package manager)
- Docker Desktop
Create your local environment file by cloning the template:
cp .env.example .envFill in the credentials inside .env (such as OPENAI_API_KEY, etc.).
From the root directory, run the workspace-level installer to bootstrap both internal packages (shared-types, ui) and the Next.js web app:
pnpm installTo set up autocompletion and dependencies on your host machine:
cd apps/api
poetry install --no-root(Note: If compiling the native postgres driver fails on the host due to a lack of C++ compiler libraries, don't worry! Dependencies compile seamlessly inside our Linux Docker environments.)
We orchestrate our development suite using Docker Compose. Hot reloading is enabled on both Next.js and FastAPI through workspace-level directory mappings.
Spin up the entire platform (PostgreSQL 15, Redis 7, FastAPI Backend, Next.js Frontend):
docker compose up --build- Next.js Web Portal: http://localhost:3000
- FastAPI API Swagger Docs: http://localhost:8000/docs
- FastAPI Health Checks: http://localhost:8000/health
- PostgreSQL Port:
5432 - Redis Port:
6379
We provide a Makefile at the root to automate common lifecycle tasks:
| Command | Action |
|---|---|
make dev |
Spins up the full Docker container environment with hot reload enabled |
make build |
Builds the Node monorepo apps and packages using Turborepo |
make lint |
Runs Node ESLint checks and Python lint analysis |
make test |
Executes both Next.js tests and backend pytest runner |
make migrate |
Applies pending database Alembic schema migrations |
make clean |
Tears down container stacks, purges volumes, and removes build artifacts |
@coverai/shared-types: Zod schemas and inferred types are defined inpackages/shared-typesand referenced in package.json:"@coverai/shared-types": "workspace:*"
@coverai/ui: Premium shared buttons, inputs, and components are defined inpackages/uiand can be imported directly in Next.js:import { Button } from "@coverai/ui";
- Frontend: Vercel (Next.js)
- Backend: Railway (FastAPI)
- Database: Supabase (PostgreSQL)
- Redis: Upstash (serverless)
- AI: Google Gemini API
- Push code to GitHub
- Create a Supabase project → get connection string
- Create a Railway project → connect GitHub repo
- Create a Vercel project → connect GitHub repo
- Get a Gemini API key
Set these in Railway dashboard → Variables:
DATABASE_URL=postgresql://postgres:[PASSWORD]@[HOST]:6543/postgres
REDIS_URL=rediss://default:[PASSWORD]@[HOST]:6379
GEMINI_API_KEY=your_key
JWT_SECRET=generate_with_openssl_rand_hex_32
ALLOWED_ORIGINS=https://your-app.vercel.app
STORAGE_BUCKET=coverai-documents-bucket
FIELD_ENCRYPTION_KEY=REQUIRED
FIELD_ENCRYPTION_KEYis REQUIRED — no default is shipped. The backend refuses to start (and document encryption raises) if it is missing or is not a valid Fernet key. Generate one with:python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
Set in Vercel dashboard → Environment Variables:
NEXT_PUBLIC_API_URL=https://your-backend.railway.app/api/v1
After Railway deploys, run migrations:
# Connect to Railway and run:
cd apps/api
alembic upgrade headOr use the seed script for demo data:
python scripts/seed_dev.py- Connect GitHub repo to Railway
- Select
apps/apias root directory - Railway auto-detects Dockerfile
- Add environment variables
- Deploy → get URL like
https://coverai-api.up.railway.app
- Import repo in Vercel
- Set Root Directory to
apps/web - Add
NEXT_PUBLIC_API_URLenvironment variable - Deploy → get URL like
https://coverai.vercel.app
Update Railway ALLOWED_ORIGINS to include your Vercel URL.
.github/workflows/ci.yml runs on pull requests and pushes to main. The workflow
requests read-only contents permission and cancels superseded runs on the same
ref. It defines two jobs, and every step fails the job on error (no fallbacks):
API job — apps/api, Python 3.12, Poetry 2.2.1, 20-minute timeout:
poetry check --lock— verifiespyproject.tomlandpoetry.lockare in syncpoetry install --no-root --no-interaction— installs locked dependenciespoetry run pytest -q— test suitepoetry run ruff check .— Python lintpoetry run python -m pip_audit— dependency vulnerability audit
Web job — pnpm 9.1.4, Node 20, 15-minute timeout:
pnpm install --frozen-lockfile— installs from the committed lockfilepnpm --filter web lintpnpm --filter web exec tsc --noEmitpnpm --filter web buildpnpm audit --audit-level=high— fails on any high or critical advisory
This repository contains no automatic deployment step; deployment is performed manually following the steps below.
- Backend:
https://your-backend.railway.app/health - Frontend:
https://your-app.vercel.app
See EXECUTION_GUIDE.md for local development.