youlai-boot youlai-boot-tenant

Multi-tenant enterprise-grade permission management backend based on Spring Boot

Spring Boot

JDK

Multi-tenancy

License

Gitee Star

Introduction

youlai-boot-tenant is the multi-tenant edition of youlai-boot, built on Spring Boot. It adopts a single-database multi-tenant approach with MyBatis-Plus, isolating tenant data by tenant ID, and is designed as the backend for SaaS applications. It ships with the frontend vue3-element-admin and shares the same API specification.

Core Features

  • 🏢 Multi-tenant architecture — single-database multi-tenancy with MyBatis-Plus, data isolation by tenant ID

  • 🔐 Security — Spring Security + JWT/Redis dual-session model, token renewal, multi-device mutual exclusion

  • 🛡️ Fine-grained permissions — 5-level RBAC: data → menu → button → API → field

  • Code generator — one-click generation of full-stack CRUD code

  • 📦 Complete modules — users, roles, menus, departments, dictionaries, files, scheduled tasks, message center, operation logs

  • 🔌 Real-time communication — SSE push: online user count, dictionary sync, notification broadcast

System Preview

PC

<td><img alt="PC Preview 1" width="400" src="./docs/images/preview/pc-01.png"></td>

<td><img alt="PC Preview 2" width="400" src="./docs/images/preview/pc-02.png"></td>
<td><img alt="PC Preview 3" width="400" src="./docs/images/preview/pc-03.png"></td>

<td><img alt="PC Preview 4" width="400" src="./docs/images/preview/pc-04.png"></td>
<td><img alt="PC Preview 5" width="400" src="./docs/images/preview/pc-05.png"></td>

<td><img alt="PC Preview 6" width="400" src="./docs/images/preview/pc-06.png"></td>

Mobile

<td><img alt="App Preview 1" width="200" src="./docs/images/preview/app-01.png"></td>

<td><img alt="App Preview 2" width="200" src="./docs/images/preview/app-02.png"></td>

<td><img alt="App Preview 3" width="200" src="./docs/images/preview/app-03.png"></td>

<td><img alt="App Preview 4" width="200" src="./docs/images/preview/app-04.png"></td>

Quick Start

Requirements: JDK 17+ · MySQL 8.0+ · Redis 6.0+

  1. Clone: git clone https://gitee.com/youlaiorg/youlai-boot-tenant.git

  2. Import database: sql/youlai_admin_tenant.sql

  3. Adjust config (optional, a read-only online data source is configured by default): src/main/resources/application-dev.yml

  4. Start and visit http://localhost:8000/doc.html

Default credentials: admin / 123456

Docker: cd docker && docker-compose up -d

Detailed guide: Deployment Docs · Dev Standards

Multi-Tenant Testing

  • Prebuilt tenants: the default platform tenant (tenant_id=0) and a demo tenant (tenant_id=1).

  • Prebuilt accounts: platform tenant (root/admin) and demo tenant (admin), default password 123456.

  • Local testing: edit your local hosts file to add 127.0.0.1 vue.youlai.tech and 127.0.0.1 demo.youlai.tech; visiting via different domains switches tenants automatically.

Tech Stack

| Tech | Version | Description |

|:-----|:--------|:------------|

| Spring Boot | 4.0.5 | Core framework |

| Spring Security | 6.x | Auth & authorization |

| MyBatis-Plus | 3.5.15 | ORM |

| Druid | 1.2.24 | Connection pool |

| Redis + Redisson | 6.0+ / 4.1.0 | Cache · Session · Distributed lock |

| Caffeine | 2.9.3 | Local cache |

| XXL-Job | 3.2.0 | Distributed scheduled tasks |

| Knife4j | 4.5.0 | API docs |

| MapStruct | 1.6.3 | Object mapping |

| AWS SDK S3 | 2.54.2 | Object storage (RustFS) |

Directory Structure


youlai-boot-tenant/

├── docker/                          # Docker orchestration

├── sql/                             # Database init scripts

├── src/main/java/com/youlai/boot/

│   ├── YouLaiBootApplication.java   # Bootstrap class

│   ├── auth/                        # Auth (login/logout/token)

│   ├── codegen/                     # Code generator

│   ├── common/                      # Common module (constants/enums/response)

│   ├── file/                        # File service (RustFS/local/OSS)

│   ├── framework/                   # Technical framework layer

│   │   ├── apidoc/                  # OpenAPI / Knife4j

│   │   ├── cache/                   # Redis / Caffeine cache

│   │   ├── captcha/                 # Graphic captcha

│   │   ├── integration/             # SMS / Email / WeChat

│   │   ├── job/                     # XXL-Job scheduled tasks

│   │   ├── mybatis/                 # MyBatis-Plus config

│   │   ├── security/                # Security / JWT / Token

│   │   └── web/                     # Global exception / CORS / rate limit

│   ├── message/                     # SSE push

│   └── system/                      # Business (user/role/menu/dept)

└── pom.xml                          # Maven dependency management

Ecosystem

Frontend

| Project | Stack | Description |

|:-----|:------|:------------|

| vue3-element-admin | Vue 3 + Element Plus | PC admin frontend (recommended) |

| youlai-app | Vue 3 + UniApp | Mobile App |

Backend

| Project | Stack | Description | | youlai-boot | Spring Boot + MyBatis-Plus | Java (recommended) | | youlai-nest | NestJS + TypeORM | Node.js | | youlai-gin | Go + Gorm | Go | | youlai-django | Django + DRF | Python | | youlai-fastapi | FastAPI + SQLAlchemy | Python | | youlai-think | ThinkPHP + ThinkORM | PHP | | youlai-aspnet | ASP.NET Core + EF Core | C# | | youlai-axum | Axum + SeaORM | Rust |

youlai-boot also provides the following variants and branches: Multi-Tenant · MyBatis-Flex · Spring Boot 3 · PostgreSQL · Multi-Module

The eight backends share the same RESTful API specification and database schema, so the frontend can switch seamlessly.

Documentation

| Resource | Link |

|:-----|:-----|

| 📖 Full docs site | www.youlai.tech |

| 🖥️ PC live preview | vue.youlai.tech |

| 📱 Mobile live preview | app.youlai.tech |

| 🔗 Apifox API docs | apifox.com |

| 🔗 Local API docs | localhost:8000/doc.html |

Contributing

Issues and Pull Requests are welcome! See the Contribution Guide.

Contributors

License

Released under the Apache License 2.0; free for commercial use.


Official WeChat Account

    

Mini Program

    

Add author on WeChat

Official WeChat Account

    

Mini Program

    

Add author on WeChat

Technical discussion · Feedback · Business cooperation

Description
🌈 youlai-boot-tenant 是 youlai-boot 的多租户版本,基于 Spring Boot 4, Spring Security, Mybatis-Plus, JWT, Redis 构建,专为 SaaS 应用提供后端支持。
Readme Apache-2.0 16 MiB
Languages
Java 99.9%