Skip to content
Snehit70Public

About

Historical system stats monitor for Linux laptops

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

93 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LapStat

LapStat is a historical Linux laptop monitor built around a simple idea: sample the machine every minute, keep the data in SQLite, and make the long view pleasant to read.

The current dashboard is styled as a quiet editorial interface called "Field Almanac" rather than a traditional real-time ops console.

Screenshots

Field Almanac - overview page

Field Almanac - performance page

Field Almanac - network page

Field Almanac - apps page

What it does

  • Collects CPU, load, memory, disk, battery, thermal, process, and active-window data on a fixed interval.
  • Stores snapshots locally in ~/.local/share/lapstat/stats.db.
  • Serves a Next.js dashboard with overview, performance, network, and apps views.
  • Supports optional per-app network tracking through the separate eBPF helper in apps/collector/ebpf/net_monitor.py.

Monorepo layout

lapstat/
├── apps/
│   ├── collector/   # Bun collector that writes system snapshots
│   └── web/         # Next.js dashboard and API routes
├── packages/
│   └── db/          # Shared Drizzle schema and runtime-specific DB clients
├── scripts/         # Setup and local development helpers
└── docs/            # Living project documentation

Runtime model

  • apps/collector runs on Bun and writes to SQLite with bun:sqlite.
  • apps/web runs on Next.js and reads the same SQLite file through @libsql/client.
  • packages/db keeps the schema and exports separate clients for Bun and Node runtimes.

Quick start

cd ~/projects/lapstat
bun install
bun run db:init
bun run dev

Open http://localhost:3456.

bun run dev uses scripts/dev.sh to start both apps together. You can also run them separately:

bun run collector:dev
bun run web:dev

Common commands

# Local development
bun run dev
bun run collector:dev
bun run web:dev

# Production-style builds
bun run build
bun run collector:start
bun run web:start

# Database
bun run db:init
bun run db:push
bun run db:studio

Requirements

  • Linux
  • Bun
  • SQLite-compatible local filesystem access
  • hyprctl if you want active-window tracking
  • Python + BPF/BCC tooling if you want per-app network capture

Configuration

LapStat reads configuration from environment variables:

Variable Default Purpose
LAPSTAT_DB_PATH ~/.local/share/lapstat/stats.db SQLite database location
LAPSTAT_INTERVAL_MS 60000 Collection cadence
LAPSTAT_TOP_PROCESSES 10 Number of top processes stored per sample
LAPSTAT_RAW_RETENTION_DAYS 7 Raw retention setting
LAPSTAT_HOURLY_RETENTION_DAYS 30 Hourly retention setting
LAPSTAT_DAILY_RETENTION_DAYS 90 Daily retention setting
LOG_LEVEL info Collector logging level

Notes on current scope

  • The collector currently writes raw snapshot tables directly.
  • Hourly and daily summary tables exist in the schema, but no in-repo scheduled aggregation job is wiring them up yet.
  • Per-app network analytics depend on the external eBPF helper; without it, the network dashboard still shows interface totals.

Documentation

About

Historical system stats monitor for Linux laptops

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages