Skip to content

ably-labs/ably-nextjs-fundamentals-kit

Repository files navigation

Ably serverless WebSockets and Next.js fundamentals starter kit

Ably serverless WebSockets and Next.js fundamentals starter kit demo

Description

This Ably and Next.js fundamentals starter kit demonstrates using some of the Ably's core functionality with Next.js. You can build features and use cases upon these fundamentals such as notifications, activity streams, chat, realtime visualisations and dashboards, and collaborative multiplayer experiences.

The Ably fundamentals demonstrated within this repo are:

  • Token Authentication - authenticate and establish a persistent bi-direction connection to the Ably platform.
  • Pub/Sub (Publish/Subscribe) - publish messages on channels and subscribe to channels to receive messages.
  • Presence - keep track of devices that are present on a channel. This is great for tracking if a device is online or offline or indicating if a user is in a chat room when using Ably for Chat.
  • History - Retrieve a history of messages that have been published to a channel.

The project uses the following components:

  • Next.js, a flexible React framework that gives you building blocks to create fast web applications.
  • Ably, for realtime messaging at scale.

Building & running locally

Prerequisites

  1. Sign up or log in to ably.com, and create a new app and copy the API key.
  2. To deploy to Vercel, create a Vercel account.

Configure the app

Create a .env.local file with your Ably API key:

echo "ABLY_API_KEY={YOUR_ABLY_API_KEY_HERE}">.env

Run the Next.js app

npm run dev
# or
yarn dev

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Deploy with Vercel

Contributing

Want to help contributing to this project? Have a look at our contributing guide!

More info


Ably logo