The problem
Access control is most of what a backend does and the hardest part to show: when it works, nothing happens. Redacted exists to show it. It was built to exercise role-based access control, tenant isolation, sign-in and sessions, a REST API, an audit log and real-time editing, and the fictional agency on top is how a visitor gets to watch them work.
So it sets itself the hard version of the problem. Most document editors send the whole document to your browser and cover up what you shouldn't see, and check permissions when you open it and rarely again. Here, in a multi-tenant system where people with different clearance share a document, the text you aren't cleared for must never reach your browser at all, even while several people edit at once. And when someone loses access, that takes effect before their next keystroke, not when they next reload the page.
How it works
Redacted is the live demo of RBAC-API, a multi-tenant access-control service. A NestJS API and a Hocuspocus collaboration server share one PostgreSQL database. Every tenant table has forced row-level security, and the API connects as a role that owns nothing, so a query that forgets its tenant filter still can't see another organization's rows.
Hiding is part of the document's structure. Each section of a briefing is its own collaborative document on the server; a member who isn't cleared for a section is never connected to it, and the API sends a redaction bar in its place. Words inside a sentence are classified with a formatting mark, and readers below that mark get a copy the server writes for their level.
Permission changes reach connections that are already open. Every change announces itself with a PostgreSQL notification inside its own transaction, and every server re-checks its live connections when it arrives.
“The black bars aren't a disguise laid over the text. The text itself never reaches your browser, and a test reads every network frame to prove it.”