The backend runs on Bun, connects to MongoDB + Redis, authenticates with
Auth0, and calls OpenAI/Anthropic based on
AI_PROVIDER. This guide walks
through the minimum setup to exercise /app/launch and /api/v1/auth/*.Requirements
| Tool | Version | Notes |
|---|---|---|
| Bun | 1.1+ | Used for the runtime and scripts (bun install, bun dev) |
| Node.js | 20+ | Needed for some tooling (linting, VS Code extensions) |
| pnpm | 9+ | Optional, but matches the checked-in lockfile |
| MongoDB | 6.x | Local Docker container or Atlas cluster |
| Redis | 7.x | Local container or Upstash credentials |
| Auth0 tenant | Any | Populate the API + Management credentials |
1. Clone and install
Bun installs all workspaces declared inpackage.json, so the shared code undersrc/sharedstays in sync with the service packages.
2. Configure environment variables
Copy the sample file and fill in the required keys:src/shared/config/env.schema.ts):
| Group | Required keys | Why |
|---|---|---|
| Server & DB | PORT, DATABASE_URL | Bun boots on PORT (8080 in dev) and MongoDB connection string |
| Redis | REDIS_PROVIDER, REDIS_URL (or Upstash REST URL/token) | Rate limiting + caches |
| Auth0 | AUTH0_DOMAIN, AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, AUTH0_AUDIENCE, AUTH0_MANAGEMENT_CLIENT_ID, AUTH0_MANAGEMENT_CLIENT_SECRET | JWT validation and management API calls |
| AI providers | AI_PROVIDER, OPENAI_API_KEY, ANTHROPIC_API_KEY | Required depending on the provider you select |
| RAG | PINECONE_API_KEY, PINECONE_INDEX_NAME, SUPERMEMORY_API_KEY, RAG_ENABLED | Knowledge retrieval and conversation memory |
| Messaging | EXOTEL_API_KEY, EXOTEL_API_TOKEN, EXOTEL_SID, EXOTEL_FROM_NUMBER | OTP delivery |
3. Start dependencies
- MongoDB / Redis: run them locally (Docker, Atlas, Upstash). Update
DATABASE_URLand the Redis section to point at the running instances. - External APIs: ensure Auth0, Exotel, Langfuse, Pinecone credentials are valid for the environment you are targeting.
4. Run the server
success: true. The terminal logs will list the
mounted routes, request IDs, and any failing upstream calls.
5. Exercise core flows
Create or link a user
Use the scripts in
scripts/ (create-test-user.ts, generate-test-token.ts)
to seed a MongoDB user tied to your Auth0 identity.Send OTP / app launch
Hit
POST /api/v1/auth/send-otp to verify the Exotel wiring, then call
GET /app/launch with the headers defined in /api-reference/endpoint/app-launch.6. Run tests and checks
| Command | Purpose |
|---|---|
bun test | Runs the Bun-native unit tests |
bun test --watch | Watches files for fast feedback |
bun run typecheck | Ensures the TypeScript project compiles |
Next steps
- Follow the deeper workflow practices in
/development - Review
/api-reference/*for the launch and system health contracts - Read
APP_LAUNCH_IMPLEMENTATION.mdto understand how the device lookup + onboarding logic works before touching the service layer