Skip to main content

Overview

Server commands let you run your own Vestauth server with full control over your agent identity infrastructure.
Self-hosting is optional. You can use api.vestauth.com without running your own server.

Prerequisites

  • PostgreSQL database
  • Node.js 18+ or standalone binary

Quick Start


server init

Create or update the server .env configuration file.
Output:

Options

string
default:"3000"
Server port. Defaults to PORT environment variable, then 3000.
string
default:"http://localhost:3000"
Server hostname (including scheme). Defaults to HOSTNAME environment variable, then http://localhost:3000.In production, use your public domain (e.g., https://vestauth.yoursite.com).
string
default:"postgres://localhost/vestauth_production"
PostgreSQL connection string. Defaults to DATABASE_URL environment variable.Format: postgresql://USER:PASS@HOST:PORT/DATABASE

Examples

Generated Configuration

Creates a .env file:
Production note: Configure a wildcard DNS record for *.${HOSTNAME}.Example: if HOSTNAME=vestauth.yourapp.com, add *.vestauth.yourapp.com.Required for .well-known discovery per the web-bot-auth spec.

server start

Start the Vestauth server.
Output:

Options

string
Override server port. Defaults to PORT from .env.
string
Override server hostname. Defaults to HOSTNAME from .env.
string
default:"postgres://localhost/vestauth_production"
Override database connection string. Defaults to DATABASE_URL from .env.

Examples

Server Endpoints

The server provides these endpoints:

Production Deployment

For production:
  1. Use a managed PostgreSQL database
  2. Set HOSTNAME to your public domain
  3. Configure wildcard DNS (*.vestauth.yoursite.com)
  4. Use a process manager (PM2, systemd, etc.)
  5. Enable HTTPS via reverse proxy (nginx, Caddy)

server db:create

Create the vestauth_production PostgreSQL database.
Output:

Options

string
default:"postgres://localhost/vestauth_production"
PostgreSQL connection string. Defaults to DATABASE_URL from .env.

Examples

Requires PostgreSQL to be running and the user to have CREATEDB privileges.

server db:migrate

Run database migrations to create the required schema.
Output:

Options

string
default:"postgres://localhost/vestauth_production"
PostgreSQL connection string. Defaults to DATABASE_URL from .env.

Database Schema

Creates these tables: agents
  • uid - Unique agent identifier
  • created_at - Agent creation timestamp
  • updated_at - Last update timestamp
public_jwks
  • kid - Key ID
  • agent_uid - Associated agent UID
  • jwk - Public key (JSON Web Key)
  • created_at - Key creation timestamp
  • revoked_at - Key revocation timestamp (if revoked)

Running Migrations

Migrations are idempotent. Running them multiple times is safe.

server db:drop

Delete the vestauth_production database.
Output:

Options

string
default:"postgres://localhost/vestauth_production"
PostgreSQL connection string. Defaults to DATABASE_URL from .env.
This permanently deletes all agent data. Use with caution.In production, use database backups instead of dropping the database.

When to Use

  • Development: Reset local database
  • Testing: Clean slate between test runs
  • Migration testing: Verify migrations work on fresh database
Never use in production.

Environment Variables

Server commands read these from .env:

Complete Setup Example

Here’s a full self-hosting workflow:
Then create agents pointing to your server:

Troubleshooting

Database Connection Failed

Port Already in Use

Migrations Failed