Contributing
Develop ChatAI in the monorepo — scripts, migrations, and PR checklist.
Thanks for contributing. Prefer small, focused PRs. The canonical guide lives in the repo root CONTRIBUTING.md; this page summarizes day-to-day workflows.
Prerequisites
- Node.js 20+ (22 recommended)
- pnpm 10+
- Docker optional if you use Neon for Postgres
Setup
git clone <repo-url>
cd chatAI
cp .env.example .env
pnpm installDatabase:
- Neon: pooled
DATABASE_URL+ directDATABASE_URL_UNPOOLED - Local:
docker compose up -d dband the default URL from.env.example
pnpm db:migrate
pnpm dev # apps/web → http://localhost:3000
pnpm docs:dev # apps/docs → http://localhost:3001Useful scripts
| Script | Purpose |
|---|---|
pnpm dev | Turbo dev (web) |
pnpm docs:dev / pnpm docs:build | Documentation site |
pnpm lint / pnpm typecheck / pnpm test / pnpm build | Quality gates |
pnpm db:generate | Create Drizzle migration from schema |
pnpm db:migrate | Apply migrations (drizzle-kit) |
pnpm migrate | Runtime migrator (also used in Docker entrypoint) |
pnpm seed:demo | Demo user + support bot + refund FAQ |
pnpm widget:build | Build embeddable chat.js |
pnpm examples:prepare-widget | Copy widget into HTML examples |
Migrations
- Edit schema under
packages/database/src/schema pnpm db:generate→ review SQL underpackages/database/migrations- Apply with
pnpm db:migrate(dev) or rely on Docker boot (migrate.mjs) - Embedding column width is fixed at
vector(1536)today — do not assumeEMBEDDING_DIMENSIONSalone changes storage
Coding standards
- TypeScript strict; explicit types at package boundaries
- Prettier + ESLint (
pnpm format,pnpm lint) - No secrets in git (
.env, API keys) - Keep diffs scoped to the task
Pull requests
- Issue first for larger features
- Branch from
main(or the active version branch) - Ensure
pnpm lint,pnpm typecheck, andpnpm buildpass (includepnpm docs:buildwhen touching docs) - Fill the PR template (summary + test plan)