Skip to main content
Quick Setup with copy-env
From the backend/ directory, scaffold the runtime env file in one command:
This reads copy-env-config.json and copies src/.env.example to src/.env. The backend loads src/.env at startup; fill in the generated placeholders before running the server. Docker Compose can additionally load backend/src/.env when that file exists.
The production backend container runs pending Drizzle migrations before starting the API. Set DATABASE_URL in the container environment before startup. Keep migration execution in the container’s startup command rather than the image build so the image can be built without database access.

Configuration Overview Table


Detailed Configuration Breakdown

Where to Get Each Backend Value

Create the backend file from backend/src/.env.example and replace every YOUR_VALUE_HERE placeholder. Keep this file private: backend environment values are secrets unless marked public configuration.

GITHUB_WEBHOOK_VERIFICATION_SECRET

This secret authenticates incoming POST /webhook requests. The backend verifies GitHub’s HMAC-SHA256 signature against the raw request body before checking the event type or writing to PostgreSQL and Redis. Configure the same secret in both places:
  1. In the GitHub repository or GitHub App webhook settings, enter it in the Secret field.
  2. In backend/src/.env or the production backend environment, set GITHUB_WEBHOOK_VERIFICATION_SECRET to the same value.
Do not add the secret to the frontend, commit it to source control, or include it in logs. The /webhook endpoint does not require a user session because GitHub authenticates it with this signature.

Generate an Encryption Key

Backend Secrets and Rotation

Never place AI_API_KEY, DATABASE_URL, REDIS_URL, RESEND_API_KEY, GitHub secrets, or API_ENCRYPTION_KEY in frontend files, source control, Docker images, or public issue reports. If a secret is exposed, revoke it at the provider immediately and replace it in the backend environment.

1. Networking & CORS

PORT

  • Location: backend/.env
  • Description: Defines which port the server listens on upon startup (app.listen(port)).
  • Example:

CLIENT_URL

  • Location: backend/src/.env or the Compose environment
  • Description: Configured in Express’s cors() middleware in backend/src/server.ts:
  • Example:

2. Database & Storage

DATABASE_URL

  • Location: backend/.env
  • Description: Target PostgreSQL database instance. Required for running migrations via Drizzle ORM and managing client queries through pg.Pool.
  • Format: postgresql://[user]:[password]@[host]:[port]/[database]?sslmode=[mode]
  • Example:

REDIS_URL

  • Location: backend/.env
  • Description: Redis instance utilized for BullMQ task distribution, queueing pull request webhooks, managing user sessions, and coordinating async worker jobs.
  • Example:

3. AI Engine & Provider Routing

BASE_MODEL

  • Location: backend/.env
  • Description: Default model slug invoked when a review job does not supply an explicit model preference.
  • Example:

AI_API_KEY & AI_BASE_URL

  • Location: backend/.env
  • Description: Supplies authentication and custom base URL for the backend’s AI service (backend/src/service/ai.service.ts).
  • Example:

OPEN_AI_INTERFACE

  • Location: backend/.env
  • Description: Determines interface method on OpenAI SDK (chat by default).

4. Email Service & Delivery

RESEND_API_KEY

  • Location: backend/.env
  • Description: Authenticates with Resend API (backend/src/lib/resendEmail.ts) to dispatch transactional authentication emails (email verification OTPs, password reset links).
  • Example:

5. Platform Branding & Email Theming

Configured in backend/.env or defaults in backend/src/config/config.ts:

6. In-Code Platform Pricing & Quotas

Located in backend/src/config/config.ts:

Server Environment Template (backend/.env.example)