Skip to content

Architecture

pgvis is a seven-crate Rust workspace. All dependencies point inward to the I/O-free core.

CrateRole
pgvis-coreI/O-free engine: query parser, plan layer, SQL builder, schema cache
pgvis-postgresPostgres backend: connection pool, introspection, execution
pgvis-sqliteSQLite backend: introspection and execution
pgvis-routeraxum REST router + OpenAPI generator
pgvis-mcpMCP tools & resources (stdio + Streamable HTTP)
pgvis-libBuilder facade — the one way to assemble the stack
pgvis-serverThe pgvis CLI binary
HTTP Request / MCP Tool Call
Parse into ApiRequest
plan_request (validate, resolve relationships)
render SQL (parameterized)
Backend::execute (Postgres/SQLite)
Format Response (JSON / OpenAPI / MCP result)
  1. I/O-free corepgvis-core does no I/O. Database drivers implement a Backend trait. This makes the engine embeddable and testable.

  2. One pipeline, three surfaces — REST, OpenAPI, and MCP all lower into ApiRequest → plan → SQL. Behavior never diverges.

  3. Backend-agnostic — A Dialect capability system drives feature gating. SQLite works with no core rewrite.

  4. PostgREST-compatible — Same query DSL, Prefer semantics, and error codes. Drop-in replacement for existing clients.

For the full architecture reference, see the arch/ directory in the repository.