apps/backend. It handles the REST API, authentication (Better Auth + GitHub 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)
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
GitHub OAuth
- Go to github.com/settings/developers
- Click New OAuth App
- Fill in:
- Application name:
Zuko (local) - Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3001/auth/callback/github
- Application name:
- Copy the Client ID and generate a Client Secret
- Paste them into
apps/backend/.envasGITHUB_CLIENT_IDandGITHUB_CLIENT_SECRET
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 GitHub OAuth callback URL is exactly
http://localhost:3001/auth/callback/github
Port already in use
Port already in use