Skip to content
MyAppBuilder
BetaGuide

External data sources

An external data source lets an entity read its records from a table that already exists elsewhere — a PostgreSQL database, a Supabase project or a REST endpoint that returns a list — instead of the built-in database. The pattern is connect, map, query : connect once, map an enti

Beta — ready to use, but some details may still change.

External data sources

An external data source lets an entity read its records from a table that already exists elsewhere — a PostgreSQL database, a Supabase project or a REST endpoint that returns a list — instead of the built-in database. The pattern is connect, map, query: connect once, map an entity's fields to the table's columns, then use the entity like any other.

MyAppBuilder never changes the external schema. It reads rows and, for PostgreSQL and Supabase mappings that are not read-only, inserts, updates and deletes rows in the mapped table.

When to use

  • Your products, customers or prices already live in a company database.
  • You want a read-only view of data managed by another system.

Not available yet: MySQL and Airtable appear as types but have no connector ("planned but not available yet").

Step 1 — connect a data source

  1. Open Data → Data sources and click Connect data source.
  2. Choose the type and fill in: - PostgreSQL: a name, Require SSL (recommended for hosted databases) and the Connection string secret — the secret's value is the full connection string, e.g. postgres://user:pass@host:5432/db. - Supabase: a name, the Project URL (https://abcd.supabase.co) and the API key secret (service-role or anon key). - REST API: a name, the List URL (a GET endpoint returning a JSON list), the optional Items path (data.items) and an optional Bearer token secret.
  3. The secret name must be in capitals; click Use suggested for a sensible one. Only the name is stored in the app.
  4. Click Add data source, then set the secret's value in Settings → Environment & secrets for Development (used by the builder and test runs) and Production (used by the live app).
  5. Click Test connection on the source card. On success it reports the number of tables found (REST: the number of items).

Step 2 — map an entity

  1. Open the entity in Data and go to its Source tab.
  2. Choose the Data source and click Load tables.
  3. Pick the Table (public.customers) and the Primary key column (id).
  4. In Field → column mapping, match each entity field to a column; empty entries default to the field key.
  5. Keep Read-only on unless the app must write to the table. REST sources are always read-only.
  6. Click Map. The entity now reads from the external table ("External · Company database" is shown on the Source tab).

To return to the built-in database, click Unmap; nothing is deleted externally.

Example
Entity Products  →  Company database (PostgreSQL)
  Table: public.products · Primary key: id · Read-only
  Name → product_name · Price → unit_price · SKU → sku

How querying works

  • Up to 1,000 rows are loaded per request; filters, search, sorting and pagination are applied by MyAppBuilder after loading. Suited to small and medium tables.
  • Permissions (entity, record scope, hidden and read-only fields) apply exactly as for built-in entities.
  • Writes to non-read-only PostgreSQL/Supabase mappings use the mapped columns and the primary key.
  • Unique checks, relation checks and the created_at / updated_at / created_by system fields apply only to the built-in database.

Common mistakes

  • Secret set for one environment only. The connector reports Add the connection string as secret NAME for production.
  • Database on a private network. Hosts must be reachable from the internet; private addresses are blocked on production servers.
  • Mapping a REST source and expecting to write. REST sources are read-only; use an API source with POST for writes.
  • Deleting a source still used by entities. Unmap the entities first; the list shows which ones use it.
  • Large tables. Only the first 1,000 rows are read; add a view or endpoint that returns the subset you need.

Advanced

Connectors live in src/server/connectors/index.ts (postgresConnector, supabaseConnector, restConnector) with list, insert, update, remove and test. SQL identifiers are validated and quoted, values parameterised, statements limited to 10 s; Supabase uses PostgREST (/rest/v1/<table>); REST reads GET listUrl with an optional Authorization: Bearer token. The entity stores source: { dataSourceId, table, primaryKey, fieldMap, readOnly } via map_entity_source.

Related

Was this helpful?