This sample app demostrates how to use Fuana stream to build a real-time chat app. It's built with Next.js and Fauna database.
- Basic knowledge of React and Next.js
- Fauna account
- Clone the repository
git clone https://github.com/fauna-labs/chat-app-streaming
- Install dependencies
cd chat-app-streaming
npm install
-
Configure Fauna database
- Login to your Fauna CLI using
fauna cloud-login
. If you don't have the CLI installed, you can install it usingnpm install -g fauna-shell
- Create a new database using
fauna create-database chat-app
- Migrate the schema using
fauna schema push
- Create a new key for your UnAuthenticatedRole by running the following FQL code in the Fauna shell
Key.create({ role: 'UnAuthenticatedRole' })
- Login to your Fauna CLI using
-
Save the key to a
.env
file in the root of the project.
# UnAuthenticatedRole
NEXT_PUBLIC_FAUNA_UNAUTHENTICATED_SECRET=<Unauth-user-key-for-your-database>
- Run the app
npm run dev
- Open the app in your browser at
https://localhost:3000