YeetCode
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 schedulingctx.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

PackagePurpose
convexCore Convex SDK
convex-helpersCommunity utilities (triggers, custom functions)
@convex-dev/authConvex authentication module
@convex-dev/workflowWorkflow management for multi-step operations
@clerk/backendClerk backend SDK (webhook types)
svixWebhook signature verification
zodSchema validation
@t3-oss/env-coreType-safe environment variables
@polar-sh/sdkPolar.sh payment integration
resendTransactional email sending
@yeetcode/emailEmail templates (workspace dependency)

Development

cd apps/convex
bun run dev    # Starts Convex dev server with tail logs

This connects to your Convex deployment and watches for file changes. Logs stream in real-time.

Next Steps

On this page