Replace scattered permission checks in a law-firm document platform with authorization as a designed, tested system: an OpenFGA model for firms, teams, matters, nested folders, guests, links, ethical walls and legal holds; one guard in a TypeScript API with OIDC tokens from Keycloak; PostgreSQL row-level security as a second barrier; a transactional outbox keeping the stores in step, with stated read-after-write and revocation bounds; access-aware listings; audit and explanations; and an independent oracle, drills and a load test, all locally.
Backend Engineer. Advanced.
For backend engineers who read TypeScript, know HTTP APIs and SQL and run containers, and want to build authorization as a designed, tested system: relationship-based access with OpenFGA, OIDC tokens from Keycloak, PostgreSQL row-level security, a transactional outbox with stated revocation bounds, access-aware listings and audit.
In this project you build the authorization system of a document platform for law firms. Firms are tenants; lawyers work in matters; folders and documents inherit access; guests and share links expire; ethical walls and legal holds beat every grant. An OpenFGA model decides each request, Keycloak issues identities, PostgreSQL row-level security isolates firms a second time, and a transactional outbox keeps the two stores in step. Everything runs on your own computer with Dock
Quillmark's document platform answers one question on every request: may this person do this to this object? This page explains how the system answers it: who proves the caller's identity, where the rules live, how the data of one law firm is kept from another, and how a change to who may see what reaches every part of the system in a bounded time.
At Quillmark, whether Ana may edit a document depends on who she is to it: a member of a team that edits the matter the document's folder belongs to. Ask the same question about her colleague Kai, in the same team, and the answer is no, because Kai has been walled off from that matter. This lesson explains the idea the whole project rests on: store the relationships, and derive the permissions from them with rules. By the end you can read a relationship tuple, follow a permis
The previous lesson followed one permission through a graph of tuples. This one is about writing the rules that define that graph: OpenFGA's modelling language, how each of Quillmark's requirements became a relation, and why two models that grant exactly the same permissions can differ enough in cost to decide whether OpenFGA keeps up with the load or falls over. By the end you can read every line of authz/model.fga, design relations for a new requirement, and spot a shape th
An authorization model is code with an unusual failure mode: a mistake doesn't crash anything. It quietly lets someone delete a document under legal hold, or quietly stops a whole team seeing its matter, and nobody notices until the wrong person does. This lesson covers how Quillmark's model is tested before it reaches OpenFGA, how a new version is rolled out while requests run, and how it's rolled back. By the end you can write a model test that would catch a broken rule, ex
Every decision OpenFGA makes starts with a subject: user:<id>. If the API can be fooled about who is calling, the best model in the world grants the wrong person's access. This lesson covers how Quillmark establishes identity: Keycloak issues signed access tokens, and the API accepts a token only after checking its signature with Keycloak's keys and every claim that matters. By the end you can read a token's parts, list what an API must check before trusting one and why, and
Quillmark's old API checked access in each handler, with role columns and if statements written a little differently every time; one list endpoint returned another firm's titles when a filter was mistyped. This lesson is about the opposite design: a single guard that every request passes through before any handler runs, that asks OpenFGA once, and that answers with a status code which never reveals what the caller isn't allowed to know. By the end you can explain what the gua
The guard and the model decide who may enter a firm. But all three firms' documents live in the same PostgreSQL tables, and every query the API runs is one WHERE tenant_id = ... away from leaking: Quillmark's security review found exactly that, a list endpoint that returned another firm's titles when a filter was mistyped. This lesson adds a barrier that doesn't depend on every query being right: PostgreSQL's row-level security, with a separate database role for each process.
Every relationship in Quillmark lives in two places. PostgreSQL holds it as a row, where the application lists, joins, audits and backs it up; OpenFGA holds it as a tuple, where it's evaluated. A share that reaches one store and not the other is a bug either way: a document shared in the database but not in OpenFGA can't be opened; a removal applied in the database but not in OpenFGA leaves access in place. This lesson is about keeping the two in step with a transactional out
A colleague shares a document with you and says "it's there now". You click, and get "not found". Or worse: a firm removes a guest whose engagement ended, and the guest keeps reading the matter for another ten minutes because some cache still says yes. Quillmark's review found both kinds of problem: permission changes "took minutes to apply in one place and were immediate in another". This lesson is about the two promises that replace that, and what it takes to keep them: a c
Checking one document is a question with a yes or no answer. A list is harder: "the first 25 documents Ana may see, in title order, out of 6,800 in her firm" can't be answered by checking all 6,800, and can't be answered by the database alone, because the database doesn't know what OpenFGA decides. This lesson covers the three ways Quillmark's API lists documents, why each exists, and how the pages and cursors avoid both slow requests and leaks. By the end you can choose betw
Roles and inheritance cover most of Quillmark's access. Four requirements don't fit them: a guest's access ends on a date; some firms allow sharing only from their own network; a link gives a person outside the system one document for a while; and two rules must beat every grant, the ethical wall and the legal hold. Quillmark's security review found guests with access months after their engagement ended, and held documents deleted by their owners. This lesson covers how each
Two questions come up after any access incident, and Quillmark couldn't answer either: "who could see this document?" needed someone to read code, and "who deleted it, and were they allowed to?" had no record at all. This lesson covers the two answers the system now gives: an append-only audit log of decisions on sensitive actions, and an explanation endpoint that lists everyone with access to a document and one reason each. By the end you can say what an audit record must co
An authorization bug rarely crashes anything. It returns 200 where it should return 404, or hides a document someone should see, and every other test stays green. So authorization needs tests aimed at it: tests that know, independently, what each person should be able to do, and check both directions. This lesson walks through the layers of tests in this project, what each one can and can't catch, and the techniques that make them trustworthy: an independent oracle, a sample
Every request in this system waits for an authorization decision, so the decision service's capacity is the whole API's capacity, and its outages are the API's outages. This lesson is about what happens as load rises and as parts fail: where the capacity limit is, how the API refuses quickly instead of collapsing, what each failure does to users and to data, and what to watch in operation. By the end you can read a capacity ramp, explain why the API sheds load instead of queu
Starting point: a computer with Docker. End point: you know it has the Compose plugin, the memory and the free port the lab needs.
Starting point: Docker works. End point: the toolbox image exists, the API's packages are installed, and the type check, unit tests, both model versions' tests and the scripts' syntax check pass.
Starting point: the toolbox works. End point: PostgreSQL holds three synthetic firms with 20,000 documents behind row-level security, and OpenFGA holds the model and the 63,205 tuples that describe them.
Starting point: the core lab is up. End point: you've asked OpenFGA the questions the API asks, matched its answers with the oracle, and seen an ethical wall override a team's access.
Starting point: the core lab. End point: Keycloak issues tokens, the API answers on 127.0.0.1:8088, and the outbox worker keeps OpenFGA in step.
Starting point: the full lab. End point: you've seen the API answer 200, 403 and 404 as the model decides, and asked it who may see a document and why.
Starting point: the full lab. End point: a share has taken effect on the recipient's next request, and a removal has waited in the outbox while the worker was stopped.
Starting point: the full lab. End point: every route has been called as every kind of user and compared with the oracle, and read-after-write and revocation have been measured.
Starting point: the full lab. End point: model version 2 has been tested, written, pinned and rolled back while requests ran, without a failed request.
Starting point: the full lab. End point: you've seen the API queue changes while the worker was stopped, refuse requests while OpenFGA was stopped, and end with both stores equal.
Starting point: the full lab. End point: you've deleted a tuple behind the API's back, found it with reconcile and repaired it.
Starting point: the full lab, ideally freshly started. End point: you have each kind of request's latency at about 63 requests a second.
Starting point: a running lab. End point: you can release a code change, roll it back, find the cause of a misbehaving lab, and resume after a break.
Starting point: a lab you've finished with. End point: no container, volume, network, built image or lab file remains.
Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.
Runs entirely on your machine with Docker Compose: about 1 GB of downloads and a synthetic dataset of 20,000 documents generated locally. No cloud account, payment method or hosted lab is used or included. The lessons' load numbers were measured on an 8-vCPU cloud virtual machine; reproducing them on similar hardware is optional and would be at your own cost.
Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Packages and container images downloaded when building or running, such as Fastify, the OpenFGA SDK, OpenFGA, Keycloak, PostgreSQL and k6, retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.
You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.
Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.
No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.
The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.
The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.
Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.
Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy