Published on ·2 min read·By Manassé N'Dri
KORVA OS: isolating each business's data and keeping an AI assistant in check
An organization context resolved on the server, isolation tests from the very first phase, an AI assistant held to the same permissions as a user: the architecture of the KORVA OS SaaS.
- KORVA OS
- NestJS
- Multi-tenant
- SaaS
- RBAC

Context
KORVA OS is management software and a website builder for 17 trades: salons, restaurants, shops, craftsmen, service businesses… It is live at app.korvasuite.com. Each business manages its customers, offers, bookings, orders and invoicing there, with an AI assistant.
Technically, it is a monorepo: a Next.js dashboard, a NestJS API, MongoDB and Redis. Two concerns shaped the architecture from day one: making sure no business can ever see another one's data, and controlling what the AI assistant is allowed to do.
1. A shared database, strict isolation
All businesses share the same database and collections; every record carries its organization's identifier. One database per customer would be easier to reason about, but too expensive to run at launch.
Security therefore relies on an organization context resolved on every request, before any controller runs:
JWT (user) → membership → organization + role + permissions
- the organization identifier is never accepted from the client's request (body, query parameters or headers): it is always derived on the server;
- data access layers inject that context automatically: no method accepts an arbitrary organization;
- a request whose context cannot be resolved is rejected, never silently accepted;
- files go through the same check before being served.
2. Testing isolation before anything else
A dedicated test suite checks that organization A can never read, modify or delete organization B's contacts, offers, bookings, orders, invoices or files, and that a request without a context is refused. These tests were a requirement to close the project's very first phase.
3. Roles that only exist within an organization
Roles (owner, admin, manager, sales, finance, staff, or custom roles) are always resolved within an organization. Being the owner of organization A grants nothing in organization B. A user can belong to several organizations: the active one is chosen explicitly, then validated by the server.
4. An AI assistant that goes through the same doors as a human
The assistant never touches the database directly. It acts only through tools ("search a customer", "create a booking", "get an invoice"…) that reuse the existing business services, with no duplicated logic.
Before every action, it is subject, in this order, to:
- organization isolation;
- the permissions of the user who asked;
- role, agent and tool permissions;
- the limits of the subscribed plan.
Every action is logged. Sensitive actions require explicit human confirmation: for example, a booking cancellation requested by the AI stays pending until a user approves it. Finally, the language model provider is abstracted away: business code does not depend on it.
5. A deliberate trade-off
Instead of loading the whole business context on every message, the assistant fetches exactly the data it needs, on demand, through its tools. Model calls stay lightweight, and the decision is documented in the project's architecture decision records.
Takeaways
- In a multi-tenant system, the organization identifier is derived on the server, never received from the client.
- Isolation is proven with dedicated tests, written before the features.
- An AI assistant should inherit the same checks as a user, and ask for confirmation on anything sensitive.