Skip to main content
Queries are read-only, reactive functions. Clients subscribe via useQuery; updates push automatically when data changes.

Anatomy

convex/tasks.ts
Three things:
  • args validators (Convex enforces and types).
  • ctx.db for database access.
  • ctx.auth for the calling user’s identity.

On the client

Patterns

Limits

  • Cannot mutate the database.
  • Cannot call third-party APIs — use actions for that.
  • 10-second timeout per call.

Tips

Always use .withIndex() over .filter() for non-tiny tables. .filter() walks every row.
Subscribe close to consumption. A useQuery near the rendering component re-runs only when its data changes — better than passing data through five levels of props.

Schema

Define tables and indexes.

Mutations

Write data.

Indexes

Make queries fast.
Last modified on April 18, 2026