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)
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
- Go to Google Cloud Console → Credentials
- Click Create Credentials → OAuth client ID
- Choose Web application and fill in:
- Name:
Zuko (local) - Authorized JavaScript origins:
http://localhost:3000 - Authorized redirect URIs:
http://localhost:3001/auth/callback/google
- Name:
- Copy the Client ID and Client Secret
- Paste them into
apps/backend/.envasGOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET
Apollo.io OAuth
Required to enable the Apollo.io integration (contact enrichment, people/company search).- Go to Apollo.io Developer Portal and open OAuth Registration
- 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_SCOPESinapollo-integration.service.ts):read_user_profilecontacts_searchorganizations_searchorganizations_enrichorganizations_bulk_enrichcredit_usage_stats_reademailer_campaigns_searchemailer_campaigns_createemailer_campaigns_updateemailer_campaigns_add_contact_idsemailer_campaigns_approve
- App name:
- Copy the Client ID and Client Secret
- Add to
apps/backend/.env:
Start the development server
| Endpoint | Description |
|---|---|
http://localhost:3001 | REST API |
http://localhost:3001/auth | Better Auth routes |
Useful commands
Troubleshooting
PostgreSQL connection error
PostgreSQL connection error
Ensure PostgreSQL is running:Test the connection:Check
DATABASE_URL format: postgres://user:password@host:port/dbnamePrisma client errors
Prisma client errors
Clear the cached client and regenerate:
Auth / CORS errors
Auth / CORS errors
- Ensure
TRUSTED_ORIGINSincludes bothhttp://localhost:3000andhttp://localhost:3001- Clear browser cookies and retry - Confirm the Google OAuth redirect URI is exactlyhttp://localhost:3001/auth/callback/google
Port already in use
Port already in use