service.xpcool.com/PROJECT_STRUCTURE.md

1.5 KiB

Production layout

service.xpcool.com/
├── api/                         # HTTP contracts and Swagger metadata
│   ├── user/v1/                 # /api/v1 - client-facing API
│   └── admin/v1/                # /admin/v1 - administration API
├── internal/
│   ├── cmd/                     # application bootstrap and route isolation
│   ├── consts/                  # application error codes and constants
│   ├── controller/              # API-to-service adapters only
│   ├── service/                 # domain use cases and provider interfaces
│   ├── dao/                     # generated by gf gen dao; never hand edited
│   ├── model/
│   │   ├── entity/              # generated database entities
│   │   ├── do/                  # generated Data Objects
│   │   ├── dto/                 # service boundary input/output
│   │   └── vo/                  # API view models
│   ├── middleware/              # configurable route-group middleware
│   └── library/                 # JWT, response, pagination primitives
├── manifest/
│   ├── config/                  # config.dev/test/prod.yaml
│   └── sql/                     # ordered MySQL migrations
└── utility/                     # optional cross-cutting helpers

dao, model/do and model/entity are generated after migration, so their schema never drifts from MySQL. Controllers do not access DAO; only services do.