Skip to content

Simple Spring Boot application demonstrating the use of a multi-tenant architecture

License

Notifications You must be signed in to change notification settings

blake8090/multi-tenant-app-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multi-tenant-app-example

This is a basic example of a Spring Boot application using a multi-tenant architecture for the data layer.

A database-per-tenant strategy is used, where a master database only contains info on connecting to separate tenant databases. This includes info such as the JDBC URL, username, password, and driver class.

Process for connecting to tenant database:

  • Client makes a request, passing a specific tenant identifier
  • Data layer connects to master database
  • Using the tenant identifier, the app queries the master database for a tenant record
  • A connection is then made with the tenant database

Integration testing is done using H2 database (https://www.h2database.com/html/main.html).

Running

This project requires Maven and Docker to be installed on your computer.

  1. Start Docker daemon
  2. Run the following commands:
    • mvn verify
    • docker-compose build && docker-compose up

TODO

  • Better error handling
  • Pass tenant identifier through path parameter instead of a header
  • Unit tests

About

Simple Spring Boot application demonstrating the use of a multi-tenant architecture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published