PotaLab

Examples

Learn by example

Each example pairs the React and Next.js code with a rendered sample of what it produces, plus the SQL and policies. They are illustrative snippets, not full repositories.

Todo app with RLS

A per-user todo list where Row Level Security keeps every user to their own rows.

Data APIAuthRLSNext.js

Magic-link sign-in

Passwordless sign-in: email a link, exchange the code for a session, share it with the server.

AuthNext.js

Multi-tenant SaaS starter

Tenants, membership and switching, with a restrictive RLS guard on every tenant table.

TenantsAuthRLSNext.js

File upload with Storage

Private per-user files: upload, list, sign a URL and delete, guarded by storage policies.

StorageRLSNext.js

Realtime chat

Room messages pushed over Postgres changes, with presence and a typing broadcast.

RealtimeData APIRLSNext.js

E-commerce: exact stock on purchase

Buy several products in one transaction: the order, its items and the stock decrement commit together or not at all.

TransactionsData APIRLSNext.js

Meeting room booking

No double booking, enforced by an EXCLUDE constraint; booking, moving and cancelling are one transaction each.

TransactionsData APIRLSNext.js

Timed ticket hold

Reserve limited tickets for a few minutes; pay by webhook; unpaid holds go back on sale by themselves.

TransactionsData APIWebhooksNext.js

Live cursors and presence

See who is online, who is typing and where everyone points, with no table at all.

RealtimeBroadcastPresenceNext.js