Skip to main content
Userverse uses SQLAlchemy to communicate with the database and Alembic to manage schema migrations. PostgreSQL is the recommended database for production deployments.

Configuration

Add a database block to your JSON config file. The TYPE, HOST, PORT, USERNAME, PASSWORD, and NAME fields are all required when using PostgreSQL.
config.json
{
    "database": {
        "HOST": "db.example.com",
        "PORT": 5432,
        "USERNAME": "userverse",
        "PASSWORD": "strongpassword",
        "NAME": "userverse",
        "TYPE": "postgresql"
    }
}
FieldTypeDescription
TYPEstringDatabase engine. Use postgresql for production.
HOSTstringHostname or IP address of the database server.
PORTnumberPort the database listens on. Default PostgreSQL port is 5432.
USERNAMEstringDatabase user with read/write access to the target database.
PASSWORDstringPassword for the database user.
NAMEstringName of the database to connect to.
If the database block is missing or incomplete, Userverse falls back to a local SQLite file. SQLite is only suitable for development and testing.

Initial setup

1

Create the database and user

Connect to your PostgreSQL instance and create a dedicated database and user for Userverse:
CREATE USER userverse WITH PASSWORD 'strongpassword';
CREATE DATABASE userverse OWNER userverse;
2

Update your config file

Add the database block shown above to your JSON config file with the credentials you just created. Set JSON_CONFIG_PATH to point to that file before starting the application:
export JSON_CONFIG_PATH=/path/to/config.json
3

Run migrations

From the repository root, apply all pending Alembic migrations to create the schema:
alembic upgrade head
Alembic reads the database URL from alembic.ini. Update the sqlalchemy.url line in that file to match your database before running migrations:
alembic.ini
sqlalchemy.url = postgresql://userverse:strongpassword@db.example.com:5432/userverse

Docker deployment

Build and run Userverse as a Docker container.

Observability

Prometheus metrics, tracing, and request logging.