Overview


What are modules?

Modules are pieces of backend functionality that can be combined together to build & customize your game's backend.

Modules include:

  • Scripts that implement the logic.
  • Database schemas to store persistent data.
  • User configuration to let you configure settings on the module.
  • Explicit errors to make it easy to understand & recover from errors returned from the module.

You can think of modules like an NPM package/Unity package/Unreal plugin/Maven artifact/Rust crate but with a persistence layer and a standard + well-documented way of using it.


How do I install modules?

To install a module from the default registry, you have two options.

CLI

You can install the module from the CLI by running the following command:

rivet module add my_module
Command Line

This will update your rivet.json file accordingly.

rivet.json

You can also manually add the module to your rivet.json file manually, like this:

{
	"modules": {
		"my_module": {
			"config": {
				// Your config here
			}
		}
	}
}
JSON

Registries

Modules come from registries. Rivet provides a default registry with all of the modules available on this website. You can specify or host your own registries easily. Read more here.

Quickstart

Install Rivet CLI

Install latest version

curl -fsSL https://raw.githubusercontent.com/rivet-gg/cli/main/install/unix.sh | sh
Command Line

Install specific version

We recommend specifying the CLI version in CI environments. This also allows you to install prerelease versions of the CLI.

export RIVET_CLI_VERSION="v1.0.0"
curl -fsSL https://raw.githubusercontent.com/rivet-gg/cli/${RIVET_CLI_VERSION}/install/unix.sh | sh
Command Line

The export keyword is important. The variable RIVET_CLI_VERSION needs to be accessible inside the install script.

Create project

Create a new project by running the following command:

rivet init
Command Line

This creates a rivet.json config file. See the project configuration here.

Add modules

The default project comes with a set of modules preinstalled. For example, install the friends module by running the following command:

rivet module add friends
Command Line

This adds the friends module to the rivet.json file. You can also install modules manually by adding them to this config.

See a list of available modules here.

Run development server

The development server is great for testing your scripts locally. This will build & run your backend locally & hot reload when you make changes to the configuration.

rivet dev
Command Line

Deploy server (optional)

Install the Rivet CLI, then run the following:

rivet deploy prod
Command Line

Next steps