Initial commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# AGENTS.md - rnb Backend
|
||||
|
||||
## Build & Run
|
||||
- **Maven profiles**: `dev` (default), `prod`
|
||||
- **Build**: `mvn clean package -DskipTests -Pdev` (or `-Pprod`)
|
||||
- **Run locally**: Execute `RnBApplication.main()` (port 10800)
|
||||
- **Docker**: `docker-compose -f docker/docker-compose.yml -p youlai-boot up -d` (MySQL 3306, Redis 6379, MinIO 9000/9001, XXL-Job 8080)
|
||||
|
||||
## Key Configuration
|
||||
- **Active profile**: Set via `spring.profiles.active` (default: `prod` in application.yml)
|
||||
- **Dev DB**: `localhost:3306/rnb` (user: root, pass: 168soft.xyz)
|
||||
- **Dev Redis**: `localhost:16378` (pass: CZwy16378, db: 2)
|
||||
- **Prod DB**: `localhost:3308/rnb`
|
||||
- **Prod Redis**: `localhost:6379` (no password)
|
||||
- **JWT secret**: Must be ≥32 chars (see `security.session.jwt.secret-key` in profile yml)
|
||||
|
||||
## Project Structure
|
||||
```
|
||||
src/main/java/com/rnb/
|
||||
├── common/ # Shared: annotation, base, constant, enums, exception, model, result, util
|
||||
├── config/ # Auto-configuration, property binding
|
||||
├── core/ # Core: aspect (log, repeat-submit), filter (request-log, rate-limit), handler (data-permission, data-fill), security
|
||||
├── modules/ # Business modules: member, order, product
|
||||
├── shared/ # Shared modules: auth, file, codegen, mail, sms, websocket
|
||||
└── system/ # System module: controller, converter, model (bo/dto/entity/form/query/vo), mapper, service
|
||||
```
|
||||
|
||||
## Code Generation
|
||||
- **MyBatis-Plus Generator**: Run `SystemCodeGenerator.main()` (prompts for table names, uses `sys_` prefix)
|
||||
- **Templates**: `src/test/resources/templates/*.vm` (backend), `codegen.yml` (frontend)
|
||||
- **Output**: `src/main/java/com/rnb/system/...`, `src/main/resources/mapper/...`
|
||||
|
||||
## Testing
|
||||
- **Tests skipped by default**: `maven-surefire-plugin` has `<skip>true</skip>`
|
||||
- **Run single test**: `mvn test -Dtest=ClassName -DfailIfNoTests=false`
|
||||
|
||||
## Common Commands
|
||||
```bash
|
||||
# Build dev
|
||||
mvn clean package -DskipTests -Pdev
|
||||
|
||||
# Build prod
|
||||
mvn clean package -DskipTests -Pprod
|
||||
|
||||
# Run with dev profile (from IDE or)
|
||||
mvn spring-boot:run -Pdev
|
||||
|
||||
# Start infra only
|
||||
cd docker && docker-compose -f docker-compose.yml -p youlai-boot up -d
|
||||
|
||||
# Stop infra
|
||||
cd docker && docker-compose -f docker-compose.yml -p youlai-boot down
|
||||
```
|
||||
|
||||
## Notable Conventions
|
||||
- **Table prefix**: `rb_` (MyBatis-Plus config)
|
||||
- **Logic delete**: field `isDeleted` (1=deleted, 0=active)
|
||||
- **Security modes**: JWT (stateless) or Redis-token (stateful, multi-login control)
|
||||
- **API docs**: Knife4j at `/doc.html` (dev), `/swagger-ui.html` (prod)
|
||||
- **Port**: 10800 (both dev/prod)
|
||||
- **Lombok + MapStruct**: Use `lombok-mapstruct-binding` for compatibility
|
||||
|
||||
## Gotchas
|
||||
- Dockerfile expects `target/youlai-boot.jar` but Maven builds `target/rnb-<version>-dev.jar` → rename or adjust Dockerfile
|
||||
- DB connection validated on startup (app exits if fails)
|
||||
- `application.yml` imports `codegen.yml` for code generator config
|
||||
- Tests require DB/Redis running (use docker-compose)
|
||||
Reference in New Issue
Block a user