Backend

Database

Built-in PostgreSQL with REST API, SQL console, and row-level access control — zero configuration needed.

Built-in PostgreSQL

Every project gets a dedicated PostgreSQL database with its own schema. Access it from the DB button in the IDE footer. Your database credentials are stored securely as server-side secrets — they are never committed to your git repository.

  • Dedicated PostgreSQL schema per project (e.g. proj_abc123)
  • Connection URL and REST API URL available in the DB panel
  • The AI assistant can write SQL queries and schema changes via the <sql> tag

Tables & data

The DB panel has four tabs for managing your data:

  • Data — browse rows with pagination (50 per page), edit cells inline by clicking, insert new rows, delete rows
  • Schema — view column definitions (type, nullable, default, primary key), add or delete columns
  • SQL — run raw SQL queries; results shown in a table with row count
  • Access — configure row-level access policies per table

Supported column types: TEXT, INTEGER, BIGINT, SERIAL, BOOLEAN, FLOAT, NUMERIC, TIMESTAMPTZ, DATE, JSON, JSONB, UUID, VARCHAR(255).

SQL console

The SQL tab lets you run raw SQL queries against your project's database. Results are shown in a table with row count. Errors are displayed inline.

Note: All queries run within your project's schema — you never need to prefix table names. Cross-schema references are blocked for security.

REST API & Access Control

Every project database is accessible via a REST API at https://api.aicodesit.com/db/{id}/rest/{table}. Three auth levels control what each request can do:

  • ANON_KEY — public access, respects the table's Access policy
  • DB_API_KEY — admin access, bypasses all access policies
  • Session token — logged-in user, enables row-ownership policies

Configure each table's access rules from the Access tab in the DB panel:

  • Public read (anon_select) — anyone with your ANON_KEY can read rows
  • Public write (anon_insert) — anyone can insert rows without logging in
  • Logged-in Read Own — users only see rows they own, filtered by user_id_col
  • Logged-in Update Own / Delete Own — users can only edit or delete rows they created

Note: New tables are created with secure defaults: anonymous access is blocked, and logged-in users can only read, update, and delete their own rows. Users with role=admin bypass row-ownership filters.

Real-time row streaming is available at https://api.aicodesit.com/db/{id}/rest/{table}/stream?apikey=ANON_KEY using Server-Sent Events.