Turnkey Multi-Tenancy
With SmartClient 14.x, we’ve made it dramatically easier to adopt multi-tenancy, without rewriting your application logic.
SmartClient now offers transparent multi-tenancy, a turnkey solution that lets developers scope data access by tenant using just configuration changes, without redesigning an application for multi-tenancy.
Whether you’re building a new SaaS product or retrofitting an existing system, SmartClient 14.0 ensures your application is multi-tenant ready with minimal effort.
This article will walk through how SmartClient’s transparent multi-tenancy works and what it means for your architecture.
What Is Transparent Multi-Tenancy?
Transparent multi-tenancy means your application continues to work exactly as written, but now supports multiple customers with securely segregated data. Grids, editors, validations, RPCs, and business logic all work as before, while SmartClient handles all the tenant-scoping behind the scenes.
Client and server logic don’t need to change. Once the authenticated tenant ID is provided, all operations, including data loads, saves, validation, and business rules, are automatically scoped.
Tenant‑Specific DataSources
As with all things in SmartClient, transparent multi‑tenancy is based on DataSources.
Everything in your existing application that references DataSources – grids, forms, data binding, validation – continues to function seamlessly in a multi-tenant environment. The framework handles tenant scoping automatically under the hood, so there’s no need to refactor your user interface or server-side code.
Whether you are fetching, adding, updating, or deleting records, SmartClient ensures that all data operations are transparently scoped to the correct tenant’s context. Developers don’t need to manually inject tenant filters or adjust their CRUD logic; SmartClient handles this natively and automagically.
How It Works
Tenant-specific, but same ID in the browser
Server-side, when you call DataSource.get("orders")
SmartClient automatically generates a tenant-specific version based on a naming convention like mt_biginc_orders
, where the DataSource’s database configuration is dynamically determined based on server-side configuration (server.properties
). However, on the client, even if the real ID might be mt_biginc_orders
, it’s aliased back to just “orders
“, meaning your UI code remains identical – zero changes required.
Server-side automatic scoping
You don’t even need to change server-side business logic! Once the tenant ID is set via RPCManager.setTenantId(...)
or isc_tenantId
on the servlet request, any server-side data requests, whether via RPCManager.getDataSource()
, new DSRequest()
, etc., automatically use the tenant-scoped DataSource definition.
Global (non-tenant-specific) data: just configure
Sometimes you need global DataSources that aren’t tenant-specific. Examples would be geographical information or shared catalogs.
It’s easy to exclude such DataSources from the multi-tenancy system – just place them in a separate directory, and SmartClient’s multi-tenancy system treats them uniformly across tenants. The whole system remains transparent even when you need to do a ‘join’ (like a SQL JOIN
– whether actually SQL or not) between general and tenant-specific DataSources.
Flexible Database Partitioning
It’s ridiculously easy – a matter of just a couple of declarations in a .properties file – to set up either a separate ‘schema’ per-tenant within the same database server, or, if you prefer, an entirely separate database server per-tenant, with a naming convention so SmartClient can find the database server.
This uses the same database configuration approach you are already using (server.properties
), but now, you have a $tenantId
variable.
For example, your configuration can specify unique connection settings, such as database name, JDBC URL, or even database host, based on the tenant ID.
This approach enables clean separation of tenant data at the schema level, or even across entirely different databases or database servers. It provides maximum flexibility for scaling, performance tuning, and security.
Best of all, switching between partitioning strategies, whether schema-based, database-based, or host-based, can be accomplished entirely through configuration changes.
Simple App Changes Required
For many apps, it’s amazing how easily transparent multi-tenancy can be enabled. An existing app requires a very short list of configuration tweaks.
When loading DataSources (via a script tag calling the DataSourceLoader
servlet, or DataSource.load()
call), just pass the authenticated tenant ID, and the framework loads a tenant-specific DataSource.
On the server side, provide the tenant ID programmatically with RPCManager.setTenantId()
or via a servlet request attribute. With that in place, all data operations are automatically scoped per tenant.
You can also provide tenant-specific variations on your DataSources. Does one tenant want to store a particular additional field? Place a custom DataSource under the tenants/
directory, and you’re all set.
Multi- Multi-Tenancy Models
SmartClient 14.0 supports all common models of multi-tenancy:
- Silo Model: Each tenant has its own isolated DB instance or schema.
- Bridge Model: Tenants share a DB process, but have isolated datasets.
server.properties
determines the layout of your tenant-specific data: schema, database, or hostname, it’s all based on the tenant ID. These small changes are all it takes to make your app fully multi-tenant, secure, and SaaS-ready.
Built-in Demo App
SmartClient 14.0 includes a ready-to-run multi-tenant Order Management demo in the SDK. Flip between tenants using a simple URL parameter (for demo purposes). This lets you test multi-tenant behavior instantly and observe how transparent scoping works.
Ready to Make Your App SaaS-Ready?
With SmartClient 14.0, adopting multi-tenancy is easier than ever: no rewrites, no complex logic changes, just simple configuration updates. Whether you’re building a new SaaS application or modernizing an existing system, SmartClient’s transparent multi-tenancy gives you a powerful, scalable foundation with minimal effort.
You can see it in action right away with the built-in multi-tenant Order Management demo included in the SDK. To get started, download the latest SmartClient SDK, explore the documentation, or contact us for a personalized walkthrough. It’s the fastest path to delivering secure, tenant-aware applications, ready for SaaS, right out of the box.