Upstash Realtime is the easiest way to add realtime features to any Next.js project.

Why Upstash Realtime?#
- 𧨠Clean APIs & first-class TypeScript support
- β‘ Extremely fast, zero dependencies, 2.6kB 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#
1. Installation#
2. Configure Upstash Redis#
Upstash Realtime is powered by Redis Streams. Grab your credentials from the Upstash Console.

Add them to your environment variables:
And lastly, create a Redis instance:
3. Define Event Schema#
Define the structure of realtime events in your app:
4. Create Realtime Route Handler#
Create a route handler at api/realtime/route.ts:
5. Add the Provider#
Wrap your application in RealtimeProvider:
6. Create Typed Client Hook#
Create a typed useRealtime hook for your client components:
7. Emit Events#
From any server component, server action, or API route:
8. Subscribe to Events#
In any client component:
Thatβs it! Your app is now listening for realtime events with full type safety. π
9. Realtime Dashboard#
For debugging or monitoring purposes, you can use Realtime Dashboard in console.
