Skip to content

Commit 13586d7

Browse files
committed
refactor backend into modular packages and fix data pipeline bugs
Backend: - Split monolithic database.go and handlers.go into focused modules (aggregate_queries, flow_queries, maintenance, schema, models, bandwidth_handlers, device_handlers, flow_handlers, stats_handlers, etc.) - Add poll-time pre-aggregation (node pairs, bandwidth, traffic stats) with atomic commit via CommitPollResults transaction - Add rolling in-memory cache for sub-second recent data queries - Add device cache with periodic refresh from Tailscale API - Add rate limiting middleware with per-IP token bucket - Chunked backfill: split large time ranges into 30-min chunks to avoid API timeouts, with per-chunk progress commit - Skip raw flow log insertion for historical data during backfill to prevent database bloat (was causing 2GB+ growth) - Run cleanup before initial poll to purge stale data on startup - Fix timestamp skew in log_converter: prefer "start" over "logged" - Fix rolling cache UniquePairs: use max() instead of replace - Fix nil bandwidth slice serializing as JSON null instead of [] - Add proper 405 handling for method-not-allowed routes - Add schema tests and handler tests Frontend: - Smart header stats: fall back to stats store when network data unavailable (fixes zero stats on analytics page) - BandwidthChart: abort stale fetch to prevent race condition - FilterPanel: improved layout and responsiveness - TimelineSlider: better touch/drag handling - LogViewer/PortDetails: enhanced formatting and display - Stats store: replace manual subscriptions with svelte get() - Network store: refactored data flow and error handling - Analytics page: improved chart layouts and interactions
1 parent 6e0386f commit 13586d7

48 files changed

Lines changed: 5878 additions & 3630 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ frontend/dist/
1010
backend/frontend/dist/
1111
backend/tsflow-backend
1212
backend/tsflow
13+
backend/tsflow-server*
1314

1415
# Environment variables
1516
.env

0 commit comments

Comments
 (0)