What is Convex?
Convex is a backend platform that gives you a database, typed functions, and realtime — all in one.
Mental model
Plain English
Convex replaces the usual 'API + database + websocket' stack with one thing. You define a schema. You write functions (queries, mutations, actions) in TypeScript. Your React app calls them with useQuery/useMutation. Live updates are automatic.
Convex is a kitchen, fridge, and serving hatch combined — you don't wire pipes between three rooms.
useQuery(api.tasks.listForWedding, { weddingId }) returns the live task list — it auto-updates when anyone adds a task.
useMutation(api.conversations.assign) reassigns a conversation; every connected inbox sees it instantly.
Go deeper
Backend in a box: database + functions + realtime.
Common mistakes
- Calling external APIs from a mutation. Use an action.
- Skipping indexes and scanning the whole table.
- Putting business rules in the React component instead of the function.
AI-agent trap
Summary
Schema in convex/schema.ts. Queries (read), mutations (write), actions (talk to outside world) in convex/*.ts. React uses useQuery/useMutation. Subscriptions are automatic.