Dashboard

Real-time stats, system health gauges, and activity feed — all updating automatically.

Real-Time Stats Cards

Entity counts, total routes, server uptime, and cumulative request totals — displayed as prominent stat cards at the top of the dashboard.

Health Gauges

Visual arc gauges for memory usage, database size, and average response time. Color-coded green, amber, or red based on thresholds.

Activity Feed

A chronological feed of recent entity operations — creates, updates, deletes — showing which entity was affected and when.

Auto-Refresh

All dashboard data refreshes every 5 seconds via API polling. No manual reload needed — the numbers stay current.

How It Works

The dashboard fetches live data from three internal API endpoints and renders them into cards, gauges, and feeds.

Four Stat Cards

The top row shows four key numbers, each updated on every refresh cycle:

  • Entities — Total entity types registered in the app (e.g., User, Post, Comment)
  • Routes — Total HTTP routes (pages + API routes combined)
  • Uptime — Time since the FLIN server process started, formatted as hours and minutes
  • Requests — Cumulative request count tracked by atomic counters (excludes /_flin/* admin routes)

Three Health Gauges

Each gauge renders as a semicircular arc that fills from 0% to 100%, with color transitions:

  • Memory Usage — Process RSS memory as a percentage of available system memory
  • Database Size — Combined size of .flindb/ (WAL + data files + backups)
  • Response Time — Average response time in milliseconds across all tracked requests

API Endpoints

The dashboard consumes these three endpoints, all authenticated via admin session token.

MethodEndpointDescription
GET/_flin/api/statsEntity count, route count, uptime seconds, total requests
GET/_flin/api/healthMemory usage, database size, average response time
GET/_flin/api/activityRecent entity operations (create, update, delete) with timestamps
GET/_flin/api/metricsDetailed metrics: memory, DB size, uptime, request counters

Under the Hood

Metrics are tracked using lock-free atomic counters in Rust. Every request is measured and recorded.

src/server/metrics.rs
// Atomic counters — zero-cost per request
static TOTAL_REQUESTS: AtomicU64 = AtomicU64::new(0);
static TOTAL_ERRORS: AtomicU64 = AtomicU64::new(0);
static TOTAL_RESPONSE_TIME_US: AtomicU64 = AtomicU64::new(0);

// Per-route stats (HashMap behind LazyLock)
static ROUTE_STATS: LazyLock<Mutex<HashMap<String, RouteStat>>>;

// Called after every response is written
pub fn record_request(method: &str, path: &str, status: u16, duration_us: u64) {
    TOTAL_REQUESTS.fetch_add(1, Ordering::Relaxed);
    // ...normalize route, update per-route stats
}

No Grafana. No Prometheus. No Setup.

Most frameworks require you to set up Grafana, Prometheus, or a third-party monitoring dashboard. With FLIN, you get real-time stats, health gauges, and an activity feed the moment your app starts. Every FLIN app is observable from day one — open /_flin and everything is there.