Skip to content

Configuration

pgvis reads configuration from environment variables (prefixed with PGVIS_) and optionally from a TOML config file.

VariablePurposeDefault
PGVIS_DSNDatabase connection stringrequired
PGVIS_BINDServer bind address0.0.0.0:3000
PGVIS_SCHEMASSchemas to expose (comma-separated)public
PGVIS_CONFIGPath to TOML config filenone
PGVIS_JWT_SECRETJWT verification secretnone
PGVIS_JWT_ALGOJWT algorithm (HS256, RS256, etc.)HS256
PGVIS_ANON_ROLEDatabase role for unauthenticated requestsnone
PGVIS_MAX_ROWSMaximum rows returned per requestunlimited
PGVIS_STATEMENT_TIMEOUTSQL statement timeoutnone
RUST_LOGLog level filterinfo
pgvis --dsn <DSN> [--config <FILE>] <COMMAND>
serve Start the HTTP server (REST + optional MCP)
--bind <ADDR> default 0.0.0.0:3000
--schema <NAME> repeatable / comma-separated
--mcp-http also serve MCP at /mcp
mcp Run an MCP server over stdio
openapi Print the OpenAPI 3.0 document and exit
inspect Dump the introspected schema cache as JSON
FieldPurposeDefault
routing.prefixURL prefix for all routes"api"
routing.schema_in_pathInclude schema in URL pathtrue

With schema_in_path = true (default):

/api/public/users
/api/analytics/events

With schema_in_path = false (PostgREST-compatible flat mode):

/users
/events
FieldPurpose
jwt_secretSymmetric or asymmetric key for JWT verification
jwt_algoAlgorithm (HS256, HS384, HS512, RS256, EdDSA)
anon_roleRole used when no valid JWT is present

When a valid JWT is provided, pgvis switches to the role specified in the token’s claims before executing queries. This integrates with Postgres Row-Level Security (RLS).