Convex is a reactive backend-as-a-service that gives you a real-time database, server functions, and file storage. Write TypeScript functions, and Convex handles deployment, scaling, and real-time sync to every connected client.
What Makes Convex Special?
- Reactive by default — queries auto-update when data changes
- Free tier — generous limits for side projects
- ACID transactions — full transactional guarantees
- TypeScript throughout — end-to-end type safety
- Built-in file storage — no S3 needed
The Hidden API: Reactive Queries
// convex/messages.ts
import { query, mutation } from './_generated/server';
import { v } from 'convex/values';
export const list = query({
args: { channel: v.string() },
handler: async (ctx, { channel }) => {
return await ctx.db
.query('messages')
.withIndex('by_channel', q => q.eq('channel', channel))
.order('desc')
.take(50);
}
});
export const send = mutation({
args: { channel: v.string(), body: v.string(), author: v.string() },
handler: async (ctx, { channel, body, author }) => {
await ctx.db.insert('messages', {
channel, body, author,
createdAt: Date.now()
});
}
});
React Integration — Auto-Updating UI
import { useQuery, useMutation } from 'convex/react';
import { api } from '../convex/_generated/api';
function Chat({ channel }: { channel: string }) {
// This auto-updates when ANY client sends a message!
const messages = useQuery(api.messages.list, { channel });
const sendMessage = useMutation(api.messages.send);
return (
<div>
{messages?.map(msg => (
<div key={msg._id}>{msg.author}: {msg.body}</div>
))}
<button onClick={() => sendMessage({ channel, body: 'Hello!', author: 'me' })}>
Send
</button>
</div>
);
}
Scheduled Functions & Cron
// convex/crons.ts
import { cronJobs } from 'convex/server';
const crons = cronJobs();
crons.interval('cleanup', { hours: 1 }, 'cleanupExpired');
crons.cron('daily-report', '0 9 * * *', 'sendDailyReport');
export default crons;
Quick Start
npm create convex@latest
cd my-app && npm run dev
Why Teams Choose Convex
A developer shared: "We built a real-time collaborative editor in a weekend with Convex. No WebSocket code, no conflict resolution logic, no caching layer. The reactive queries handle everything — when one user edits, every other user sees it instantly."
Building real-time apps? Email spinov001@gmail.com or check my tools.
Real-time backend: Convex vs Firebase vs Supabase? What do you use?
Top comments (0)