mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
5.8 KiB
5.8 KiB
PROJECT KNOWLEDGE BASE
Generated: Thu Feb 19 2026
Commit: 137c34e
Branch: main
Tag: 2.1.4-rc2
OVERVIEW
FLVX (formerly Flux Panel) is a traffic forwarding management system built on a forked GOST v3 stack. It ships as a Go-based admin API (SQLite) + Vite/React UI + Go forwarding agent, with optional mobile WebView wrappers.
STRUCTURE
./
├── go-gost/ # Go forwarding agent (forked gost + local x/)
│ └── x/ # Local fork of github.com/go-gost/x (replace => ./x)
├── go-backend/ # Go Admin API (GORM + SQLite/PostgreSQL, net/http)
├── vite-frontend/ # React/Vite dashboard (shadcn bridge + Tailwind v4)
├── docker-compose-v4.yml # Panel deploy (IPv4-only bridge)
├── docker-compose-v6.yml # Panel deploy (IPv6-enabled bridge)
├── panel_install.sh # Panel installer/upgrader (downloads compose)
├── install.sh # Node installer/upgrader (downloads gost binary)
└── .github/workflows/ # CI: build/push images + release artifacts
WHERE TO LOOK
| Task | Location | Notes |
|---|---|---|
| Deploy (Docker) | docker-compose-v4.yml |
Env: JWT_SECRET, BACKEND_PORT, FRONTEND_PORT |
| Deploy (IPv6) | docker-compose-v6.yml |
Same as v4 + IPv6-enabled bridge |
| Panel install | panel_install.sh |
Picks v4/v6, generates JWT_SECRET, downloads compose |
| Node install | install.sh |
Installs /etc/flux_agent/flux_agent + writes config.json/gost.json + systemd flux_agent.service |
| Admin API | go-backend/ |
Go Admin API (SQLite) |
| Web UI | vite-frontend/ |
React/Vite dashboard (shadcn bridge + Tailwind v4) |
| UI Compatibility | vite-frontend/src/shadcn-bridge/heroui/ |
HeroUI-compatible API wrappers backed by shadcn/radix |
| Theme Tokens | vite-frontend/src/styles/tailwind-theme.pcss |
Tailwind v4 @theme inline semantic color mapping |
| Go Agent | go-gost/ |
Forwarding agent (forked gost + local x/) |
| Go Core | go-gost/x/ |
Handlers/listeners/dialers + management API |
CODE MAP
| Symbol | Type | Location | Role |
|---|---|---|---|
flvx |
Project | . |
Root directory |
main |
Func | go-backend/cmd/paneld/main.go |
Backend Entry |
App |
Component | vite-frontend/src/App.tsx |
Frontend Entry |
main |
Func | go-gost/main.go |
Agent Entry |
CONVENTIONS
- Auth:
Authorizationheader carries the raw JWT token (noBearerprefix) betweenvite-frontend/andgo-backend/. - Module Fork:
go-gost/usesreplace github.com/go-gost/x => ./xandgo-gost/x/is also its own Go module. - Encryption: Agent-to-panel communication uses AES encryption with node
secretas PSK. - API Envelope: All REST responses follow
{code, msg, data, ts}structure (code 0 = success). - Frontend UI Layer: Import UI primitives from
src/shadcn-bridge/heroui/*(legacy-compatible facade), not direct@heroui/*packages. - Tailwind v4 Semantic Colors:
src/styles/globals.cssmust importsrc/styles/tailwind-theme.pcss; removing it breaks semantic classes likebg-primary,text-foreground, andborder-input.
ANTI-PATTERNS (THIS PROJECT)
- DO NOT EDIT generated protobuf output:
go-gost/x/internal/util/grpc/proto/*.pb.go,go-gost/x/internal/util/grpc/proto/*_grpc.pb.go. - DO NOT ADD
Bearerprefix to Authorization header - expects raw JWT token. - DO NOT MODIFY
install.shorpanel_install.shlocally - CI overwrites these on release. - DO NOT let backend handlers call
repo.DB()directly — add a Repository method instead. - DO NOT ADD frontend tests - project has no test infrastructure (Vitest/Jest not configured).
- DO NOT REINTRODUCE
@heroui/*or@nextui-org/*dependencies; migration is now shadcn bridge-based.
COMMANDS
# Panel (Docker)
docker compose -f docker-compose-v4.yml up -d
docker compose -f docker-compose-v6.yml up -d
# Release-based install scripts
./panel_install.sh
./install.sh
# Local dev (per subproject)
(cd go-backend && make build)
(cd vite-frontend && npm run dev)
(cd go-gost && go run .)
UNIQUE STYLES
- Flat Monorepo: Language-prefixed dirs (
go-backend,go-gost,vite-frontend) instead ofapps//libs/. - Asymmetric Go Layout:
go-backendfollowscmd/<app>/main.gowhilego-gostusesroot/main.go. - Frontend Hybrid Mode:
App.tsxdetects "H5 mode" (mobile WebView) vs desktop, dictating layout strategy.
NOTES
- LSP servers are not installed in this environment (gopls/jdtls/typescript-language-server); rely on grep-based navigation.
vite-frontend/vite.config.tssetsminify: falseand disables treeshake; expect larger bundles.vite-frontendusesrolldown-vite(experimental Rust bundler) instead of standard Vite.- Install scripts (
install.sh,panel_install.sh) self-delete after execution - common pattern in one-liner installs. - CI uses UPX compression (
--best --lzma) on Go binaries before release. - CI dynamically injects
PINNED_VERSIONinto install scripts and docker-compose files during releases. panel_install.shauto-detects IPv6 and modifies/etc/docker/daemon.jsonto enable IPv6 bridge.- Download proxy
https://gcode.hostcentral.cc/used for GitHub downloads in China/restricted environments. - Backend has contract tests in
go-backend/tests/contract/- frontend has no test infrastructure (Vitest/Jest not configured). analysis/3x-ui/contains a separate git repo for reference/comparison - not part of FLVX core.- PR
#144(shadcn migration) and PR#142(user-group binding) are merged intomain; release tag2.1.4-rc2points to commit137c34e. - Button visual parity relies on
vite-frontend/src/shadcn-bridge/heroui/button.tsxcolor mapping +vite-frontend/src/styles/tailwind-theme.pcsstoken export.