RealtimeKeep your app up to date
AuthenticationOver 80+ OAuth integrations
AI GatewayCall any major model from one API
Convex Components
ComponentsIndependent, modular, TypeScript building blocks for your backend
AI CodingGenerate high quality Convex code with AI
Open sourceSelf host and develop locally
Compare
Convex vs. Firebase
Convex vs. Supabase
Convex vs. SQL
DocumentationGet started with your favorite frameworks
SearchSearch across Docs, Stack, and Discord
TemplatesUse a recipe to get started quickly
Convex ChampionsAmbassadors that support our thriving community
Convex for StartupsStart and scale your company with Convex
Convex for Open SourceSupport for open source projects
Convex CommunityShare ideas and ask for help in our community Discord
Stack
Stack

Stack is the Convex developer portal and blog, sharing bright ideas and techniques for building with Convex.

Explore Stack
BlogChangelogDocsPricing
npm1.8M weekly
GitHub23,919 stars
Log inStart building

Try Convex

Edit the code and watch the app and data update in real time. These demos run against an in-browser Convex test runtime, so you can try queries, mutations, and scheduled functions without creating an account.

Open on a larger display

These live demos are available in browser windows 1024px wide or larger. Widen this window or open this page on a larger display to try them.

Everything is code

From database schemas to queries, from auth to APIs, express every part of your backend in pure TypeScript. Your backend code lives next to your app code, is typechecked and autocompleted, and is generated by AI with exceptional accuracy.

import { mutation, query } from "./_generated/server";
import { v } from "convex/values";
export const setComplete = mutation({
args: { id: v.id("todos") },
handler: async (ctx, args) => {
await ctx.db.patch("todos", args.id, {
// Try checking a todo--nothing happens!
// Change this to `true` and try again.
completed: false,
});
},
});
export const list = query({…});
export const add = mutation({…});
export const setIncomplete = mutation({…});
Try it out!
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
todos: defineTable({
text: v.string(),
category: v.optional(v.string()),
completed: v.boolean(),
}).index("by_completed", ["completed"]),
});

Always in sync

Convex libraries guarantee that your app always reflects changes to your frontend code, backend code, and database state in real time. No need for state managers, cache invalidation policies, or websockets.

import { api } from "../../convex/_generated/api";
import { TodoList } from "./TodoList";
import { useQuery } from "convex/react";
export function TodoApp() {
// Load more by changing `count` to 10.
// Everything updates reactively.
const todos = useQuery(api.todos.list, { count: 5 });
return <TodoList todos={todos} />;
}
Try it out!
import { mutation, query } from "./_generated/server";
import { v } from "convex/values";
export const setComplete = mutation({…});
export const list = query({
args: { count: v.number() },
handler: async (ctx, args) => {
return await ctx.db.query("todos").order("desc").take(args.count);
},
});
export const add = mutation({…});
export const setIncomplete = mutation({…});

Backend built-ins

Create cron jobs, kick off backend AI workflows, leverage built-in auth, and tap into a growing ecosystem of components that solve common backend needs with just an npm i.

import { cronJobs } from "convex/server";
import { internal } from "./_generated/api";
const crons = cronJobs();
crons.interval(
"categorize todos",
{ seconds: 5 },
internal.categorize.categorize,
{
// Add categories "Sports" and "Health"
// to see the todos categorized on the
// next cron job run.
categories: ["Chores", "Work"],
},
);
export default crons;
Try it out!
import { v } from "convex/values";
import { api, internal } from "./_generated/api";
import { internalAction, internalMutation } from "./_generated/server";
import { convexGateway } from "@convex-dev/ai-sdk-provider";
import { generateText } from "ai";
export const categorize = internalAction({
args: { categories: v.array(v.string()) },
handler: async (ctx, args) => {
const todos = await ctx.runQuery(api.todos.list, { count: 100 });
const { text } = await generateText({
model: convexGateway("~openai/gpt-luna-latest"),
system:
"You are a helpful assistant that categorizes human-written todo items into categories.",
prompt: `
` The categories are: ${args.categories.join(", ")}.
. The todoId and todo text are:
. The todoId and todo text are: ${todos.map((todo) => `${todo._id}: ${todo.text}`).join("\n")}.
.
. Return a JSON array with the format: [{"id": "$todoId", "category": "$category"}],
. Return a JSON array with the format: [{"id": "$todoId", "category": "$category"}], where $todoId is the id of the todo and $category is the task category that the todo most closely matches.
. Return a JSON array with the format: [{"id": "$todoId", "category": "$category"}], where $todoId is the id of the todo and $category is the task category that the todo most closely matches. `,
});
await ctx.runMutation(internal.categorize.setCategories, {
categories: JSON.parse(text),
});
},
});
export const setCategories = internalMutation({
args: {
categories: v.array(v.object({ id: v.id("todos"), category: v.string() })),
},
handler: async (ctx, args) => {
for (const category of args.categories) {
await ctx.db.patch("todos", category.id, {
category: category.category,
});
}
},
});
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
todos: defineTable({
text: v.string(),
category: v.optional(v.string()),
completed: v.boolean(),
}).index("by_completed", ["completed"]),
});
Get your app up and running in minutes
Start building
Convex logo
ProductSyncRealtimeAuthOpen sourceAI codingAI GatewayFAQMerchEnterprisePricing
DevelopersDocsBlogComponentsTemplatesConvex for StartupsConvex for Open SourceChampionsPodcastsLLMs.txt
CompanyAbout usBrandInvestorsBecome a partnerJobsNewsEventsSecurityLegal
SocialX (Twitter)DiscordYouTubeLumaLinkedInGitHub
A Trusted Solution
  • SOC 2 Type 2 Compliant
  • HIPAA Compliant
  • GDPR Verified
©2026 Convex, Inc.