Local installation (development)¶
The project is split into two independent applications that communicate via a REST API:
backend/— FastAPI API (Python 3.14+)frontend/— Angular application (Node.js 22+)
Prerequisites¶
- Python 3.14+
- uv — the Python dependency/environment manager used by the project
- Node.js 22+ and npm
- WireGuard tools (
wireguard-tools,iptables) if you want to test the features that actually drive awg0interface (optional for developing the UI/API themselves)
Step 1 — Clone the repository¶
Step 2 — (Optional) Create a .env file¶
The backend reads a .env file at the repository root via pydantic-settings (config.py). It is not provided by default (not versioned) — create it if you want to override the default values:
Without SECRET_KEY, a random key is generated automatically and stored in DATA_DIR/secret_key (by default /var/lib/wireguard-ui/secret_key — set DATA_DIR locally if this path is not writable, see Environment variables).
Step 3 — Install and run the backend¶
Apply database migrations before the first launch (they are not run automatically by uvicorn, unlike the Docker image, which does so via docker/entrypoint.sh):
Then start the development server:
Command run from backend/
The entry module is app.main:app (not src.main:app): the command must be run with backend/ as the current directory, as in .vscode/launch.json and AGENTS.md.
On startup (lifespan function in main.py):
seed_initial_data()creates the roles, the initial admin, and the default settings if they don't already exist.- If
WIREGUARD_AUTOSTARTis enabled (default), the application attempts to write the WireGuard configuration and start the service (3 attempts, 5s apart) — this will fail silently (with a log warning) ifwg-quick/iptablesare not available in your local environment, without blocking the API startup.
The API is then available at http://localhost:8000, with self-hosted Swagger documentation at http://localhost:8000/api/docs (if SWAGGER_ENABLED=true).
Step 4 — Install and run the frontend¶
In a second terminal:
npm start runs ng serve --host 0.0.0.0. The Angular CLI automatically loads frontend/proxy.conf.json (declared in angular.json, serve.options.proxyConfig section), which redirects /api/* calls to http://localhost:8000:
{
"/api": {
"target": "http://localhost:8000",
"secure": false,
"changeOrigin": true
}
}
The interface is accessible at http://localhost:4200 and communicates with the backend started in step 3.
Step 5 — Run both at once (VS Code)¶
The repository provides a ready-to-use debug configuration:
.vscode/tasks.jsondefines theBackend: alembic upgrade head,npm: start - frontend, etc. tasks..vscode/launch.jsondefines the composite Full Stack configuration, which launches the backend (FastAPI, with a prior migration) and the frontend (Angular) simultaneously.
In VS Code: Run and Debug tab → select Full Stack → F5.
Checks before a Pull Request¶
# Backend
cd backend
uv run ruff check app
uv run ruff format --check app
uv run mypy app
# Frontend
cd ../frontend
npm run build
Command summary¶
sequenceDiagram
participant Dev
participant Backend as backend/ (uv)
participant Frontend as frontend/ (npm)
Dev->>Backend: uv sync --extra dev
Dev->>Backend: uv run alembic upgrade head
Dev->>Backend: uv run uvicorn app.main:app --reload
Note over Backend: seed_initial_data() + autostart WireGuard
Dev->>Frontend: npm ci
Dev->>Frontend: npm start
Note over Frontend: ng serve, proxy /api -> :8000