Build a backend in five minutes

Turn one Plexivo Postgres into your app’s backend: a table, sign-in for your users and live data, called from JavaScript or Flutter.

In five minutes you create a database, add a table where each user sees only their own rows, and read, write and watch it from your app. There is no backend server to write or run. For everything it can do, read Plexivo Postgres as a backend.

1. Create a database#

In the Plexivo console, choose Create, then Plexivo Postgres, as in Create your first database. Wait until it is running.

2. Turn on the Data API#

  1. Open the Connect tab and find From a browser or mobile app.
  2. Set the Allowed web origin to the address your web app runs on, for example https://app.example.com. Browsers on any other origin are refused. Mobile apps and servers send no origin and are not affected.
  3. Choose Turn on Data API. Copy the Project URL, the Publishable key and the secret key. The secret key is shown once: keep it in Plexivo Secrets or your password manager.
Developing on your laptopAdd http://localhost:5173 (or your development server’s address) to the allowed origins next to your live site. Plain http is accepted only for localhost and 127.0.0.1; every other origin is https. The list holds up to 20 origins.

3. Create a table with a policy#

Save this as setup.mjs on your computer and run it once with PLEXIVO_DATA_URL and PLEXIVO_SECRET_KEY set. It runs SQL with the secret key, which only a server or your own computer may hold.

js
import { createClient } from '@plexivo/client';

const admin = createClient(process.env.PLEXIVO_DATA_URL, process.env.PLEXIVO_SECRET_KEY);

await admin.sqlTransaction([
  `create table notes (
     id bigint generated always as identity primary key,
     owner uuid not null default auth.uid(),
     body text not null,
     created_at timestamptz not null default now()
   )`,
  'alter table notes enable row level security',
  `create policy notes_owner on notes for all to authenticated
     using (owner = auth.uid()) with check (owner = auth.uid())`
]);

The table reaches your app only because row-level security is on and it has a policy. The policy lets a signed-in user see and change only their own notes, and owner fills itself in with their id.

4. Call it from your app#

JavaScript and TypeScript, for the browser, React, Vue, React Native or Node 20 and later:

bash
npm install @plexivo/client
js
import { createClient } from '@plexivo/client';

const db = createClient(PLEXIVO_DATA_URL, PLEXIVO_PUBLISHABLE_KEY);

await db.auth.signUp({ email, password });

await db.from('notes').create({ body: 'My first note' });

const notes = await db.from('notes').order('created_at', 'desc').limit(20);
console.log(notes[0].body);

Flutter and Dart:

yaml
dependencies:
  plexivo_client: ^0.4.0
dart
import 'package:plexivo_client/plexivo_client.dart';

final db = PlexivoClient(dataUrl, publishableKey);

await db.signUp(email: email, password: password);

await db.from('notes').create({'body': 'My first note'});

final notes = await db.from('notes').order('created_at', 'desc').limit(20);
print(notes.first['body']);

PLEXIVO_DATA_URL (dataUrl) is the Project URL and PLEXIVO_PUBLISHABLE_KEY (publishableKey) the publishable key from step 2. Both are safe to ship in your app: the publishable key can do only what your policies allow.

5. Make it live#

On the Data API tab, choose notes and switch on Realtime. You can also do it in SQL, with the same script as step 3:

sql
create trigger plexivo_realtime
  after insert or update or delete on notes
  for each row execute function auth.realtime_notify('id');

Now each signed-in user sees their own changes as they happen, on every device:

js
const feed = db.channel('changes:notes')
  .onChange(({ type, record }) => console.log(type, record.body))
  .subscribe();

await feed.ready();
await db.from('notes').create({ body: 'Bought milk' });

Next steps#

Updated 28 October 2026