trpc / examples-next-sse-chat

⚡️ tRPC with Server-Sent Events

Home Page:https://sse.trpc.io

Repository from Github https://github.comtrpc/examples-next-sse-chatRepository from Github https://github.comtrpc/examples-next-sse-chat

tRPC + Server-sent Events (SSE)

This example showcases the use of httpSubscriptionLink to facilitate .useSubscription via Server-sent Events.

Try demo http://sse.trpc.io/

Features

  • 🧙‍♂️ E2E type safety with tRPC
  • ⚡ Full-stack React with Next.js
  • ⚡ Server-Sent-Events / Subscription support
  • ⚡ Database with Drizzle
  • 🔐 Authorization using next-auth

Code

This project includes 2 examples of the subscription pattern:

  1. Simple example of whoIsTyping
  2. A slightly more involved example of livePosts

Setup

git clone git@github.com:trpc/examples-next-sse-chat.git
pnpm i
cp .env.example .env
pnpm dev

About

⚡️ tRPC with Server-Sent Events

https://sse.trpc.io


Languages

Language:TypeScript 98.7%Language:CSS 1.1%Language:JavaScript 0.2%