+------------------+
| WebUI |
| (SolidJS SPA) |
+--------+---------+
|
| HTTP/JSON
|
+------------------+ +--------+---------+ +------------------+
| ldfctl +----->+ ldfd +----->+ Storage |
| (CLI client) | HTTP | (API server) | | Local / S3 |
+------------------+ +----+----+----+---+ +------------------+
| | |
+----------+ | +----------+
| | |
+------+---+ +------+---+ +-------+------+
| SQLite | | Download | | Forge |
| Database | | Manager | | Registry |
+----------+ +----------+ +--------------+
LDF follows an API-first design. The server (ldfd) is a pure REST API that returns JSON. The WebUI and CLI client are separate consumers of this API.
ldf/
src/
ldfd/ # API server (Go, Gin)
api/ # HTTP handlers (11 modules)
core/ # Server bootstrap, config, middleware
auth/ # JWT service, user management
db/ # SQLite database, migrations, repositories
download/ # Download manager, version discovery
forge/ # Forge detection, version filtering
storage/ # Storage backends (local, S3)
docs/ # Generated OpenAPI spec
webui/ # Web interface (SolidJS, Bun, Vite)
ldfctl/ # CLI client (stub)
common/ # Shared Go libraries
cli/ # Cobra/Viper helpers
logs/ # Logging abstraction
paths/ # Path expansion utilities
version/ # Version info struct
tools/
docker/ # Dockerfile
docs/ # MkDocs documentation (this site)
ldfd uses the Gin web framework. The middleware stack processes requests in this order:
The API is organized into 11 handler modules under src/ldfd/api/:
| Module | Prefix | Endpoints | Description |
|---|---|---|---|
| base | /, /v1/ |
3 | Root discovery, health, version |
| auth | /auth/ |
5 | Login, logout, create, refresh, validate |
| roles | /v1/roles |
5 | Role CRUD for RBAC |
| distributions | /v1/distributions |
8 | Distribution lifecycle management |
| components | /v1/components |
12 | Component catalog and versions |
| sources | /v1/sources |
11 | Upstream source management |
| downloads | /v1/distributions/{id}/downloads |
7 | Download job management |
| artifacts | /v1/distributions/{id}/artifacts |
7 | Artifact upload, download, storage |
| settings | /v1/settings |
4 | Server configuration (root only) |
| forge | /v1/forge |
4 | Forge detection and filter preview |
| branding | /v1/branding |
4 | Logo and favicon management |
| langpacks | /v1/language-packs |
4 | Custom language pack management |
Total: 74 operations across 52 URL paths.
ldfd uses JWT (JSON Web Tokens) for authentication:
Authorization: Bearer <token> headerX-Subject-Token header is used in login/refresh responsesThe download manager handles fetching component sources from upstream:
The forge registry detects repository hosting platforms and extracts version information:
Artifact storage is pluggable:
~/.ldfd/artifacts)See Configuration for storage setup details.
ldfd uses an in-memory SQLite database with optional persistence:
src/ldfd/db/migrations/)database.path| Table | Purpose |
|---|---|
| distributions | Distribution definitions and config |
| components | Component catalog entries |
| upstream_sources | Source definitions (system + user) |
| source_versions | Discovered upstream versions |
| download_jobs | Download job state and progress |
| users | User accounts |
| roles | RBAC role definitions |
| settings | Runtime configuration overrides |
| language_packs | Custom UI translations |
The WebUI is a single-page application built with:
The WebUI communicates with ldfd over HTTP/JSON. It is not embedded in the server binary – it runs as a separate static asset served by ldfd or a reverse proxy.
The WebUI supports multiple languages via a translation system:
/v1/language-packs API.tar.xz, .tar.gz, or .xz archives containing JSON translation files