Quickstart (NodeJS)


Prerequisites

Before you begin, make sure you have the following:

  • Git
  • NodeJS
  • Availabale ports
    • 8080 (client)
    • 7777 (game server)
    • 6420 (Rivet)

Step 1: Install Rivet CLI

curl -L https://releases.rivet.gg/toolchain/v2.0.0-rc.5/windows_x86_64/rivet.exe.zip -o rivet.exe.zip
unzip rivet.exe.zip
Command Line

Add the directory containing rivet.exe to your PATH environment variable.


Step 2: Clone the example project

git clone https://github.com/rivet-gg/toolchain.git
cd toolchain/examples/html5-node
Command Line

Step 3: Install dependencies & run locally

  1. Install dependencies:

    npm install
    
    Command Line
  2. Start the development server:

    npm run dev
    
    Command Line
  3. Open http://127.0.0.1:8080 in your browser to view the running example. You should see the following:


Step 4: Deploy

To deploy the example to Rivet:

  1. Log in to Rivet:

    rivet login
    
    Command Line
  2. Deploy to production:

    rivet deploy prod
    
    Command Line

Step 5: Connect to deployed version

To connect to the deployed version:

  1. Get the backend endpoint:

    rivet backend get-endpoint prod
    
    Command Line

    Copy this value to the Endpoint field in the client.

  2. Get the current game version:

    rivet backend get-current-version prod
    
    Command Line

    Copy this value to the Game Version field in the client.

  3. Open the client served by npm run dev and use these values to connect to the deployed backend. You should be able to connect to your server like this:


Step 6: View deployed server

Open the Rivet Hub and open your game's environment. You'll see your server active under the Servers tab.