Files
FabledSteward/docs/reference/code-map.md
T
bvandeusen 230b542015 feat: rename to FabledScryer, multi-dashboard system, plugin management, branding
- Rename package fablednetmon → fabledscryer throughout
- Multi-dashboard: ownership, per-user defaults, HTMX edit (add/remove/reorder)
- Read-only share tokens scoped to individual dashboards
- Dashboard edit is HTMX-driven (no page reloads)
- Plugin management system: remote catalog, download/install, hot-reload, in-app restart
- plugin_index.py: fetch/cache remote index.yaml; default URL → bvandeusen/fabledscryer-plugins
- plugin_manager.py: download_and_install_plugin, hot_reload_plugin, restart_app
  - ZIP extraction handles GitHub archive formats (name-v1.0.0/, name-main/)
- Settings split into tabbed sections: General, Notifications, Ansible, Plugins
- Plugins tab: catalog browser (HTMX), install/activate/update/restart actions
- UI/branding: dark palette (#07071a), crystal ball SVG logo, animated star field,
  Libertinus Serif applied to headings, nav, labels, and section titles
- Widget registry (core/widgets.py) for dashboard plugin integration
- UPS widget.html (dashboard card) and settings/_tabs.html include
- Migrations 0005–0008: dashboards, is_default, ownership, share tokens
- docs/plugins/: writing-a-plugin.md updated with publishing guide,
  index.yaml.example template for fabledscryer-plugins repo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 18:27:56 -04:00

5.7 KiB

Code Map

Quick reference for where key functions, models, and entry points live in the codebase.


Application Bootstrap

What File Function / Class
App factory fabledscryer/app.py create_app()
CLI entry point fabledscryer/cli.py main()
Bootstrap config loading fabledscryer/config.py load_bootstrap()
Secret key resolution fabledscryer/config.py _resolve_secret_key()
DB engine init fabledscryer/database.py init_db()
Core migrations fabledscryer/core/migration_runner.py run_core_migrations()
Plugin migrations fabledscryer/core/migration_runner.py run_plugin_migrations()
Core task registration fabledscryer/app.py _register_core_tasks()
Scheduler loop fabledscryer/core/scheduler.py start_scheduler()

Settings System

What File Function
All defaults fabledscryer/core/settings.py DEFAULTS dict
Read a setting fabledscryer/core/settings.py get_setting(session, key)
Write a setting fabledscryer/core/settings.py set_setting(session, key, value)
Read all settings fabledscryer/core/settings.py get_all_settings(session)
Sync load at startup fabledscryer/core/settings.py load_settings_sync(db_url)
Extract SMTP dict fabledscryer/core/settings.py to_smtp_cfg(settings)
Extract webhook dict fabledscryer/core/settings.py to_webhook_cfg(settings)
Extract Ansible dict fabledscryer/core/settings.py to_ansible_cfg(settings)
Extract plugins dict fabledscryer/core/settings.py to_plugins_cfg(settings)

Plugin System

What File Function
Plugin loading fabledscryer/core/plugin_manager.py load_plugins(app)
ScheduledTask dataclass fabledscryer/core/scheduler.py ScheduledTask
Task runner fabledscryer/core/scheduler.py start_scheduler(tasks)

Alert Pipeline

What File Function
Write metric + evaluate alerts fabledscryer/core/alerts.py record_metric(session, source_module, resource_name, metric_name, value)
Init alert pipeline fabledscryer/core/alerts.py init_alerts(app)
Rule evaluation fabledscryer/core/alerts.py _evaluate_rule() (internal)
Notification dispatch fabledscryer/core/alerts.py _dispatch_notification() (internal)
Email + webhook send fabledscryer/core/notifications.py dispatch_notifications()

Monitors

What File Function
Ping a host fabledscryer/monitors/ping.py ping_check(host, session)
DNS check a host fabledscryer/monitors/dns.py dns_check(host, session)
Data cleanup fabledscryer/core/cleanup.py run_cleanup(app)

Auth

What File Function / Class
Role-based access decorator fabledscryer/auth/middleware.py @require_role(UserRole.X)
Login / session handling fabledscryer/auth/middleware.py login_user(), logout_user()
User count (for first-run) fabledscryer/auth/middleware.py get_user_count(app)

Data Models

Model File Table
Host fabledscryer/models/hosts.py hosts
PingResult fabledscryer/models/monitors.py ping_results
DnsResult fabledscryer/models/monitors.py dns_results
AlertRule fabledscryer/models/alerts.py alert_rules
AlertState fabledscryer/models/alerts.py alert_states
AlertEvent fabledscryer/models/alerts.py alert_events
PluginMetric fabledscryer/models/metrics.py plugin_metrics
AnsibleRun fabledscryer/models/ansible.py ansible_runs
User fabledscryer/models/users.py users
AppSetting fabledscryer/models/settings.py app_settings
TraefikMetric plugins/traefik/models.py traefik_metrics
SQLAlchemy Base fabledscryer/models/base.py (shared declarative base)

HTTP Routes

URL pattern Blueprint File
/ (dashboard) dashboard_bp fabledscryer/dashboard/routes.py
/auth/login, /auth/logout auth_bp fabledscryer/auth/routes.py
/hosts/ hosts_bp fabledscryer/hosts/routes.py
/ping/, /ping/rows, /ping/settings ping_bp fabledscryer/ping/routes.py
/dns/, /dns/rows dns_bp fabledscryer/dns/routes.py
/alerts/ alerts_bp fabledscryer/alerts/routes.py
/ansible/ ansible_bp fabledscryer/ansible/routes.py
/settings/ settings_bp fabledscryer/settings/routes.py
/plugins/traefik/, /plugins/traefik/widget traefik_bp plugins/traefik/routes.py
/health (inline) fabledscryer/app.py

Templates

Template Purpose
fabledscryer/templates/base.html Layout, navigation, full CSS design system
fabledscryer/templates/dashboard/index.html Dashboard with stat strip and widget grid
fabledscryer/templates/ping/rows.html HTMX fragment: ping pill rows (shared by dashboard and /ping/)
fabledscryer/templates/ping/index.html Full /ping/ page
fabledscryer/templates/dns/rows.html HTMX fragment: DNS status rows
fabledscryer/templates/dns/index.html Full /dns/ page
plugins/traefik/templates/traefik/widget.html HTMX fragment: Traefik dashboard widget
plugins/traefik/templates/traefik/index.html Full Traefik detail page

Migrations

Location Covers
fabledscryer/migrations/versions/ Core schema (hosts, users, monitors, alerts, app_settings)
plugins/traefik/migrations/versions/ traefik_metrics table
alembic.ini Alembic config; version_locations lists all migration directories