TenantLayer – Multi-Tenancy for Spring Boot and Postgres
Adds Postgres row-level tenant isolation to Spring Boot, mutation-tested against leaks.
TenantLayer bakes tenant isolation into Postgres itself via row-level security, so it holds even for native queries, JdbcTemplate calls, bulk updates, or a stray psql session — not just requests that pass through your ORM filter. It resolves the tenant from a header, subdomain, path, or JWT claim, and propagates that context through @Async, CompletableFuture, virtual threads, Kafka, and WebFlux. It's version 0.1.0 under Apache 2.0 for Java 17+ and Spring Boot 3.3+, and every isolation claim is mutation-tested against a real Postgres and Kafka broker, not mocks — with past bugs, like virtual threads silently breaking @Async isolation, written up on the blog rather than buried in a changelog.
What holds up
- +Isolation lives in Postgres row-level security — it catches native queries and stray psql sessions too.
- +Mutation-tested: after each test passes, they break the implementation and confirm it fails.
- +101 tests run against a real Postgres and Kafka broker, not mocks.
Mind the limits
- −Early 0.1.0 release — much of the planned surface is still open issues, 26 unclaimed.
- −Requires your app's DB role to be neither superuser nor table owner, or RLS is silently bypassed.
Picked here? Add the badge
Put it on your site. It links back to this page. Free for every listed product.
<a href="https://stillworks.dev/products/p/tenantlayer-multi-tenancy-for-spring-boot-and-postgres/"><img src="https://stillworks.dev/badge/tenantlayer-multi-tenancy-for-spring-boot-and-postgres.svg" alt="Picked by StillWorks" width="230" height="54"></a>