Understanding Oishia's Strict Multi-Tenant Architecture

Understanding Strict Multi Tenant

A look under the hood at how our Prisma ORM configuration guarantees 100% data isolation for all platform users.

The Hidden Risks of Cloud Software

When a business transitions from on-premise servers to a cloud-based Software as a Service (SaaS) platform, they gain immense benefits in terms of accessibility, automatic updates, and reduced IT overhead. However, this transition requires placing absolute trust in the software vendor. In a SaaS environment, your company's highly sensitive financial data, customer lists, and proprietary pricing strategies are stored on the same physical servers as thousands of other companies.

The nightmare scenario for any enterprise is data leakage—a bug in the code that accidentally exposes Company A's private sales data to a user logged into Company B's account. This type of catastrophic breach can result in severe legal liabilities and total loss of brand trust. Preventing this requires more than just standard password security; it requires a rigorous, foundational architectural design known as Strict Multi-Tenancy.

What is Strict Multi-Tenancy?

In a standard web application, a database query might look like this: `SELECT * FROM Users WHERE email = '[email protected]'`. If a developer makes a mistake and drops that `WHERE` clause, the system might return every user in the entire database.

Strict multi-tenancy is an architectural paradigm that makes it fundamentally impossible for a query to cross the boundaries between different companies (tenants). Every single piece of data—every product, every invoice, every customer profile—is stamped with a unique `tenantId`. The application framework is then configured so that it is incapable of executing a database read or write operation without explicitly forcing the `tenantId` into the query.

How Oishia Enforces Isolation with Prisma ORM

Security cannot be an afterthought; it must be baked into the lowest levels of the code. Oishia Commerce enforces strict data isolation at the Object-Relational Mapping (ORM) layer using Prisma, sitting directly above our PostgreSQL databases.

1. The Mandatory Tenant Column

Every core table in the Oishia database schema includes a mandatory, indexed `tenantId` column. A row cannot exist in the database without belonging to a specific tenant.

2. Middleware Enforcement

We do not rely on our developers to manually remember to add `WHERE tenantId = X` to every single database query. Humans make mistakes. Instead, we utilize Prisma Middleware. When an API request comes in, our authentication layer verifies the user's JWT token and extracts their assigned `tenantId`.

The Prisma middleware intercepts every single query before it hits the database. It automatically and invisibly injects the `tenantId` filter into the query payload. If a developer accidentally writes code that asks for "All Invoices," the middleware rewrites the request to "All Invoices WHERE tenantId = 'current_user_tenant_id'."

3. Zero-Trust Internal Architecture

This zero-trust approach guarantees that even if a critical bug is introduced into the application logic, the ORM layer acts as an unbreakable failsafe. It is structurally impossible for a user belonging to Tenant A to view, modify, or delete a record belonging to Tenant B, because the database query will simply return zero results.

Conclusion

When evaluating an enterprise ERP or Commerce platform, you must ask how they handle data isolation. A beautiful user interface means nothing if the underlying architecture is porous. Oishia Commerce’s strict, middleware-enforced multi-tenant architecture provides our merchants with the absolute certainty that their proprietary business data remains completely isolated, secure, and entirely under their control.

Ready to optimize your operations?

Join thousands of businesses scaling with Oishia.

Start your 14-day free trial