How Weborn is built and how it works
Every request follows this path from browser to application:
weborn/
main.py # FastAPI app + lifespan + mounts
config.py # Paths, VERSION, settings
db.py # SQLite schema, queries, settings
auth.py # JWT encode/decode, PAM, idle lock
csrf.py # CSRF token middleware (ASGI)
ratelimit.py # Token bucket rate limiter
icons.py # 57+ Heroicons v2 outline icons
ui.py # Jinja2 env, icon() global
weborn.py # CLI entry point (argparse)
executors/
__init__.py # LocalExecutor, DryRunExecutor, WSLExecutor
managers/
apps.py # AppManager (create/delete/start/stop)
nginx.py # NginxManager (sites, SSL, cache)
apache.py # ApacheManager (ports, virtual hosts)
db.py # DBManager (MariaDB, PostgreSQL)
email.py # EmailManager (Postfix, Dovecot, Rspamd)
security.py # SecurityManager (UFW, Fail2Ban, ClamAV)
routers/
dashboard.py # Dashboard overview
apps.py # App CRUD, monitor, process config
addons.py # Addon store (39 addons)
domains.py # Domain & DNS management
email.py # Email stack management
security.py # Firewall, Fail2Ban, ClamAV
... # 20+ route modules
templates/ # Jinja2 HTML templates
static/ # CSS, JS, icons
addons/ # 39 addon manifests (.json)
| Mode | Description | Used When |
|---|---|---|
local | Direct subprocess execution with sudo | Running on Linux server (production) |
wsl | Executes commands via WSL distro | Development on Windows |
dry-run | Simulates commands, returns mock output | Windows dev without WSL |
Login Request
|
+--> Check panel DB (PBKDF2-SHA256 hash)
| |
| +--> Match? --> Create JWT --> Set cookie --> Redirect
| |
| +--> No match?
| |
| +--> PAM fallback (su -c "password" user)
| |
| +--> Success? --> Create shadow user --> JWT --> Redirect
| |
| +--> Fail --> "Username atau password salah"
| Table | Purpose |
|---|---|
users | Panel admin accounts (PBKDF2 hashes) |
sessions | Active JWT sessions |
apps | Deployed applications (type, command, status) |
domains | Domain configurations + SSL status |
proxies | Reverse proxy configurations |
dns_records | DNS record configurations |
crons | Scheduled tasks |
settings | Panel settings + secret key |
login_logs | Audit trail (IP, timestamp, success/fail) |
login_attempts | Rate limiting counter per IP |