Prem Ambre — Full-stack engineer
Building since 2022
I build the partsthat can’t quietlystress test ↗
Notebook · 04 published
What I’m thinking through.
- 01Server-enforced authorizationHiding a button is not authorization. Permissions belong where protected data leaves the system.authorizationpermissionsaccess control
- 02Designing maker–checker workflowsStopping people approving their own changes is the easy part. An approval must cover exactly what was read, and count exactly once.approvalsstate machinesconcurrency
- 03Audit trails as product infrastructureA log helps you debug. An audit trail has to answer, months later, who asked, who approved, and what went live.audit trailsevidencedata integrity
About
I like software that
01 / 04 · keep turning ↻
I’m a full-stack engineer. I started in the browser and kept following the work down: into the services that answer it, the data it depends on, and the delivery that puts both in front of people.
Most of what I build has consequences — money moves, a policy binds, someone approves a change on behalf of an organisation. That shapes how I work: make the rule findable, keep authority on the server, and leave enough evidence to explain any decision after the fact. The goal is the same every time: bring the idea to life, and keep the system behind it scalable, modular and secure.
Working with
- TypeScript
- React / Next.js
- Node.js
- Go
- Python
- PostgreSQL
- GCP
- Event-driven systems
- Applied AI
Case studies · 02 selected
Problems worth solving once.
Problems you may be holding right now, each with what usually goes wrong, the approach that worked, and what it costs. Written to be useful whether or not you care who built it.
Client and employer details are omitted; the reusable approach is not.
01Design systems · Multi-tenancyOne product, every tenant's brand, no forked stylesheetsHow to let each organisation bring its own colour without maintaining a stylesheet per tenant, and without the first awkward brand colour breaking contrast across the product.
The problem
You ship one product to many organisations and each wants it to look like theirs. Give each of them a stylesheet, and every new component becomes N pieces of work. Pass their brand colour straight into components instead, and the first tenant who picks near-white, near-black, or something highly saturated breaks legibility in places nobody thought to check.
Why the obvious fixes fail
- A stylesheet per tenant works at three and collapses at thirty. The cost lands on every future component, and a broken tenant usually surfaces as a complaint rather than a test failure.
- Letting tenants choose each colour individually makes a combination that fails contrast all but certain across enough tenants — and you will be the one fixing it. Choosing an identity and choosing interaction behaviour are different rights.
- Deriving shades by mixing in sRGB looks fine until you compare hues: a 20% lighter navy and a 20% lighter yellow are not equally lighter to the eye, so the same hover state reads as obvious on one brand and invisible on another.
The approach
- Take one seed colour per tenant and derive everything else. Tenants choose identity; the design system keeps ownership of what every interaction state means.
- Derive in a perceptual colour space rather than sRGB, so a lightness step looks like about the same change on any hue. That keeps interaction states about equally visible across brands nobody reviewed.
- Expose only semantic tokens to components — variables named for what a colour does, like the hover state of an action, rather than for the colour itself — never the raw tenant value. A component written once then behaves correctly for a tenant onboarded a year later.
- Measure every text colour against the surface it actually sits on, giving hover and active their own, so contrast is a property of the system rather than something each screen has to get right.
How you’d know it works
Test the seed colours designed to break things — white, black, a pale tint, a vivid red, a mid-grey — and check every interaction state without touching a line of component CSS. Then sweep the colour space, because a handful of hand-picked seeds is not proof.
What it costs
You give tenants less control than they will ask for. Expect requests for one specific button in one exact shade, and expect to say no — the moment you grant it, the generated palette stops being the source of truth and you are back to per-tenant styles with extra steps.
What it came down to
- Perceptual colour derivation
- Semantic tokens
- Contrast as a system property
Read it in depth
Where this ran
Built for a multi-tenant insurance platform. I designed the token model and carried it through the shared component library, the authenticated product, and the public-facing site.
02Regulated delivery · AuditabilityChanges one person should not be able to make aloneHow to build approval that survives contact with retries, edits, and concurrent reviewers — and still answers, months later, what was actually live on a given day.
The problem
Some changes should not be possible for one person acting alone — releasing terms, changing a payee, publishing a price. The hard part is not the two-step flow; it is keeping that guarantee intact across retries, edits after approval, concurrent reviewers, and every path that can reach the record. Months later someone will also ask what was actually live on a particular day.
Why the obvious fixes fail
- Hiding the Approve button from the author is a courtesy, not a control. The same request can still be made directly, and an old tab can hold permissions that no longer exist.
- An approved flag on the record says nothing about which version was approved. Edit after approval and the flag quietly carries over to content nobody reviewed.
- A log table written by the application is not evidence if the same code path can skip it. Evidence has to be produced by the transition itself, not alongside it.
The approach
- Model domain state transitions rather than screens. Every transition names its start state, destination, permitted actor, side effects and the evidence it leaves, and it writes only if the record is still the version it read, checked in the same statement that writes it, so two reviewers acting at once cannot both succeed and an edit in between is never approved by accident.
- Bind an approval to an immutable revision, not to the record. Editing after approval creates a new revision and returns the item for review, so nobody can approve one thing and publish another.
- Enforce every rule at the server boundary. The interface explains what you may do as a convenience; it is never the thing that stops you.
- Promote content as a named, immutable release rather than mutating live documents, which turns rollback into pointing at the previous release instead of reversing edits.
- Give each consequential action an idempotency key, created when the person first asks and reused on every retry, including a second click after a timeout, so an action that already succeeded answers with its original outcome instead of an error or a second effect.
How you’d know it works
Test the denials as carefully as the successes: self-approval, approving a stale revision, editing after approval, two reviewers acting at once, and the same request sent straight to the API. A denial you have never tested is a convention, not a control.
What it costs
Every change you put behind this gets slower and more ceremonious, and people route around processes that feel disproportionate. Scope it to what genuinely carries consequences — applying it to everything is how teams end up with a shadow process in a spreadsheet.
What it came down to
- Transitions over screens
- Immutable revisions
- Server-side enforcement
Read it in depth
- Server-enforced authorizationHiding a button is not authorization. Permissions belong where protected data leaves the system.Note · 9 min
- Designing maker–checker workflowsStopping people approving their own changes is the easy part. An approval must cover exactly what was read, and count exactly once.Note · 17 min
- Audit trails as product infrastructureA log helps you debug. An audit trail has to answer, months later, who asked, who approved, and what went live.Note · 13 min
Where this ran
Built for a regulated insurance publishing pipeline. I worked across the authoring studio, the content model, the approval workflow and the release path.