
Why Upstash Realtime?
- โฐ Setup takes 60 seconds
- ๐งจ Clean APIs & first-class TypeScript support
- โก Extremely fast, zero dependencies, 1.9kB gzipped
- ๐ป Deploy anywhere: Vercel, Netlify, etc.
- ๐ 100% type-safe with zod 4 or zod mini
- โฑ๏ธ Built-in message histories
- ๐ Automatic connection management w/ delivery guarantee
- ๐ Built-in middleware and authentication helpers
- ๐ถ 100% HTTP-based: Redis streams & SSE
Quickstart
Get Upstash Realtime running in your Next.js app in under 60 seconds.1. Installation
2. Configure Upstash Redis
Upstash Realtime is powered by Redis Streams. Grab your credentials from the Upstash Console.
.env
lib/redis.ts
3. Define Event Schema
Define the structure of realtime events in your app:lib/realtime.ts
4. Create Realtime Route Handler
Create a route handler atapi/realtime/route.ts
:
app/api/realtime/route.ts
5. Emit Events
From any server component, server action, API route:app/api/notify/route.ts
6. Subscribe to Events
In any client component:app/components/notifications.tsx