Network management platform for configuring switches and routers, tracking MACs/ARPs/interfaces, and managing credentials. Built on FastAPI + SQLModel + PostgreSQL (backend) and React + Chakra UI + TanStack Router/Query (frontend). Deployed via Docker Compose.
backend/ FastAPI app (Python)
frontend/ React + Vite + Chakra UI + TanStack Router
mcp_server/ MCP server exposing the REST API as tools (stdio, local process)
docker-compose.yml — local dev (with docker-compose.override.yml)
docker-compose.traefik.yml — production
| Path | Purpose |
|---|---|
models.py |
All SQLModel DB models + Pydantic response schemas |
api/routes/ |
FastAPI route handlers (one file per domain) |
api/deps.py |
CurrentUser, SessionDep, get_current_active_superuser — accepts JWT Authorization: Bearer or X-API-Key header |
api/main.py |
Router registration |
crud/ |
DB query functions called from routes |
core/config.py |
Pydantic Settings (reads .env) |
core/security.py |
create_access_token(subject, expires_delta) — both args required |
alembic/versions/ |
Migration chain: e2412789 → 65f8c8c4 → f0418d9e → a3f1b2c4 → b4c5d6e7 → c1d2e3f4 → d1e2f3a4 → e2f3a4b5 → f4a5b6c7 → a7b8c9d0 → 8c234143 → b9d0e1f2 → c5d6e7f8 → d6e7f8a9 → e8f9a0b1 → f9a0b1c2 → a1b2c3d4 → 48a528e5 (head) |
automation/ |
Nornir/NAPALM/Netmiko tasks for live device config |
| Path | Purpose |
|---|---|
client/ |
Auto-generated OpenAPI client — edit manually only when backend is not running |
routes/_layout/ |
Protected pages (admin, devices, interfaces, logs, credentials, groups, settings…) |
routes/ (root) |
Public pages: login, oauth-callback, recover/reset-password |
components/ |
Grouped by domain: Admin/, Auth/, Common/, Devices/, Interfaces/, etc. |
routeTree.gen.ts |
Auto-generated by Vite TanStack Router plugin — update manually when tsc runs before Vite |
- All models live in
models.py(DB table models + Public response schemas) - Add
action: str, Field(index=True)and indexes on columns used for filtering write_audit_log(session, username, action, *, client_ip, message, severity)incrud/audit.py— call after every write operationRequestparam needed to getrequest.client.hostfor audit logs- Endpoints using
dependencies=[Depends(get_current_active_superuser)]can also acceptcurrent_user: CurrentUseras a param for audit logging - New migration:
down_revision = "48a528e5d66b"(current head)
- Generated client in
frontend/src/client/— when backend changes and Docker is not running, updatemodels.tsandservices.tsmanually - TanStack Query:
useSuspenseQueryinside<Suspense>for data fetching - Chakra UI — never use
defaultCheckedon Checkbox with react-hook-form; usedefaultValuesinstead OpenAPI.TOKENisstring | Resolver<string>— checktypeofbefore calling- Route files use
createFileRoute()— new public routes need manual entry inrouteTree.gen.tsif Vite plugin hasn't run
# Start all services
docker compose up -d
# Apply migrations
docker compose exec backend alembic upgrade head
# Regenerate frontend client (when backend is running)
cd frontend && npm run generate-client
# Backend logs
docker compose logs -f backend
# Frontend build
docker compose exec frontend npm run buildUsers can authenticate via:
- Email + password (JWT HS256)
- Google OAuth2 (
GOOGLE_CLIENT_ID/SECRET) - Microsoft Azure AD (
MICROSOFT_CLIENT_ID/SECRET/TENANT_ID) - Keycloak OIDC (
KEYCLOAK_CLIENT_ID/SECRET/SERVER_URL/REALM) - Passkey/WebAuthn (
WEBAUTHN_RP_ID/RP_NAME/ORIGIN)
OAuth state + WebAuthn challenges stored in signed itsdangerous cookies (stateless).
| Table | Description |
|---|---|
user |
Users with optional hashed_password, password_login_enabled flag |
apikey |
Service-account API keys (bcrypt-hashed) for machine clients like the MCP server |
oauthaccount |
OAuth provider links per user |
webauthncredential |
Passkey credentials per user |
auditlog |
Audit trail for all write operations |
device |
Network devices (hostname, IP, platform, vendor…) |
interface |
Device interfaces with VLAN/duplex/speed config |
macaddress |
MAC address table entries |
arp |
ARP table entries |
ipinterface |
Layer 3 interface assignments |
group |
Device groups for bulk operations |
credential |
SSH/key credentials for device access |
backend/app/automation/ uses Nornir with NAPALM/Netmiko drivers. Supported platforms: Cisco IOS, Cisco NX-OS, Juniper JunOS. Tasks: get interfaces, update interface config, shutdown interface, update running config.
Production uses Traefik reverse proxy with automatic HTTPS. See docker-compose.traefik.yml. GitHub Actions CI in .github/workflows/.