Convex App
Convex Backend
Overview of the Convex real-time backend and its architecture.
YeetCode's backend runs on Convex — a real-time backend-as-a-service that handles the database, serverless functions, scheduling, and file storage. The Convex backend lives in apps/convex/.
Why Convex
- Real-time by default — Queries automatically subscribe to changes. No polling, no WebSocket boilerplate.
- Type-safe end-to-end — Schema definitions generate TypeScript types that flow through queries, mutations, and the client.
- Built-in scheduling —
ctx.scheduler.runAfter()for deferred work without external queue infrastructure. - Transactions — Mutations are automatically transactional.
Package Structure
apps/convex/
├── schema.ts # Database schema (tables, indexes)
├── auth.config.ts # Clerk JWT authentication config
├── http.ts # HTTP router for webhook endpoints
├── env.ts # Environment variable validation (Zod + t3-env)
├── triggers.ts # Database trigger system (convex-helpers)
├── userManagement.ts # User sync mutations (Clerk → Convex)
├── utils.ts # Workflow cleanup utilities
├── models/ # Data access layer
│ ├── users.ts # User CRUD operations
│ └── webhooks.ts # Webhook event storage
├── clerk/ # Clerk integration
│ ├── webhookEvents.ts # Webhook HTTP handler + internal mutations
│ └── webhookSchemas.ts # Zod schemas for Clerk webhook payloads
└── _generated/ # Auto-generated by Convex (excluded from linting)Dependencies
| Package | Purpose |
|---|---|
convex | Core Convex SDK |
convex-helpers | Community utilities (triggers, custom functions) |
@convex-dev/auth | Convex authentication module |
@convex-dev/workflow | Workflow management for multi-step operations |
@clerk/backend | Clerk backend SDK (webhook types) |
svix | Webhook signature verification |
zod | Schema validation |
@t3-oss/env-core | Type-safe environment variables |
@polar-sh/sdk | Polar.sh payment integration |
resend | Transactional email sending |
@yeetcode/email | Email templates (workspace dependency) |
Development
cd apps/convex
bun run dev # Starts Convex dev server with tail logsThis connects to your Convex deployment and watches for file changes. Logs stream in real-time.