Skip to main content
The backend is a NestJS server that lives in apps/backend. It handles the REST API, authentication (Better Auth + Google OAuth), database access via Prisma, and agent routing.

Prerequisites

  • Repo cloned and dependencies installed (bun install)
  • PostgreSQL running locally

Environment variables

Copy the example file:

Database

Authentication

URLs & CORS

AI & agents

Tracing (optional)

Sandbox (Sprites)

See Sandbox Setup for full configuration details.

Database setup

Create the database

Generate the Prisma client

Run migrations

Seed test data

Creates a test user (e2e@example.com / TestPassword123!) and sample CRM data:

Browse the database


Google OAuth

  1. Go to Google Cloud Console → Credentials
  2. Click Create Credentials → OAuth client ID
  3. Choose Web application and fill in:
    • Name: Zuko (local)
    • Authorized JavaScript origins: http://localhost:3000
    • Authorized redirect URIs: http://localhost:3001/auth/callback/google
  4. Copy the Client ID and Client Secret
  5. Paste them into apps/backend/.env as GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET

Apollo.io OAuth

Required to enable the Apollo.io integration (contact enrichment, people/company search).
  1. Go to Apollo.io Developer Portal and open OAuth Registration
  2. Create a new OAuth app and fill in:
    • App name: Zuko (local) (or any name)
    • Redirect URL: http://localhost:3000/api/integrations/apollo/callback
    • Scopes: select all of the following (must match APOLLO_SCOPES in apollo-integration.service.ts):
      • read_user_profile
      • contacts_search
      • organizations_search
      • organizations_enrich
      • organizations_bulk_enrich
      • credit_usage_stats_read
      • emailer_campaigns_search
      • emailer_campaigns_create
      • emailer_campaigns_update
      • emailer_campaigns_add_contact_ids
      • emailer_campaigns_approve
  3. Copy the Client ID and Client Secret
  4. Add to apps/backend/.env:
Once configured, users can connect their Apollo account from Settings → Connections.

Start the development server

The API is available at http://localhost:3001.

Useful commands


Troubleshooting

Ensure PostgreSQL is running:
Test the connection:
Check DATABASE_URL format: postgres://user:password@host:port/dbname
Clear the cached client and regenerate:
  • Ensure TRUSTED_ORIGINS includes both http://localhost:3000 and http://localhost:3001 - Clear browser cookies and retry - Confirm the Google OAuth redirect URI is exactly http://localhost:3001/auth/callback/google