Enclave: a client portal with database-level tenant isolation by Olu KareemEnclave: a client portal with database-level tenant isolation by Olu Kareem

Enclave: a client portal with database-level tenant isolation

Olu Kareem

Olu Kareem

Enclave, a multi-tenant client portal with isolation enforced in the database

A client portal where Postgres row-level security keeps every account separate at the database layer, so isolation holds even when the app code is wrong.
Walkthrough

Overview

Any product that gives every client a login shares one quiet risk: one wrong query and a client sees another client's data. Most apps guard against that in application code, which means one missed filter is a leak. Enclave takes a different position and enforces isolation in the database itself, so an account can never reach another account's data even when a query forgets its filter. I built it as a working starter that a legal, filing, or financial-intelligence product can grow on, with the isolation built to be seen and tested rather than taken on trust.

Role and approach

I was the sole developer. I designed the data model and the row-level security policies first, then built the authentication, the interface, and a live demo around them. The guiding idea was to make the security property structural: instead of asking reviewers to trust that every query is filtered, the database rejects anything that crosses an account by construction.

Key contributions

The portal. A full multi-tenant client portal with accounts, authentication, documents, and a per-account dashboard, built in Next.js and TypeScript with Tailwind and shadcn/ui.
Isolation in the database. Row-level security policies in Postgres that scope every row to its account. A query that forgets its filter comes back empty rather than leaking, so the wall holds at the layer that is hardest to bypass.
Proof you can see. A schema visualizer and a policy showcase, so the isolation is something a buyer or a teammate can inspect and test directly, alongside a live demo seeded with three accounts to click through.
Files locked the same way. Document access runs on signed, per-account blob URLs, so file storage carries the same guarantee as the data.
A base to build on. A second variant runs the same idea on Drizzle and better-auth, and migrations are included, so the pattern is ready to adapt to a specific client-portal product.

Outcome

A working multi-tenant portal with isolation proven in the database and a demo anyone can try. It is a foundation a client-facing product can adopt without having to solve tenant isolation from scratch, and without hoping the app code never slips.
Like this project

Posted Jul 17, 2026

Developed a secure, multi-tenant client portal with enforced database isolation using Postgres.