β‘οΈ Building a Multi-Tenant Spring Boot Starter from Scratch β with Subdomain Routing, Dynamic Datasources & Ego Logs

Developer Preview
v0.1.0-SNAPSHOT
is live!
π§ Why This Starter Exists
Spring Boot lacks a true plug-and-play solution for multi-tenant SaaS platforms. Most solutions are deeply coupled, opinionated, or too abstract.
But also β this project came from a personal place.
Right after I received a disappointing 0.5 LPA raise (yes, backwards momentum), I decided to convert that frustration into engineering fire. Inspired by Blue Lock, I wanted to log every technical decision like a striker chasing goals β enter the ego-logs/
folder.
π§± Project Structure
βββ starter/ β Core Spring Boot auto-config starter
βββ demo/ β Sample app showing real usage
βββ ego-logs/ β My engineering journal (yes, Blue Lockβstyle)
βββ scripts/ β Placeholder for CI or future tools
βββ daily/ β Temp debug + local artifacts
π§© Features in Developer Preview
β
Subdomain-based tenant resolution
β
Header-based tenant resolution
β
Tenant registry (in-memory)
β
Per-DB isolation strategy
β
@EnableTenantIsolation
annotation
β
Clean Spring Boot auto-configuration
βοΈ Extensible resolvers + datasource logic
π¦ Add It via JitPack
Maven
<dependency>
<groupId>com.github.rahul-s-bhatt</groupId>
<artifactId>multi-tenant-springboot-starter</artifactId>
<version>v0.1.0-SNAPSHOT</version>
</dependency>
Gradle
dependencies {
implementation("com.github.rahul-s-bhatt:multi-tenant-springboot-starter:v0.1.0-SNAPSHOT")
}
π» Usage Snapshot
Enable the starter via application.yml
multi-tenancy:
default-tenant-id: acme
registry:
type: IN_MEMORY
in-memory-tenants:
- tenantId: acme
datasourceUrl: jdbc:h2:mem:acme
username: sa
- tenantId: globex
datasourceUrl: jdbc:h2:mem:globex
username: sa
isolation:
type: TENANT_PER_DATABASE
resolution:
type: HTTP_HEADER
π§ How It Works
flowchart TD
A[Request] --> B[Filter: TenantResolver]
B --> C[TenantContextHolder]
C --> D[TenantRegistry]
D --> E[RoutingDataSource]
E --> F[DB A or DB B]
π₯ About ego-logs/
This is my commitment to daily logging of what I learned, attempted, failed at, or broke. No GitHub green dots β real dev logs.
Just like Blue Lock's Ego Jinpachi believes in personal records to dominate the game, these ego logs are my engineering training arcs.
π£οΈ What's Coming
JWT-based tenant resolution
Schema-based isolation
Runtime tenant onboarding APIs
Liquibase / Flyway integration
Multi-tenant Spring Security support
π§βπ» Contribute or Fork
If you're working on a SaaS platform, this is for you.
Star π the repo, fork it, build your own isolation strategy.
GitHub β rahul-s-bhatt/multi-tenant-springboot-starter
JitPack β jitpack.io/#rahul-s-bhatt
π«‘ Final Words
Dev discipline isn't just commits β it's clarity, context, and ego-fueled progress.
This is just the beginning.
If you enjoyed this drop, follow @rahul_s_bhatt for future dev logs, open-source updates, and architecture deep dives.
Subscribe to my newsletter
Read articles from Code Striker directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
