In this issue, we recommend a front-end and back-end separation permission management system developed based on the Hyperf framework and SCUI (Element UI) – MineAdmin.
MineAdmin is developed based on the Hyperf framework, the front-end uses Vue3.0 + SCUI (based on Element UI), supports PC and mobile terminals, and the system can be used for website management background, CMS, CRM, OA, ERP, etc. MineAdmin is a back-end permission management system, which provides a complete permission system, so that developers can focus on specific businesses, reduce development costs, and improve project efficiency.
Built-in features
User management, complete the configuration of user addition, modification, and deletion, and support different users to log in to the background to see different home pages
Department management, departmental organization (company, department, group), tree structure to display support data permissions
Post management, which can be assigned to the position held by the user
Role management, role menu permission assignment, role data permission assignment
Menu management, configuration of system menus and buttons, etc
Dictionary management, which can be reused and maintained for frequently used and fixed data in the system
System configuration, management of some common settings of the system
Operation logs, which are queries made by users about some normal operations of the system
Login logs, which are logged in to the system by users
Online Users, to view the currently logged-in users
Service monitoring to view information such as the current server status and PHP environment
Dependency monitoring to view the library information and versions that the current program depends on
Attachment management: Manage information such as files and pictures uploaded by the current system
Data table maintenance, the data table of the system can be cleaned up and optimized
Module management, all current modules of the management system
Data table designer, simple version of database designer, with code generator to do more with less
Scheduled tasks: Online (add, modify, and delete) task scheduling includes execution result logs
Code generation, front-end and back-end code generation (php, vue, js, sql), support download and generation to modules
Cache monitoring to view Redis information and key information used by the system
API management, application and interface management, interface authorization, and other functions. Automatic generation of interface documents, input and output parameter checking, etc
Install and deploy
1 Server Requirements
MineAdmin has some requirements for the system environment, when you use the Swoole network engine driver, it can only run in Linux and Mac environments, but due to the development of Docker virtualization technology, Docker for Windows can also be used as the runtime environment under Windows.
2 Environmental requirements
Swoole >= 4.5.x and turn off Short Name
PHP >= 7.4 and enable the following extensions: mbstring, json, pdo, openssl, redis, pcntl
Mysql >= 5.7
Redis >= 4.0
3 Download the project
MineAdmin does not use SQL file to import and install, the system uses Migrates migration file to install and populate data, please be aware.
To download your project, make sure you have Composer installed:
git clone https://gitee.com/xmo/MineAdmin && cd MineAdmin
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer install
4 Back-end installation
To install a project, you need to open two terminals, one to start the project and the other to execute the installation command.
Open the startup terminal and start the project:
php bin/hyperf.php start
Switch to the installation terminal, run the installation command, and complete the configuration of the .env file:
php bin/hyperf.php mine:install
After the following information is prompted, switch to the startup terminal, restart the project, and load the .env configuration information:
Reset the “.env” file. Please restart the service before running
the installation command to continue the installation.
Switch to the installation terminal, run the installation command again, and execute the Migrates data migration file and SQL data filling to complete the installation.
php bin/hyperf.php mine:install
5 Front-end mounting
Please make sure that you have installed node.js, yarn or npm tools, yarn is recommended.
cd mine-ui && yarn
or
cd mine-ui && npm install
Initiate:
yarn dev
or
npm run dev
In actual development, you can use php watch -c to start the project, which can listen for file changes and hot restart in real time to improve development efficiency.
6 Project Deployment
When the project needs to be deployed or tested in the online environment, and the local and online environments are inconsistent or the front-end and back-end are not on the same server, you need to perform Nginx reverse proxy and modify some configurations of the front-end.
Back-end agents
# At least one Hyperf node is required, multiple configurations and multiple rows
upstream hyperf {
# IP and port of Hyperf HTTP Server
server 127.0.0.1:9501;
}
server {
# Ports
listen 80;
# Domain name
server_name demo.mineadmin.com;
# Logs
access_log /data/wwwlogs/demo.mineadmin.com_nginx_access.log combined;
error_log /data/wwwlogs/demo.mineadmin.com_nginx_error.log debug;
# Deploy the front-end code of the same domain root directory, note:
location / {
root /data/wwwroot/demo.mineadmin.com;
try_files $uri $uri/ /index.html;
index index.html;
}
# Custom underscore parameters can be transmitted through headers
# underscores_in_headers on;
# PHP code
location /api/ {
# Forward the host and IP information of the client to the corresponding node
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Forward the protocol schema to the corresponding node, if you use non-https, please change it to http
proxy_set_header X-scheme https;
# Execute an agent to access the real server
proxy_pass http://hyperf/;
}
}
Required front-end configurations
The front-end also uses a proxy to request the back-end interface
Find the following configuration in mine-ui/vue.config.js and modify it according to your own situation
Base URL
const base_url = ‘http://127.0.0.1:9501’
Proxy API prefix
const proxy_api = ‘/api’
7 Extensions with compatibility issues
Since Hyperf is based on Swoole coroutines, the coroutines brought by Swoole 4 still have compatibility issues with many extensions. The following extensions, including but not limited to, cause certain compatibility issues and cannot be used or co-existed with:
xhprof
xdebug
blackfire
trace
uopz
Demo images
Development documentation
Backend Documentation: Backend Documentation | MineAdmin
Front-end documentation: Development Specs | MineAdmin
This project uses the Apache 2.0 open source license, and you can read more content by yourself.