Docs/Data & jobs/Dokwe DB

Dokwe DB

4 min read
On this page

Dokwe DB gives you a Postgres database with a ready-made backend in front of it. Dokwe runs PostgREST to turn your tables into a REST API, and can add GoTrue for user sign-up and login, plus Realtime for live change events.

What you get#

Each Dokwe DB project bundles:

  • Postgres 16. Created as a normal managed service named <slug>-pg.
  • PostgREST. Serves a REST API for the public schema, with a connection pool you can resize.
  • API keys. An anon key and a service_role key, both JWTs signed with a secret for that project.
  • Realtime (supabase/realtime). Started when the project comes up. It streams row changes for the tables you subscribe.
  • Authentication (supabase/gotrue). Off by default. Turn it on from the Authentication tab.

In the dashboard, the project page has these tabs: Table Editor, SQL Editor, API, Authentication, Realtime, Storage, Policies, Performance, Types, and Settings.

Dokwe DB or a plain Postgres service#

Choose a managed Postgres service when your own backend talks to the database through a driver or ORM. You get a connection string and nothing else.

Choose Dokwe DB when you want to call the database over HTTP without writing a backend, from a frontend or mobile app for example, with row-level security and user auth.

Create a project#

  1. Open Dokwe DB#

    In the dashboard, open Dokwe DB and start a new database.

  2. Name it#

    Enter a name. The slug is filled in for you, and you can edit it. Optionally set the database name. If you leave it empty, Dokwe uses the slug with hyphens replaced by underscores.

  3. Choose a deploy target#

    Pick Dokwe Platform or one of your connected servers. See Bring your own server.

  4. Wait for provisioning#

    The project starts in provisioning. Dokwe creates Postgres and the anon, service_role, and authenticator roles, then starts PostgREST. When it's done, the status changes to running.

API keys and JWTs#

KeyPostgres roleWhere to use it
anon keyanonClient-side. Limited by row-level security.
service_role keyservice_roleServer-side only. Bypasses row-level security.
JWT secretnoneSigns both keys. Server-side only.

Find the keys on the API tab. Rotating the keys creates a new JWT secret and signs both keys again. The old keys stop working right away, so update your clients before you rotate.

New tables in public are readable by the anon role by default. Anyone with the anon key can read them until you turn on row-level security and add policies. Do this from the Policies tab or the table editor before you go live.

Quick start#

  1. Create a table#

    In the SQL Editor, run:

    sql
    create table todos (
      id bigint generated always as identity primary key,
      title text not null,
      done boolean not null default false
    );
  2. Copy the API URL and key#

    Open the API tab and copy the API URL and the anon key.

    Each project gets its own HTTPS addresses, on Dokwe's servers or yours:

    ServiceAddress
    REST APIhttps://<slug>-api.dokwe.com
    Sign-in (once turned on)https://<slug>-auth.dokwe.com
    Realtimewss://<slug>-rt.dokwe.com/socket
  3. Call the API#

    PostgREST serves each table at /<table>. Send the key as a bearer token:

    bash
    curl "$POSTGREST_URL/todos?select=*" \
      -H "Authorization: Bearer $ANON_KEY"

    To insert rows, use the service_role key from your server. Or turn on row-level security and add a policy that allows the anon role to insert.

Authentication#

Turn on auth from the Authentication tab. Dokwe starts a GoTrue container and runs its migrations in your database. From there you can set the site URL, configure email (SMTP), SMS (Twilio), and OAuth providers, adjust security settings, and manage users and sessions.

Turning auth off stops the container. Users in auth.users stay in the database. Your policies can call the helpers auth.uid(), auth.role(), and auth.email(), which read the request's JWT claims.

Realtime#

On the Realtime tab, choose which public tables send change events. Dokwe adds or removes each table from the supabase_realtime publication without restarting anything. Turning Realtime on sets Postgres to stream changes (wal_level=logical), which restarts the database once. Connect with @supabase/realtime-js to the Realtime address, passing the anon key as apikey. If a project has no running Realtime container, choose Provision Realtime (or Retry provision after an error) to start one.

Full API reference#

Every platform endpoint is listed in the Dokwe DB API reference. That includes tables, rows, CSV import and export, raw SQL, policies, auth, realtime, storage, and insights. For file storage, see Storage.