{"id":20058840,"url":"https://github.com/ably-labs/nextjs-chat-app","last_synced_at":"2026-03-09T15:31:26.776Z","repository":{"id":37096037,"uuid":"327566386","full_name":"ably-labs/NextJS-chat-app","owner":"ably-labs","description":"A chat app built using Ably and Next JS and hosted with Vercel","archived":false,"fork":false,"pushed_at":"2025-05-20T08:56:32.000Z","size":240,"stargazers_count":100,"open_issues_count":3,"forks_count":58,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-20T09:51:32.629Z","etag":null,"topics":["ably-js","chat","demo","javascript","nextjs","react","react-hooks","reactjs","realtime","realtime-messaging","serverless","vercel","webhooks"],"latest_commit_sha":null,"homepage":"https://next-js-chat-app.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ably-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2021-01-07T09:39:52.000Z","updated_at":"2025-05-20T08:56:35.000Z","dependencies_parsed_at":"2023-02-13T23:16:32.417Z","dependency_job_id":"2a87ac3c-6670-4215-9c43-73a858684e03","html_url":"https://github.com/ably-labs/NextJS-chat-app","commit_stats":{"total_commits":28,"total_committers":6,"mean_commits":4.666666666666667,"dds":0.5357142857142857,"last_synced_commit":"7e17fa28d5837e2aff84a0a24db71cb1d32a7b0f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ably-labs/NextJS-chat-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2FNextJS-chat-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2FNextJS-chat-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2FNextJS-chat-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2FNextJS-chat-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ably-labs","download_url":"https://codeload.github.com/ably-labs/NextJS-chat-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2FNextJS-chat-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ably-js","chat","demo","javascript","nextjs","react","react-hooks","reactjs","realtime","realtime-messaging","serverless","vercel","webhooks"],"created_at":"2024-11-13T13:04:33.534Z","updated_at":"2026-03-09T15:31:26.767Z","avatar_url":"https://github.com/ably-labs.png","language":"JavaScript","readme":"\u003e [!IMPORTANT]\n\u003e This repository uses the Ably Pub/Sub approach for building chat apps. We now offer Ably Chat—a new family of SDKs and APIs that streamline development and manage realtime chat complexity for you. For a modern, easier way to create chat experiences, visit our [Ably Chat documentation](https://ably.com/docs/chat).\n\n# Building a Realtime Chat App with Next.js, Ably, and Vercel\n\nLive example at: \u003chttps://next-js-chat-app.vercel.app\u003e\n\nStep by step guide at: \u003chttps://ably.com/blog/realtime-chat-app-nextjs-vercel\u003e\n\nThis is a demo chat application with [Next.js](https://nextjs.org/) using [Ably](https://ably.com) as the messaging platform.\n\n## Description\n\nIt demonstrates the use of:\n\n- Pub/sub messaging\n- Ably's React Hooks\n- Token authentication with Ably\n\n## Tech stack\n\nThe project uses the following components:\n\n- [Next.js](https://nextjs.org/) is a React framework from [Vercel](https://vercel.com/). It is used to build static web applications with server side rendering, serverless functions and seamless hosting. It's a framework that takes the React knowledge you already have, and puts some structure and conventions in place.\n\n- [Ably](https://ably.com/) is realtime, pub/sub messaging platform with a suite of integrated services to deliver complete realtime functionality directly to end-users.\n\n- [Vercel](https://vercel.com/) is a hosting platform, built from the ground up to host Next.js apps, and Serverless Functions with them.\n\n- [React](https://reactjs.org/) is a JavaScript library for building user interfaces with encapsulated components that manage their own state.\n\n## What are we going to build?\n\n![The UI of the chat app we'll build. It is a window with speech bubbles for text.](https://cdn.glitch.com/0cb30add-c9ef-4c00-983c-e12deb0d4080%2Fchatapp.png?v=1612279601157)  \n*The UI of the app we'll build with this walkthrough*  \n\nWe'll build a realtime chat app that runs in the browser. It will be built upon the Next.js [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) template, it will contain a React component which will use Ably to send and receive messages. We'll also write a Next.js serverless function which will be used to connect to Ably.\n\n## Building \u0026 running locally\n\n### Prerequisites\n\nIn order to build and deploy this app, you will need:\n\n- **An Ably account** for sending messages: [Create an account with Ably for free](https://ably.com/signup).\n- **A Vercel Account** for hosting on production: [Create an account with Vercel for free](https://vercel.com/signup).\n- **Node 16** or greater: [Install Node](https://nodejs.org/en/).\n\nYou'll also need an API key from Ably to authenticate with the Ably Service. To get an API key, once you have [created an Ably account](https://ably.com/signup):\n\n1. Visit your [app dashboard](https://ably.com/accounts/any) and click on \"Create new app\".\n2. Give the new app a name.\n3. Copy the Private API key once the app has been created. Keep it safe, this is how you will authenticate with the Ably service.\n\n### Building the project\n\n1. To run this project locally, fork this repo and create a file called `.env` in the root of the project containing your Ably API key:\n\n```sh\nABLY_API_KEY=your-ably-api-key:goes-here\n```\n\n2. Run `npm install`.\n3. Run `npm run dev`.\n\nThe Next.js dev server will spin up and you'll see a demo chat application.\n\n## Hosting on Vercel\n\nWe're using `Vercel` as our development server and build pipeline.\n\n\u003e The easiest way to deploy Next.js to production is to use the Vercel platform from the creators of Next.js. Vercel is an all-in-one platform with Global CDN supporting static \u0026 Jamstack deployment and Serverless Functions.\n\u003ccite\u003e-- [The Next.js documentation](https://nextjs.org/docs/deployment)\u003c/cive\u003e\n\nIn order to deploy your new chat app to Vercel you'll need to:\n\n1. Create a [GitHub account](https://github.com/) (if you don't already have one)\n2. [Push your app to a GitHub repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository)\n3. [Create a Vercel account](https://vercel.com/signup)\n4. Create a new Vercel app and import your app from your GitHub repository. (This will require you to authorise Vercel to use your GitHub account)\n5. Add your `ABLY_API_KEY` as an environment variable\n6. Watch your app deploy\n7. Visit the newly created URL in your browser!\n\n## Make it your own\n\nThere are a few ways that this example could be extended:\n\n### Add message history\n\nThere is currently no chat history in this demo, you'll only see messages that come in after you join the chat. You could expand this demo by using [Ably's rewind feature](https://ably.com/docs/storage-history/history) for up to two minutes of history for free, or with a paid account, for up to ~48 hours.\n\n### Add user names\n\nThere aren't any usernames sent with the chat messages. This demo could be extended to introduce a username input box, and to add the current username to messages as they're sent.\n\nThe demo uses the randomly generated Ably client Id as a unique identifier - which is how it can detect if it is \"me\" or \"someone else\" who sent the message.\n\n## More info\n\n- [Join our Discord server](https://discord.gg/q89gDHZcBK)\n- [Follow us on Twitter](https://twitter.com/ablyrealtime)\n- [Use our SDKs](https://github.com/ably/)\n- [Visit our website](https://ably.com)\n\n---\n[![Ably logo](https://static.ably.dev/badge-black.svg?ably-next-vercel-news)](https://ably.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fnextjs-chat-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fably-labs%2Fnextjs-chat-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fnextjs-chat-app/lists"}