Simplified Chinese | English
Project Guidance document
Online Demo
Font Een
- Web UI Framework: Element-UI
- Server Framework: gin
- Grom Framework: gorm
1. Basic introduction
1.1 Project Structure
│ │ ├ ─ the conf (Config file) ├ ─ docs (swagger APIs docs) │ ├ ─ the log (log file) │ ├ ─ public (public static file) │ ├ ─ the static (head Icon) ├─ SRC │ ├─ Controller (Controller) │ ├─ Middleware (Model Entity) │ ├─ PKG (Project Private) Package) │ ├─ Flag School - Adapter (Casbin Adapter) │ ├─ App (Gin Service Response) │ ├─ Code (Response Code) │ ├─ Error (Project) Private Error) │ ├─ Heavy Metal Guitar School (Redis) │ ├─ Heavy Metal Guitar School (Redis) │ ├─ Setting (Project Setting) │ ├─ Heavy Metal Guitar School │ ├─ ├─ ├─ Exercises (Exercises) │ ├─ Exercises (Exercises) │ ├─ Exercises (Exercises)Copy the code
1.1.2 Generating API Documentation
cd grom-gin-admin
go get -u github.com/swaggo/swag/cmd/swag
swag init
Copy the code
Visit http://localhost:8050/api/v1/swagger/index.html to view the swagger document
1.2 Environment Configuration
1.2.1 Golang installation
- Foreign agents can browse this screen to view the Golang installation documentation olongfence.github
- Golang installation document blog.olongfence.ltd
1.2.2 Project Environment Configuration
I am in this project environment configuration through docker installation, need to install PostgreSQL and Redis in the host installation configuration
git clone https://github.com/olongfen/gorm-gin-admin.git
Copy the code
cd gorm-gin-admin
docker-compose up -d .
Copy the code
1.2.3 Project Configuration Description
- Authenticating session permissions through an RSA key pair
admin.key admin.pub user.key user.pub Copy the code
- Casbin model file
model_casbin.conf
- Project profile
When there is no configuration file in your conf directory, you can run the project once, it will automatically generate the configuration file, then modify your configuration information in the configuration, and then run it again.Copy the code
1. Run the Service
go run main.go
Copy the code
2. Technology stack
- Front end: Based on
vue
theElement-UI
Build the base page. - The backend: use
Gin
Quick build base restful style API,Gin
Is a Web framework written in the GO language. - Database: using
PostgreSQL
, the use ofGorm2.0 version
Implement basic operations on the database, - Cache: Ready for development use
Redis
Implement the recording of current active usersjwt
Token and implement multi-point login restrictions. - API documentation: use
Swagger
Build automated documents. - Configuration file: Used
github.com/spf13/viper
implementationyaml
Format of a configuration file. - Logging: Using
github.com/sirupsen/logrus
Implement logging.
3. Main functions
- Permission management: Based on
jwt
andcasbin
The realization of permission management - User management: The system administrator assigns user roles and role permissions.
- Role management: The main object for creating permission control. You can assign different API and menu permissions to roles.
- Menu management: Realize dynamic menu configuration for users and realize different menus for different roles.
- API management: Different users have different permissions on API interfaces.
- Conditional search: Added conditional search examples.
- Restful Example: You can see the example apis in the user management module.
4. Plan tasks
- Import and export Excel
- Administrator Operation Records
- RPC is called to other projects
- Token Caching mechanism