A Modern Multi-Tenant SaaS System Built with Spring Boot, Kotlin, and Jimmer ORM
FoxDen is a comprehensive multi-tenant SaaS platform designed for building enterprise-grade applications. It combines modern JVM technologies with best practices to deliver a robust, scalable, and maintainable system.
- ๐ข Multi-Tenancy: Built-in tenant isolation and management
- ๐ Advanced Security: Sa-Token based authentication with multiple strategies (password, SMS, email, OAuth, WeChat)
- ๐ฏ Role-Based Access Control: Fine-grained permissions with data scope filtering
- ๐๏ธ Modern ORM: Jimmer ORM with compile-time validation and N+1 query prevention
- ๐ Data Permissions: Automatic data filtering based on user roles and departments
- ๐ High Performance: Redis caching with Redisson, distributed locking
- ๐ Comprehensive Logging: Operation logs, login logs, and audit trails
- ๐ Social Login: Built-in support for 20+ social platforms via JustAuth
- ๐ Excel Import/Export: EasyExcel integration for data handling
- ๐ฆ Object Storage: Support for MinIO, Aliyun OSS, and QCloud COS
- โฐ Task Scheduling: SnailJob distributed task scheduling
- ๐ Workflow Engine: WarmFlow workflow engine for business process management
- ๐ Idempotency: API idempotency protection
- ๐ฆ Rate Limiting: API rate limiting support
- ๐ญ Sensitive Data: Automatic data masking for sensitive fields
- ๐ก Server-Sent Events: Real-time push notifications via SSE
- ๐ Service Translation: Dictionary translation service
| Category | Technology | Version |
|---|---|---|
| Language | Kotlin | 2.3.0 |
| Framework | Spring Boot | 3.5.11 |
| ORM | Jimmer | 0.10.6 |
| Database | PostgreSQL | - |
| Cache | Redis (Redisson) | 3.52.0 |
| Security | Sa-Token | 1.44.0 |
| API Docs | SpringDoc OpenAPI | 2.8.15 |
| Excel | EasyExcel | 4.0.3 |
| Distributed Lock | Lock4j | 2.2.7 |
| Task Scheduling | SnailJob | 1.9.0 |
| Workflow | WarmFlow | 1.8.4 |
| Build | Gradle (Kotlin DSL) | - |
| JDK | Java | 21 |
- JDK 21+
- Gradle 8.x
- PostgreSQL
- Redis (optional, for caching)
git clone https://github.com/alphafoxz/foxden.git
cd foxden
# Build the project
./gradlew build
# Or run tests
./gradlew test# Start admin application (port 12003)
./gradlew :foxden-app:foxden-app-admin:bootRun- Admin Application: http://localhost:12003
- API Documentation: http://localhost:12003/swagger-ui.html
- Health Check: http://localhost:12003/actuator/health
# Admin application (port 12003)
./gradlew :foxden-app:foxden-app-admin:bootRun
# System management (port 12004)
./gradlew :foxden-app:foxden-app-system:bootRun
# Job scheduling (port 12005)
./gradlew :foxden-app:foxden-app-job:bootRun
# Workflow (port 12006)
./gradlew :foxden-app:foxden-app-workflow:bootRun# Database (PostgreSQL)
spring:
datasource:
url: jdbc:postgresql://localhost:12001/postgres
username: postgres
password: 123456
# Server
server:
port: 12003foxden/
โโโ foxden-bom/ # Dependency management (Bill of Materials)
โโโ foxden-common/ # Common modules
โ โโโ foxden-common-core/ # Core utilities, constants, exceptions, DTOs
โ โโโ foxden-common-jimmer/ # Jimmer ORM utilities, traits, data permissions
โ โโโ foxden-common-web/ # Web common (captcha, XSS filter, i18n)
โ โโโ foxden-common-security/ # Sa-Token security configuration
โ โโโ foxden-common-redis/ # Redis caching with Redisson
โ โโโ foxden-common-encrypt/ # API encryption/decryption (RSA+AES)
โ โโโ foxden-common-log/ # Logging annotations and event publishing
โ โโโ foxden-common-oss/ # Object Storage Service (MinIO, Aliyun, QCloud)
โ โโโ foxden-common-excel/ # Excel import/export with EasyExcel
โ โโโ foxden-common-mail/ # Email functionality
โ โโโ foxden-common-sms/ # SMS functionality
โ โโโ foxden-common-social/ # Social login (JustAuth)
โ โโโ foxden-common-doc/ # SpringDoc OpenAPI documentation
โ โโโ foxden-common-idempotent/ # Idempotent request handling
โ โโโ foxden-common-ratelimiter/ # Rate limiting
โ โโโ foxden-common-json/ # JSON configuration
โ โโโ foxden-common-job/ # Task scheduling (SnailJob)
โ โโโ foxden-common-sensitive/ # Sensitive data masking
โ โโโ foxden-common-sse/ # Server-Sent Events
โ โโโ foxden-common-tenant/ # Tenant common utilities
โ โโโ foxden-common-translation/ # Dictionary translation service
โโโ foxden-domain/ # Domain layer
โ โโโ foxden-domain-system/ # System domain (user, role, menu, dept, etc.)
โ โโโ foxden-domain-tenant/ # Tenant domain
โ โโโ foxden-domain-infrastructure/ # Infrastructure services
โ โโโ foxden-domain-gen/ # Code generation
โ โโโ foxden-domain-job/ # Task scheduling domain
โ โโโ foxden-domain-test/ # Test domain
โ โโโ foxden-domain-workflow/ # Workflow domain (WarmFlow)
โโโ foxden-app/ # Application layer
โโโ foxden-app-admin/ # Admin application (auth, login, registration)
โโโ foxden-app-system/ # System management controllers
โโโ foxden-app-job/ # Task scheduling application
โโโ foxden-app-workflow/ # Workflow application
- User Management: User CRUD, password reset, role assignment
- Role Management: Role CRUD, permission configuration, data scope
- Menu Management: Dynamic menu tree, route configuration
- Department Management: Department tree, data permissions
- Dictionary Management: System dictionaries, cache refresh
- Parameter Configuration: System parameters, dynamic config
- Notice Management: Announcement publishing
- Log Management: Operation logs, login logs
- Client Management: Client application management
- OSS Management: Object storage configuration and file management
- Tenant registration and management
- Tenant package configuration
- Tenant isolation and data filtering
- Tenant status monitoring
- Multiple authentication strategies:
- Password authentication (BCrypt)
- SMS verification code
- Email verification code
- OAuth social login (20+ platforms)
- WeChat mini-program
- JWT token management
- Login failure lockout
- Captcha verification (image/math)
- Distributed task scheduling with SnailJob
- Cron expression based scheduling
- Task monitoring and execution logs
- Failed retry mechanism
- Task dependency management
- Visual workflow designer
- Process definition and deployment
- Task assignment and approval
- Process instance monitoring
- Historical query and audit trails
FoxDen uses Jimmer's trait-based entity model for maximum code reuse:
@Entity
@Table(name = "sys_user")
interface SysUser : CommDelFlag, CommId, CommInfo, CommTenant {
val userName: String
val nickName: String?
@ManyToMany
@JoinTable(name = "sys_user_role")
val roles: List<SysRole>
}Available Traits:
CommId: Primary key with auto-generationCommTenant: Multi-tenancy supportCommInfo: Audit fields (created/updated by/time)CommDelFlag: Soft delete support
Automatic data filtering using AOP:
@DataPermission(
value = [
DataColumn(key = ["deptName"], value = ["dept_id"])
]
)
fun selectUserList(bo: SysUserBo): List<SysUserVo> {
// Jimmer automatically injects data permission filters
}- Project Guide - Detailed project documentation
- Jimmer ORM Guide - Jimmer usage guide
- Migration Guide - Java to Kotlin migration notes
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Jimmer ORM - The innovative ORM framework
- Sa-Token - Lightweight authentication framework
- JustAuth - Social login integration
- RuoYi-Vue-Pro - Inspiration for business logic
- Author: AlphaFoxZ
- Email: alphafoxz@qq.com
- Issues: GitHub Issues
โญ If you like this project, please give it a star! โญ
