{"id":19218073,"url":"https://github.com/trpc/examples-next-sse-chat","last_synced_at":"2025-04-09T17:22:58.677Z","repository":{"id":245607049,"uuid":"818701122","full_name":"trpc/examples-next-sse-chat","owner":"trpc","description":"⚡️ tRPC with Server-Sent Events","archived":false,"fork":false,"pushed_at":"2025-03-31T19:39:46.000Z","size":106,"stargazers_count":63,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T15:03:12.808Z","etag":null,"topics":["sse","trpc"],"latest_commit_sha":null,"homepage":"https://sse.trpc.io","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-22T15:51:17.000Z","updated_at":"2025-03-31T19:39:50.000Z","dependencies_parsed_at":"2024-08-11T22:28:02.049Z","dependency_job_id":"6a055aa9-e54f-42cf-888f-46b76988c5a8","html_url":"https://github.com/trpc/examples-next-sse-chat","commit_stats":{"total_commits":31,"total_committers":7,"mean_commits":4.428571428571429,"dds":"0.32258064516129037","last_synced_commit":"48502c8ff09e9d256118a5bd640e882c5d120418"},"previous_names":["trpc/examples-next-sse-chat"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc%2Fexamples-next-sse-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc%2Fexamples-next-sse-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc%2Fexamples-next-sse-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc%2Fexamples-next-sse-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trpc","download_url":"https://codeload.github.com/trpc/examples-next-sse-chat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075319,"owners_count":21043563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sse","trpc"],"created_at":"2024-11-09T14:25:06.567Z","updated_at":"2025-04-09T17:22:58.652Z","avatar_url":"https://github.com/trpc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tRPC + Server-sent Events (SSE)\n\nThis example showcases the use of `httpSubscriptionLink` to facilitate `.useSubscription` via [Server-sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).\n\nTry demo http://sse.trpc.io/\n\n## Features\n\n- 🧙‍♂️ E2E type safety with [tRPC](https://trpc.io)\n- ⚡ Full-stack React with Next.js\n- ⚡ Server-Sent-Events / Subscription support\n- ⚡ Database with [Drizzle](https://orm.drizzle.team/)\n- 🔐 Authorization using [next-auth](https://next-auth.js.org/)\n\n## Code\n\nThis project includes 2 examples of the subscription pattern:\n\n1. Simple example of `whoIsTyping`\n2. A slightly more involved example of `livePosts`\n\n- Hooks for both cases (using `trpc.{x}.useSubscription`) can be found in [`/src/app/channels/[channelId]/hooks.ts`](./src/app/channels/[channelId]/hooks.ts)\n- The `EventEmitter` \u0026 `whoIsTyping` subscription route can be found in [`/src/server/routers/channel.ts`](./src/server/routers/channel.ts)\n- The more complex `post` subscription route can be found in [`/src/server/routers/post.ts`](./src/server/routers/post.ts)\n\n## Setup\n\n```sh\ngit clone git@github.com:trpc/examples-next-sse-chat.git\npnpm i\ncp .env.example .env\npnpm dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc%2Fexamples-next-sse-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrpc%2Fexamples-next-sse-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc%2Fexamples-next-sse-chat/lists"}