# trae_demo **Repository Path**: chengccn_base/trae_demo ## Basic Information - **Project Name**: trae_demo - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-22 - **Last Updated**: 2026-01-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Go-Zero Admin System ## 1. System Architecture This project uses a microservice architecture based on `go-zero`. - **Identity Service**: Handles user authentication (login, registration, token generation). - **Admin Service**: Handles RBAC (Role-Based Access Control) and system management (users, roles, menus). - **API Gateway**: Each service exposes RESTful APIs via `go-zero`'s built-in gateway features. - **RPC**: Services communicate internally using gRPC. ### Tech Stack - **Framework**: go-zero - **Language**: Go - **Database**: MySQL (GORM) - **Service Discovery**: Etcd - **Auth**: JWT ## 2. Directory Structure ``` go-r/ ├── app/ │ ├── identity/ # Identity Service │ │ ├── api/ # HTTP API │ │ └── rpc/ # gRPC Service │ └── admin/ # Admin Management Service │ ├── api/ # HTTP API │ └── rpc/ # gRPC Service ├── common/ # Shared Libraries │ ├── gorm/ # DB Client │ ├── jwtx/ # JWT Helper │ ├── response/ # Unified Response │ └── middleware/ # Global Middleware ├── deploy/ │ └── sql/ # Database Init SQL └── go.mod ``` ## 3. Database Design The system uses `go_zero_admin` database with the following tables: - `sys_user`: User accounts - `sys_role`: Roles - `sys_menu`: Menus and Permissions - `sys_user_role`: User-Role association - `sys_role_menu`: Role-Menu association - `sys_dept`: Departments ## 4. Initialization 1. **Database**: Run `deploy/sql/init.sql` in your MySQL instance. 2. **Dependencies**: `go mod tidy` 3. **Config**: Update `etc/*.yaml` files in each service with your DB and Etcd config. 4. **Run**: - Start Etcd - Start Identity RPC & API - Start Admin RPC & API ## 5. API Definition - **Identity API**: `/v1/login`, `/v1/user/info` - **Admin API**: `/v1/user/list`, `/v1/role/list`