Convex Database
Set up the reactive Convex database for local development
StudyStudio uses Convex as its database - a reactive, serverless database that syncs data to the client in real time. Your queries, mutations, and actions live in the convex/ directory.
Start Convex Dev
From the project root, run:
npx convex devThe first time you run it, Convex will:
- Create a free cloud deployment for your project
- Apply the schema from
convex/schema.ts - Generate TypeScript types into
convex/_generated/ - Print a URL (for example
https://<your-project>.convex.cloud) and automatically writeNEXT_PUBLIC_CONVEX_URLinto your.env.local
Verify the Schema
The schema defines tables for notebooks, sources, chat messages, notes, study tools (audio overviews, data tables, mind maps, reports, flashcards, quizzes), user plans, admin users, and platform config. It is applied automatically when Convex starts.
Deploy Convex Functions
While developing, npx convex dev watches your convex/ files and deploys changes automatically. Any time you change a query, mutation, or action, Convex re-deploys it instantly.
Keep the npx convex dev terminal running for the whole development
session - the Next.js app reads and writes to Convex through it.