Skip to content

Commit

Permalink
chore(examples): add react/next.js example
Browse files Browse the repository at this point in the history
  • Loading branch information
jog1t committed Jan 7, 2025
1 parent 8ce1794 commit 7eb16d9
Show file tree
Hide file tree
Showing 19 changed files with 3,607 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Rivet Actors x React

This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app), showcasing the use of by [Rivet Actors](https://rivet.gg).

## Overview

### Simple Chat

It's a simple chat implementation using Rivet's `Actor` API. It demonstrates how to use the `Actor` API to create a chat application. The chat application is a simple chat room where users can send messages and see messages from other users in real-time. **Does not include any authentication or authorization.**

## Getting Started

1. Go through the [Initial Setup](https://rivet.gg/docs/setup) documentation to get a basic understanding of how it works.
2. Create `.env` file in the root of the project and add the following environment variables:
```bash
NEXT_PUBLIC_ACTOR_MANAGER_URL=YOUR ACTOR MANAGER URL FROM INITIAL SETUP
```
3. Follow instructions in the [Actors ReadMe](./actor/readme.md) to setup and deploy the actors.
4. Run the development server `npm run dev`
29 changes: 29 additions & 0 deletions examples/react/actor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Rivet Actors

Powered by [Rivet](https://rivet.gg).

## Overview

### Simple Chat

It's a simple chat implementation using Rivet's `Actor` API. It demonstrates how to use the `Actor` API to
create a chat application. The chat application is a simple chat room where users can send messages and see
messages from other users in real-time. **Does not include any authentication or authorization.**

## Prerequisites

- [Rivet CLI](https://rivet.gg/docs/setup)
- [Deno](https://deno.land/)

## File structure

- `rivet.json` Configuration file for deploying the actor
- `deno.json` Configuration file for dependencies for the actor
- `simple-chat.ts` Simple chat implementation

## Deploying

```sh
rivet login
rivet deploy
```
6 changes: 6 additions & 0 deletions examples/react/actor/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"@rivet-gg/actor": "jsr:@rivet-gg/actor",
"@rivet-gg/actor-client": "jsr:@rivet-gg/actor-client"
}
}
Loading

0 comments on commit 7eb16d9

Please sign in to comment.