Loyalty software fails small businesses because it's built for one audience at a time — either a customer app with no merchant tooling, or a merchant dashboard the customer never sees. Bizzuri needed three surfaces: platform operator, participating business, and end customer, without triplicating the backend or the data model.
The commercial constraint made it harder. Businesses share infrastructure but must never see each other's data, while the platform operator needs a view across all of them.
What I built
One Express and PostgreSQL backend, one schema with tenancy as a first-class column, and three separately-built applications that share a component layer but never share a bundle. Each frontend ships only the code its role is allowed to run — an admin screen isn't merely hidden from customers, it's absent from the JavaScript they download.
The decision that mattered most
Tenant scope is injected at the query layer, not the route handler.
Route-level checks work until the forty-first endpoint, and then someone forgets one and a merchant sees another merchant's customers. Instead, tenant identity is extracted from the JWT once, attached to the request context, and applied automatically by the data-access layer. A query that forgets its scope fails loudly in development rather than quietly returning someone else's rows.
Isolation became a property of the architecture instead of a matter of discipline.
On the AI
Insights are computed over pre-aggregated data and cached, never on the request path. Two reasons: a dashboard that waits on a model call is a dashboard nobody opens twice, and aggregating first keeps raw customer records out of the prompt entirely.
Why this matters for your project
If you're building SaaS, multi-tenancy is the decision you can't cheaply reverse. Getting isolation wrong doesn't produce a bug — it produces a breach, and it's usually discovered by a customer. I've built it structurally, with role-separated bundles so authorisation holds at the delivery layer as well as the API.
The AI piece is worth noting too. Most "AI insights" features are a model call bolted onto a dashboard. This one is grounded in figures shown on the same screen, so the narrative can be checked against the numbers rather than trusted blindly.
A Telegram Mini App store with access-key login, Stars payments and a wallet, plus a React admin CRM for keys, products, users and orders. built the full stack
The access-key flow and Stars payments paired with the admin CRM make this feel like a complete product, not just a storefront. Nice work bringing the customer and operations sides together.