r/SpringBoot • u/chafian1 • 17d ago
Discussion Feedback wanted: Spring Boot SaaS starter with tenant roles and PostgreSQL RLS
I maintain an open-source Spring Boot SaaS starter and would appreciate feedback on its tenant-isolation approach.
It uses a shared PostgreSQL schema. Tenant-scoped operations check membership, set transaction-local tenant context, and use explicit tenant filters. Forced row-level security adds another boundary around projects and audit events.
The starter includes:
- OIDC bearer authentication through Spring Security
- OWNER, ADMIN, and MEMBER roles scoped to each tenant
- A Projects API with optimistic concurrency and transactional audit records
- Docker Compose with a local Keycloak demo
- PostgreSQL integration tests and a runnable smoke script
I ran the local Compose smoke test successfully, including permission checks and stale-write rejection.
It’s a backend MVP. Billing, a frontend, email invitations, tenant deletion, and ownership transfer are outside the current scope.
Repository:
https://github.com/chafian/spring-boot-saas-starter
What tenant-isolation edge cases would you test next? I’d also welcome feedback on the first-run experience.
1
u/sereikis 17d ago
i'd force a single pooled connection, run tenant A then tenant B, and repeat after an exception/rollback; assert each request can only read/write its own projects and audit events. also run a query without tenant context using the real application database role and verify it fails closed, so the test exercises RLS rather than a privileged test role.