Are you an LLM? You can read better optimized documentation at /backend/index.md for this page in Markdown format
Backend Documentation โ
Welcome to the MineAdmin 3.x backend development documentation. This guide will help you gain an in-depth understanding of MineAdmin's backend architecture, development standards, and best practices.
Architecture Overview โ
The MineAdmin backend is built using a modern PHP technology stack, developed on the Hyperf 3.x framework, and runs in a high-performance coroutine environment.
Core Features โ
- High-performance coroutines: Leveraging Swoole/Swow extensions for exceptional concurrency performance
- Modern architecture: Clear layered structure
- Secure and reliable: Built-in dual-token authentication mechanism with comprehensive permission control
- Easy to extend: Supports plugin development with modular architecture design
Technology Stack โ
Component | Version | Description |
---|---|---|
PHP | 8.x+ | Modern PHP language features |
Hyperf | 3.x | High-performance coroutine framework |
Swoole/Swow | Latest stable | Coroutine runtime environment |
MySQL | 5.7+ / 8.0+ | Primary database |
Redis | 6.0+ | Cache and session storage |
JWT | - | Authentication based on lcobucci/jwt |
Quick Start โ
Requirements โ
- PHP >= 8.1
- Swoole >= 5.1 or Swow >= 1.0
- MySQL
- Redis
Starting the Service โ
bash
# Start HTTP service
php bin/hyperf.php start
1
2
2
Development Mode โ
bash
# Hot-reload mode (recommended for development)
php bin/hyperf.php server:watch
1
2
2
Project Structure โ
MineAdmin's directory structure follows Laravel design principles. If you have Laravel experience, you'll feel right at home.
Root Directory Structure โ
โโโ App/ # Core application code
โโโ Config/ # Configuration files
โโโ Database/ # Database-related files
โโโ Storage/ # Storage (logs, uploads, etc.)
โโโ Tests/ # Test code
โโโ Web/ # Frontend application
โโโ Plugin/ # Plugins directory
1
2
3
4
5
6
7
2
3
4
5
6
7
App Directory Details โ
App/
โโโ Exceptions/ # Exception handling
โโโ Http/ # HTTP components (controllers, middleware, request validation)
โโโ Model/ # Data models (Eloquent ORM)
โโโ Service/ # Business logic layer
โโโ Repository/ # Data access layer
โโโ Schema/ # API documentation schema definitions
1
2
3
4
5
6
7
2
3
4
5
6
7
Architecture Layers:
- Controller: Handles HTTP requests, parameter validation, and response formatting
- Service: Business logic orchestration, coordinating Repository and Model
- Repository: Data access abstraction, unifying data sources (MySQL, Redis, ES, etc.)
- Model: Data model definitions using coroutine-compatible Eloquent ORM
Core Features โ
Authentication & Authorization โ
- Dual-token mechanism: Access Token + Refresh Token for seamless refresh
- RBAC: Role-based access control with data permissions
- Multi-client support: Web, mobile, and API clients
Data Permissions โ
- Flexible configuration: Rule-based data permission control
- Multi-dimensional support: Department, user, and role-based permissions
- Transparent integration: Seamless integration with business logic
Logging & Monitoring โ
- Operation logs: Detailed user activity tracking
- Login logs: User login records and security analysis
- System logs: Application runtime logs and error tracing
Development Guide โ
Fundamentals โ
- Directory Structure - Detailed project organization
- Lifecycle - Application startup and request flow
- Routing System - Route definitions and middleware
- Exception Handling - Unified exception handling
Advanced Features โ
- Security Mechanism - Authentication and authorization
- Data Permissions - Data permission system
- Event Handling - Event-driven development
Deployment & Operations โ
- Log Management - Log configuration and management
- File Uploads - File processing and storage
Plugin Development โ
MineAdmin supports extensibility through plugins:
- Plugin Development Guide - Complete plugin tutorial
- Marketplace - Plugin publishing and distribution
API Documentation โ
- API Reference - Complete REST API documentation
- Swagger UI:
/swagger
(development environment)
FAQ โ
- Frequently Asked Questions - Common issues and solutions
Community & Support โ
- GitHub: https://github.com/mineadmin/mineadmin
- Documentation Issues: Submit Issue
- Technical Discussions: Join official community groups
References โ
This documentation was created with inspiration from these excellent projects:
Next Step: We recommend starting with Directory Structure to understand the project architecture.