Skip to main content
The SAFIA admin dashboard is a lightweight web interface that runs locally alongside your bot. It gives you a real-time view into usage activity, lets you control which Telegram users can access SAFIA, and provides tools for uploading knowledge base documents — all from your browser without touching the command line.
Always set ADMIN_PASSWORD in your .env before exposing the dashboard. If ADMIN_PASSWORD is left blank, the dashboard runs with no authentication — anyone with network access to port 5454 can view metrics, manage users, and modify your configuration.

Starting the dashboard

The dashboard starts automatically alongside the bot when you run safia start. You do not need to launch it separately.
safia start
To start only the dashboard manually (for example, during development):
uv run python admin_dashboard.py
Once running, open your browser and navigate to:
http://127.0.0.1:5454

Setting up authentication

The dashboard uses HTTP Basic Auth. Set your credentials in .env before starting:
ADMIN_USERNAME=admin
ADMIN_PASSWORD=your-strong-password
FLASK_SECRET_KEY=random-string
Your browser will prompt for a username and password the first time you visit. ADMIN_USERNAME defaults to admin if not set — only ADMIN_PASSWORD is required to enable authentication.
Generate a strong FLASK_SECRET_KEY with python -c "import secrets; print(secrets.token_hex(32))" and paste the result into your .env.

Dashboard metrics

When you open the dashboard at /, you see four summary cards reflecting activity for the current day:

Total Users

The total number of registered Telegram accounts, plus how many were active in the last 24 hours and the average message count per user.

Messages Today

The number of messages SAFIA has processed since midnight UTC.

Tokens Today

The total LLM tokens consumed today across all user conversations.

New Today

New user registrations recorded on the most recent day.
Below the summary cards, two 30-day charts give you a historical view:
  • Active vs New Users — a line chart comparing daily active users against new registrations over the past 30 days.
  • Daily Token Usage — a bar chart showing token consumption per day over the past 30 days.
Both charts update automatically each time you reload the page. The sidebar links to all four sections of the admin dashboard:
SectionPathPurpose
Overview/Usage metrics and 30-day activity charts
Users/usersView all registered users and their activity
Settings/settingsAccess control, allowlist, and .env editor
Knowledge/knowledgeUpload and manage knowledge base documents
All dashboard sections share the same HTTP Basic Auth session. You authenticate once per browser session and stay logged in until you close the browser or clear credentials.