Skip to content

AlphaFoxz/FoxDen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

44 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FoxDen Logo

FoxDen

A Modern Multi-Tenant SaaS System Built with Spring Boot, Kotlin, and Jimmer ORM

Kotlin Spring Boot Jimmer License

English | ็ฎ€ไฝ“ไธญๆ–‡


๐Ÿ“– Overview

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.

โœจ Key Features

  • ๐Ÿข 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

๐Ÿ› ๏ธ Technology Stack

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

๐Ÿš€ Quick Start

Prerequisites

  • JDK 21+
  • Gradle 8.x
  • PostgreSQL
  • Redis (optional, for caching)

Clone & Build

git clone https://github.com/alphafoxz/foxden.git
cd foxden

# Build the project
./gradlew build

# Or run tests
./gradlew test

Run the Application

# Start admin application (port 12003)
./gradlew :foxden-app:foxden-app-admin:bootRun

Access Points

Run Specific Applications

# 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

Default Configuration

# Database (PostgreSQL)
spring:
  datasource:
    url: jdbc:postgresql://localhost:12001/postgres
    username: postgres
    password: 123456

# Server
server:
  port: 12003

๐Ÿ“ Project Structure

foxden/
โ”œโ”€โ”€ 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

๐ŸŽฏ Core Modules

System Management

  • 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 Management

  • Tenant registration and management
  • Tenant package configuration
  • Tenant isolation and data filtering
  • Tenant status monitoring

Authentication & Authorization

  • 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)

Task Scheduling (SnailJob)

  • Distributed task scheduling with SnailJob
  • Cron expression based scheduling
  • Task monitoring and execution logs
  • Failed retry mechanism
  • Task dependency management

Workflow Engine (WarmFlow)

  • Visual workflow designer
  • Process definition and deployment
  • Task assignment and approval
  • Process instance monitoring
  • Historical query and audit trails

๐Ÿ—๏ธ Architecture

Trait-Based Entity Design

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-generation
  • CommTenant: Multi-tenancy support
  • CommInfo: Audit fields (created/updated by/time)
  • CommDelFlag: Soft delete support

Data Permission Filtering

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
}

๐Ÿ“š Documentation


๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


๐Ÿ“ฎ Contact


โญ If you like this project, please give it a star! โญ

About

A modern multi-tenant SaaS system built with Spring Boot, Kotlin, and Jimmer ORM. Features RBAC, data permissions, multiple auth strategies, social login, and Redis caching.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors