The mental model
Five concepts, in order of how often you’ll touch them:Schema — what your data looks like
Tables, fields, types, indexes. TypeScript-first. See Schema.
Queries — read data, reactively
Pure functions that read the DB. Clients subscribe; updates are automatic. See Queries.
Mutations — write data, transactionally
Write functions with ACID guarantees. Cannot call third-party APIs. See Mutations.
Actions — side-effects and third-party calls
For anything that touches the outside world: API calls, email, file processing. See Actions.
Scheduled functions — cron and one-shot
Run a mutation or action at a specific time, or on a recurring schedule. See Scheduled functions.
Why reactive queries change everything
Convex queries are subscriptions. When a client calls a query viauseQuery, the result auto-updates whenever any data the query depends on changes. No polling. No refetch. No manual cache invalidation.
The function types in detail
The split between mutations and actions is intentional: mutations are transactional and cannot call the network (so they always commit cleanly). Actions can call the network but aren’t transactional (because external APIs aren’t either).
A complete worked example
Schema:convex/schema.ts
convex/tasks.ts
convex/tasks.ts
convex/notifications.ts
process.env. Queries and mutations cannot.
A React component — putting it all together:
components/Tasks.tsx
Beyond CRUD
Convex isn’t just a database. The platform includes:File storage
Upload, store, and serve files. Image transformations included.
Vector search
Semantic search via embeddings. Built on top of mutations and queries.
Full-text search
BM25-style search across text fields. No external service.
Scheduled functions
Cron-style or delayed one-shot execution.
Auth integration
ctx.auth.getUserIdentity() is available everywhere.Migrations
Schema evolution patterns and how vly handles them automatically.
When to use which function type
A simple decision tree: vly picks the right type for you when you describe a feature. You only need to know the model when hand-editing.What vly handles automatically
When you describe a feature in vly, the agent:- Picks the right function type
- Adds the right schema indexes
- Wires up
useQuery/useMutationin components - Adds auth checks
- Generates the migration script if a schema field changes
Limits to know
For higher limits, contact support.
Next
Schema
Defining tables, fields, indexes, validators.
Queries
Reactive reads, with the patterns vly uses.
Mutations
Transactional writes.
