duobao-backend/
├── gateway-service/ public ingress, auth, route, rate limit
├── user-service/ account, login, profile, TOS
├── agent-service/ invite relation, refCode, agent flag
├── wallet-service/ ledger, deposit address, withdraw lifecycle
├── game-service/ round, ticket, order, draw, prize
├── chain-service/ chain adapters, broadcast, VRF, BTC path
├── sign-service/ isolated signing and address derivation
├── admin-service/ admin auth, RBAC, audit, ops read models
├── message-service/ inbox + Telegram bot push, port 6678
├── duobao-api/ Feign clients, DTOs, events, errors, enums
├── duobao-common/ shared utilities, money, trace, idempotency
├── risk-service/ compatibility entry, no runtime owner yet
├── task-service/ compatibility entry, maps to game-service
├── scripts/ project-wrapped backend commands
├── docs/ backend catalog, onboarding, gates
├── sql/ SQL entry; service Flyway remains source
├── tools/ ticket bot and backend utilities
└── build.gradle / settings.gradle / gradle/
9-service runtime split
运行时边界锁定为 gateway / user / agent / wallet / game / chain / sign / sms / admin-service。
Shared contracts stay outside services
duobao-api 承载 Feign、DTO、事件、错误码;duobao-common 只放纯工具。
Compatibility entries are not new owners
risk-service 和 task-service 是兼容入口;业务仍归当前 owner service。
Script-first execution
启动、测试、模式切换、网络切换、钱包检查和机器人都应走 duobao-backend/scripts/。