RLS Generator

A visual builder that turns a schema and a role-by-operation matrix into Supabase row-level security SQL, live.

Role
Sole designer and developer
Team
Solo project
Platform
Web app, fully client-side
Status
Concept · Live
Visit the live site ↗
RLS Generator interface
01 At a glance

The 30-second version.

Problem

Row Level Security is the right way to lock down a Supabase table, and the easiest to get subtly wrong by hand.

What I did

Designed and built a role-by-operation matrix that writes policy SQL live, with a preview of which rows each role can reach.

Outcome

A role-by-operation matrix that emits policy SQL live in the browser, on seven runtime dependencies and no backend.

Presets
5
Column types
10
Access toggles
12
Backend
0
02 The problem

Easy to want, easy to get wrong.

Developers usually know the access they want, not the exact policy syntax. A missing WITH CHECK or a forgotten ENABLE statement fails silently.

  • Who: developers who know the access they want, not the syntax.
  • Constraint: the tool must never touch anyone's data.
  • Risk: SQL that looks right but lets the wrong rows through.
03 My role

What I owned.

What I owned

  • Interaction design
  • SQL generator and preview logic
  • Frontend
04 Process

How it came together.

Insight → design

Access as a grid.

Roles down one axis, the four operations across the other: the whole policy surface in one glance. There's no Generate button; the SQL updates on every edit.

Insight → design

Show which rows each role reaches.

Sample rows carry per-role read and write badges and highlight the rows a simulated auth.uid() owns, before you run anything.

Insight → design

Detect the owner, or say why not.

The generator looks for user_id, owner_id or created_by and wires the auth.uid() checks; with none, it disables the owner row and explains instead of emitting something misleading.

05 Outcome

What shipped.

Runtime dependencies
7
Preset templates
5
Backend services
0
Visit the live site ↗
  1. InputSchema + matrixTyped columns, role × operation toggles
  2. TransformPure generatorsState → SQL, preview, highlight
  3. OutputSQL + row mapCopy or download, visual preview

Entirely client-side. There is no database, no API route, no Supabase client, and no auth anywhere; Supabase appears only in the SQL it writes. A single page holds the schema and access rules in React state, and pure functions turn that state into a policy SQL string, the sample rows, and the syntax-highlight tokens. The data model is in-app TypeScript types, not real tables; even the SQL highlighter is a small hand-rolled tokenizer, to keep the dependency list short. Staying fully client-side is what stops the tool ever touching your data, and it is equally why no policy survives a refresh and why the emitted SQL has never been run against a real Postgres to prove it correct.

  • Next.js
  • TypeScript
  • React
  • Tailwind
  • lucide-react
06 Reflection

What I'd change, and what I'd keep.

I'd do differently

Test the generated SQL against a real Postgres instance, make policies survive a refresh, and go beyond owner-or-everyone access.

I'd keep

Fully client-side, so it never touches your data.

Next case studyBackbarA spirits reference and pre-shift trainer for bar teams: scan a bottle, read its producer-sourced facts and the rules of its category, then drill on the back bar before service.

Open to full-time product design and full-stack development roles. Let's build something people rely on.

javiertpga@gmail.com