66 lines
2.3 KiB
Markdown
66 lines
2.3 KiB
Markdown
# radapi
|
|
|
|
SARLINK FreeRADIUS management stack: a REST API over the
|
|
FreeRADIUS schema and a web admin portal for it.
|
|
|
|
```
|
|
.
|
|
├── backend/ FastAPI REST API over the FreeRADIUS MySQL/MariaDB schema
|
|
└── frontend/ React + Vite admin portal (radui)
|
|
```
|
|
|
|
## Components
|
|
|
|
| Dir | What | Stack |
|
|
|-------------|----------------------------------------|--------------------------------------------|
|
|
| `backend/` | RESTful CRUD over FreeRADIUS tables | FastAPI, SQLAlchemy 2.0, PyMySQL, Pydantic v2 |
|
|
| `frontend/` | Admin UI for clients, devices and VLANs | React 19, Vite, TypeScript, Tailwind v4 |
|
|
|
|
Auth is **per-user**: sign in with a username and password and the backend issues
|
|
a session token (sent as `Authorization: Bearer`). Admins can additionally mint
|
|
revocable **`X-API-Key`** keys for scripts. On first deploy the API seeds a
|
|
default **`admin` / `admin`** login that must change its password on first
|
|
sign-in. Admins manage users, mint/revoke API keys, and view an activity log of
|
|
every user's actions; regular users get full RADIUS access but can only change
|
|
their own password.
|
|
|
|
## Quick start
|
|
|
|
### With Docker (dev)
|
|
|
|
Runs both services with hot-reload — the frontend on Vite, the backend on
|
|
`uvicorn --reload`, each with its source volume-mounted from the host.
|
|
|
|
```bash
|
|
cp backend/.env.example backend/.env # edit DB credentials
|
|
docker compose up --build # frontend :5173, backend :8000
|
|
```
|
|
|
|
The frontend proxies `/api/*` to the `backend` service over the compose
|
|
network, so log in at http://localhost:5173 with **`admin` / `admin`** on first
|
|
run, then change the password when prompted.
|
|
|
|
### Manual
|
|
|
|
**Backend** (see [`backend/README.md`](backend/README.md) for details):
|
|
|
|
```bash
|
|
cd backend
|
|
python3 -m venv venv
|
|
venv/bin/pip install -r requirements.txt
|
|
cp .env.example .env # edit DB credentials
|
|
venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000
|
|
```
|
|
|
|
**Frontend** (see [`frontend/README.md`](frontend/README.md) for details):
|
|
|
|
```bash
|
|
cd frontend
|
|
npm install
|
|
VITE_API_TARGET=http://127.0.0.1:8000 npm run dev # http://localhost:5173
|
|
```
|
|
|
|
Log in with **`admin` / `admin`** on first run (you'll be prompted to change the
|
|
password). In dev, Vite proxies `/api/*` to the backend so requests stay
|
|
same-origin.
|