Skip to main content

Environment Variables

Vestauth server configuration is managed through environment variables stored in a .env file. Run vestauth server init to create this file automatically.

PORT

The port the server listens on.
  • Default: 3000
  • Type: String or Number
  • Example: "3000" or "8080"
.env
You can override this when starting the server:

HOSTNAME

The full URL where your Vestauth server is accessible. This is critical for agent registration and discovery.
  • Default: http://localhost:3000
  • Type: String (URL)
  • Local development: http://localhost:3000
  • Production: https://vestauth.yoursite.com
.env (Development)
.env (Production)
Critical for production: The HOSTNAME must match your actual server URL. Agents use this to construct their discovery endpoints.For example, if HOSTNAME=https://vestauth.yoursite.com, agents will be discoverable at:
You can override this when starting the server:

DATABASE_URL

PostgreSQL connection string.
  • Default: postgres://localhost/vestauth_production
  • Type: String (PostgreSQL connection URL)
  • Format: postgresql://[user[:password]@][host][:port][/dbname][?param1=value1&...]
.env (Local PostgreSQL)
.env (Managed PostgreSQL)
The database URL is used by:
  • vestauth server db:create - Creates the database
  • vestauth server db:migrate - Runs migrations
  • vestauth server start - Connects to the database
You can override this when starting the server:

Configuration File

The .env file is created in your current directory when you run vestauth server init. Here’s a complete example:
.env

Wildcard DNS Requirements

Production deployment requirement: Configure a wildcard DNS record for *.${HOSTNAME}.This is required for the web-bot-auth .well-known discovery specification.
Vestauth uses subdomain-based routing to serve agent public keys. Each agent gets a unique subdomain:
For this to work, you must configure DNS to route all subdomains to your server.

Example DNS Configuration

If your HOSTNAME=https://vestauth.yourapp.com, configure:
Or using CNAME:

Local Development

For local development with localhost, wildcard DNS works automatically:

Testing Wildcard DNS

Verify your wildcard DNS is working:

Production Configuration Checklist

1

Update HOSTNAME

Change from http://localhost:3000 to your production domain:
2

Configure Wildcard DNS

Add DNS record for *.vestauth.yoursite.com pointing to your server.
3

Use Managed PostgreSQL

Update DATABASE_URL to a production database:
4

Set Up HTTPS

Configure SSL/TLS using:
  • Let’s Encrypt with Caddy (automatic HTTPS)
  • Nginx with certbot
  • Cloudflare proxy
  • Load balancer SSL termination
5

Configure Reverse Proxy

Set up nginx or Caddy to forward requests to your server port:
nginx.conf

Environment Variable Precedence

Vestauth resolves configuration in this order:
  1. Command-line flags (highest priority)
  2. .env file
  3. Default values (lowest priority)
    • PORT: 3000
    • HOSTNAME: http://localhost:3000
    • DATABASE_URL: postgres://localhost/vestauth_production

Security Considerations

Protect your .env file: Never commit .env to version control. It contains database credentials and server configuration.Add to .gitignore:

Database Security

  • Use strong passwords for PostgreSQL
  • Enable SSL for database connections in production
  • Restrict database access to your server’s IP
  • Use read-only credentials where possible

Network Security

  • Always use HTTPS in production (not HTTP)
  • Configure firewall rules to restrict access
  • Use a reverse proxy (nginx, Caddy) for SSL termination
  • Enable rate limiting to prevent abuse

Advanced Configuration

For advanced configuration options, you can modify the server code directly:
  • Server implementation: src/server/index.js
  • Database models: src/server/models/
  • Express middleware: src/server/index.js (lines 23-61)