Database

Every zMesh project gets a dedicated PostgreSQL database with full SQL access, schema management, and a visual editor.

Overview

Each project database is isolated with its own schema. You can manage tables via the Dashboard SQL editor, CLI, or API.

  • Dedicated Database — Each project gets zbaas_<org_id>_<slug>
  • Full SQL — Run any SQL query via the editor or API
  • Schema Management — Create/alter/drop tables, add columns, indexes
  • Row-Level Access — Browse and edit rows from the Dashboard
  • Auto REST API — Every table is instantly queryable via PostgREST-style API

API Endpoints

List Tables

GET /projects/{project_id}/db/tables

Authorization: Bearer <token>

// Response
[
  { "name": "posts", "columns": 4, "rows": 128 },
  { "name": "users", "columns": 6, "rows": 45 }
]

Execute SQL

POST /projects/{project_id}/db/query

{
  "sql": "SELECT * FROM posts WHERE id = $1",
  "params": [1]
}

// Response
{
  "rows": [{ "id": 1, "title": "Hello", "body": "World" }],
  "row_count": 1
}

Create Table

POST /projects/{project_id}/db/tables

{
  "name": "comments",
  "columns": [
    { "name": "id", "type": "SERIAL", "primary_key": true },
    { "name": "post_id", "type": "INTEGER", "nullable": false },
    { "name": "body", "type": "TEXT" },
    { "name": "created_at", "type": "TIMESTAMPTZ", "default": "NOW()" }
  ]
}

Get Table Rows

GET /projects/{project_id}/db/{table}/rows?limit=50&offset=0

Authorization: Bearer <token>

Get Table Schema

GET /projects/{project_id}/db/tables/{table}/schema

// Response
{
  "columns": [
    { "name": "id", "type": "integer", "nullable": false, "primary_key": true },
    { "name": "title", "type": "text", "nullable": false }
  ]
}

CLI

# Pull remote schema to local file
zmesh db pull

# Push local schema changes to remote
zmesh db push

# Seed data from a SQL file
zmesh db seed --file seed.sql

Plan Limits

PlanMax TablesMax Rows/TableDB Size
Free1010,000500 MB
Pro1001,000,00010 GB
EnterpriseUnlimitedUnlimited100 GB

Every table you create is also available via the Auto REST API and GraphQL — no extra configuration needed.