Skip to content

Getting started with River Pro

River Pro requires a few additional steps to get started beyond those of the main River package. This page covers installing Pro for Go, Ruby, and Rust, running its migrations, initializing a client, and preparing a deployment.


Versions and requirements

Use Postgres or a local SQLite database. The examples below use Postgres; see SQLite setup for the differences. Clients in every River language share the schema and migration history, so apply migrations once per database before starting the new application version.

Pro and core River have independent version numbers, as do the packages for each language. Use compatible core and Pro releases, and keep separately installed migration CLIs at the same Pro version as the application.

Use the Go toolchain required by the selected modules’ go.mod files. The current releases require Go 1.26 or newer. River Pro declares its compatible core River dependency; keep the Pro client and driver modules at the same version. Commit go.mod and go.sum after installing or updating them.

Quick start

With a River Pro secret obtained during the subscription process, add River Pro to an existing Go module:

Terminal window
export RIVER_PRO_SECRET=river_secret_...
export GOPROXY=https://proxy.golang.org,https://river:$RIVER_PRO_SECRET@riverqueue.com/goproxy,direct
export GONOSUMDB=riverqueue.com/riverpro,$GONOSUMDB
# install riverpro modules:
go get riverqueue.com/riverpro
go get riverqueue.com/riverpro/driver/riverpropgxv5
# the main River package is also required:
go get github.com/riverqueue/river

Assuming everything worked, Go will have updated the project’s go.mod and go.sum files with new entries for River Pro. For more information on sustainably managing GOPROXY/GONOSUMDB environment variables in a Go project, or to use the riverpro modules in a CI environment, see Installing private packages.

Install the CLI

Install the migration command before applying the database schema:

River Pro supplies a separate riverpro executable containing the core migration commands and Pro migration lines. With the private package environment configured above, install the version used by your application:

Terminal window
RIVER_PRO_VERSION=$(go list -m -f '{{.Version}}' riverqueue.com/riverpro)
go install riverqueue.com/riverpro/cmd/riverpro@"$RIVER_PRO_VERSION"
riverpro version

The executable is installed in GOBIN, or $(go env GOPATH)/bin by default; include that directory in your PATH. Use riverpro for both migration lines. The core river executable does not include Pro migrations.

Running Pro migrations

Most Pro features require additional migrations. Create the application database, then run the standard River migrations before the pro migration line. New installations only need main and pro; the consolidated Pro line includes sequences and workflows.

Set DATABASE_URL to your database connection string (for example, postgres://app_user@localhost/my_app). Run one migration process at a time across all languages. Already-applied versions are skipped, including versions applied by another River language.

Apply and validate both lines with riverpro:

Terminal window
# first, install the standard River migrations:
riverpro migrate-up --database-url "$DATABASE_URL"
# then add the pro migration line:
riverpro migrate-up --database-url "$DATABASE_URL" --line pro
riverpro validate --database-url "$DATABASE_URL"
riverpro validate --database-url "$DATABASE_URL" --line pro

Successful validation exits with status 0; pending migrations or errors return a nonzero status. Validation checks migration history, not whether every database object is unchanged. Use the CLI version matched to the application even when validation succeeds.

For an alternate Postgres schema, create it first and pass the same --schema jobs to both migration lines and their validation commands. Configure the client to use that schema too. See Pro migrations for previews, rollbacks, SQL exports, and programmatic migration APIs.

Initializing a client

Define job arguments and workers and register workers as for core River. Initialize a Pro client with that worker registry, your database connection, and the queues to work:

A River Pro client is initialized similar to a normal River Client, except with the use of the riverpro.NewClient constructor and the riverpropgxv5 driver instead of riverpgxv5:

import (
...
"github.com/riverqueue/river"
"riverqueue.com/riverpro"
"riverqueue.com/riverpro/driver/riverpropgxv5"
)
riverClient, err := riverpro.NewClient(riverpropgxv5.New(dbPool), &riverpro.Config{
Config: river.Config{
Queues: map[string]river.QueueConfig{
river.QueueDefault: {MaxWorkers: 100},
},
Workers: workers,
},
})
if err != nil {
// handle error
}
if err := riverClient.Start(ctx); err != nil {
// handle error
}
// During application shutdown, with a context that allows time to drain:
if err := riverClient.Stop(shutdownCtx); err != nil {
// handle error
}

The examples use a pgxpool.Pool named dbPool and registered workers. Core APIs remain available on the Pro client through its embedded river.Client. In workers, use riverpro.ClientFromContext[pgx.Tx](ctx) to retrieve the Pro client.

SQLite

Pro supports the same features on Postgres and SQLite. Use a local database file and create its parent directory before migrating. Follow the SQLite guide for connection and concurrency settings.

Install riverqueue.com/riverpro/driver/riverprosqlite at the same version as the Pro client. Pass riverprosqlite.New(dbPool) to riverpro.NewClient, using a database/sql pool as in the core SQLite setup. Migrate with a SQLite connection string:

Terminal window
export DATABASE_URL='sqlite://./river.db'
riverpro migrate-up --database-url "$DATABASE_URL"
riverpro migrate-up --database-url "$DATABASE_URL" --line pro
riverpro validate --database-url "$DATABASE_URL"
riverpro validate --database-url "$DATABASE_URL" --line pro

Pro feature guides

Use the language selector in each guide for its APIs and examples:

Pro APIs are available through the riverpro package. Features are configured on the client, queues, or individual jobs as shown in each guide. Time intervals use time.Duration; absolute timestamps use time.Time.

Deployment

Build the application and prepare its migration command in CI or a container build stage. Keep private package credentials in the build environment using your secret store; see CI and Docker examples.

Build the application and install the matching CLI in the build stage:

Terminal window
go build -o ./bin/app ./cmd/app
RIVER_PRO_VERSION=$(go list -m -f '{{.Version}}' riverqueue.com/riverpro)
GOBIN="$PWD/river-cli/bin" go install riverqueue.com/riverpro/cmd/riverpro@"$RIVER_PRO_VERSION"

Replace ./cmd/app with your application’s main package. Copy bin/app and river-cli/bin/riverpro into the runtime image. Build for the deployment’s operating system and architecture, including any system libraries and CA certificates the binaries need. The migration executable embeds its SQL and runs without Go or private module credentials.

Run the migration and validation commands as a deployment job with the database connection configuration. Make the job stop on the first failed command (for example, with set -eu in a shell script), and start the new workers only after it succeeds.

Upgrading

Update compatible core and Pro dependencies together, commit the dependency files, and prepare the matching migration command before deploying:

Update the client and driver together, then tidy the module:

Terminal window
go get riverqueue.com/riverpro@latest riverqueue.com/riverpro/driver/riverpropgxv5@latest
go mod tidy

Substitute the SQLite driver if applicable. Commit go.mod and go.sum, and reinstall the CLI using the version from the application module. A previously installed CLI does not update when go.mod changes.

Apply main, then Pro, validate both lines, then deploy the new clients. Preserve this order even when one line has no pending migrations. Review the update guide and release notes for compatibility changes. Rolling back application code does not by itself require rolling back the schema; see migration rollbacks before reverting database changes.

Managing River Pro license keys

River Pro license keys authenticate with the private package sources and Docker registry. An initial license key is provided via email during the subscription process. You can retrieve your key and manage up to 5 keys for your team in the customer dashboard (dash.riverqueue.com).

For guidance on managing these license keys in your team and environments, see:

API documentation

River Pro’s riverpro Go package has generated documentation hosted on this website. Docs are available for each released, along with the latest version always available at a fixed URL.

River Pro Go package docs