PostgreSQL Analytics with Bonnard

Connect Bonnard to PostgreSQL (including Supabase and Neon) and ship governed metrics to AI agents, embedded charts, and dashboards.

3 min read

Bonnard turns your PostgreSQL database into a governed PostgreSQL analytics backend. If your application data lives in Postgres, whether self-hosted, on RDS, Supabase, or Neon, Bonnard connects directly and exposes your metrics through MCP, React SDK, REST API, and markdown dashboards.

How does Bonnard connect to PostgreSQL?

Add PostgreSQL as a datasource in your Bonnard project. Define the connection in your datasources.yml:

# datasources.yml
datasources:
  - name: postgres_db
    type: postgres
    host: db.example.com
    port: 5432
    database: app_production
    username: bonnard_readonly
    password: ${POSTGRES_PASSWORD}
    schema: public
    ssl: true

Then run:

bon datasource add postgres_db
bon deploy

Bonnard connects over standard Postgres wire protocol, introspects your schema, and deploys your semantic layer. Works with any Postgres-compatible database: Amazon RDS, Aurora, Supabase, Neon, AlloyDB, CockroachDB, and TimescaleDB.

What do you get?

Once connected, your PostgreSQL data is available through four surfaces:

MCP server. Run bon mcp and your AI agents (Claude, ChatGPT, Cursor) query governed Postgres metrics with row-level security. Generate publishable keys per tenant for customer-facing agentic analytics.

React SDK. Drop BarChart, LineChart, and BigValue components into your product. Every chart queries your Postgres database through the semantic layer with multi-tenant access controls applied automatically.

REST API. Query metrics programmatically from any language or platform. Type-safe queries with the TypeScript SDK or raw HTTP from anywhere.

Markdown dashboards. Author dashboards in markdown, deploy with bon deploy, and share governed views with your team or customers.

How does Bonnard compare to querying Postgres directly?

Capability Postgres direct Bonnard + PostgreSQL
Metric definitions SQL views, application code YAML semantic layer (version-controlled)
AI agent access None MCP server with publishable keys
Embedded analytics Build from scratch React SDK with multi-tenant auth
Dashboards External tools (Metabase, Grafana) Markdown dashboards, deployed via CLI
Multi-tenancy Row-level security (manual) Publishable keys + automatic row filters
Pre-aggregation Materialized views (manual refresh) Automatic pre-aggregation cache
Access control Postgres roles YAML-defined RBAC + audit logging
Deployment Migration scripts bon deploy (no restart, no SSH)

Works with Supabase and Neon

If you're building on Supabase or Neon, Bonnard connects to your database the same way it connects to any Postgres instance. Use your connection string from the Supabase or Neon dashboard, set ssl: true, and deploy. Your application database becomes a governed analytics backend without changing your existing setup.

FAQ

Does Bonnard support PostgreSQL?

Yes. PostgreSQL is a first-class Bonnard datasource. Any Postgres-compatible database works: self-hosted, RDS, Aurora, Supabase, Neon, AlloyDB, CockroachDB, TimescaleDB.

Should I use a read replica for Bonnard?

Recommended for production workloads. Point Bonnard at a read replica to isolate analytics queries from your application traffic. Combined with pre-aggregation caching, this keeps your primary database load unchanged.

Can I use pre-aggregations with PostgreSQL?

Yes. The pre-aggregation cache handles this automatically. Define rollups in your cube YAML files and Bonnard builds and refreshes them on schedule. This offloads repeated analytical queries from your Postgres instance.

Does Bonnard work with Supabase and Neon?

Yes. Both Supabase and Neon expose standard Postgres connections. Copy your connection string, add it to datasources.yml, and run bon deploy. No additional configuration needed. Your Supabase or Neon database becomes queryable through the semantic layer and agentic analytics surfaces.

Connect PostgreSQL. Ship governed analytics.

Define your metrics in YAML, connect to PostgreSQL, and expose governed analytics through MCP, React SDK, and REST API.