mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 07:56:37 +08:00
9a9e83dda0
Add comprehensive documentation of project conventions including: - Encryption patterns (AES with node secret PSK) - API envelope structure (code, msg, data, ts) - Build peculiarities (minify: false, rolldown-vite, UPX compression) - Unique styles (flat monorepo, asymmetric Go layout, hybrid frontend mode) - Module boundaries and anti-patterns - Large file hotspots and code map references Updated 7 AGENTS.md files across root and submodules.
1.6 KiB
1.6 KiB
BACKEND HTTP HANDLER KNOWLEDGE BASE
Generated: Sun Feb 15 2026
OVERVIEW
HTTP request handlers for FLVX Admin API. Core business logic layer. Stack: Go 1.23, net/http, raw SQL (no ORM).
STRUCTURE
handler/
├── handler.go # Main Handler struct, login/captcha, job scheduling
├── control_plane.go # Node control plane API (add/delete/list)
├── federation.go # Federation/cluster sync API
├── flow_policy.go # Traffic policy API
├── jobs.go # Background job management (sync, cleanup)
├── mutations.go # CRUD for users, tunnels, forwards (largest: 100k+ LOC)
└── upgrade.go # System upgrade API
WHERE TO LOOK
| Task | Location | Notes |
|---|---|---|
| User/Tunnel CRUD | mutations.go |
Largest file; all create/update/delete ops |
| Login/Captcha | handler.go |
Login flow, captcha verification |
| Federation Sync | federation.go |
Panel-to-panel sync |
| Traffic Policies | flow_policy.go |
Flow limiting, quota management |
| Background Jobs | jobs.go |
Scheduled sync/cleanup tasks |
CONVENTIONS
- Inherits from parent: raw SQL, no ORM, JWT in Authorization header.
- Large files expected (
mutations.go3716 LOC - central mutation hub). - Uses
sqlite.Repositoryfor DB access viarepo.XXX()methods. - Domain-driven file split: one file per functional area (federation, jobs, etc.).
ANTI-PATTERNS
- Do NOT add ORM here - uses raw SQL throughout.
- Do NOT change handler signatures without updating router.go.
COMMANDS
cd go-backend
go test ./internal/http/handler/...