How joaoptoaldo/analytics-dashboard works
This is a sales-analytics dashboard: users browse dashboard, analytics, reports, and product listings, with filters and periodic API refreshes; the backend serves aggregated metrics and product data from SQL storage. A separate protected endpoint synchronizes external products. The README documents additional analytics endpoints and deployment database options, but several routers and services were not sampled, so their internal calls are not expanded beyond indexed references.
Main entry points: main.py API routes · App.tsx Route shell · db.py SQL database · use-dashboard.ts Dashboard data hook
Components 21
Dashboard UI
- Route shell
src/App.tsx - Dashboard view
src/Dashboard.tsx - Analytics view
src/pages/Analytics.tsx - Reports view
src/pages/Reports.tsx - Users view
src/pages/Users.tsx - Settings view
src/pages/Settings.tsx - Dashboard data hook
hooks/use-dashboard.ts - API client
lib/api.ts
API and analytics
- API routes
backend/main.py - Analytics routes
backend/routers/analytics.py - Analytics calculations
backend/services/analytics.py - Revenue metric engine
backend/metrics_engine.py - Product routes
backend/routers/products.py
Product data
- Product queries
backend/services/products.py - Product records
backend/models/product.py - SQL database
backend/db.py
External synchronization
- External product routes
backend/routers/external.py - Protected sync route
backend/routers/external_sync.py - External sync service
backend/services/external.py
Other components
- Dashboard user
- External product source
Connections 28
- Dashboard user → Route shell: opens
src/App.tsx - Route shell → Dashboard view: routes to
src/App.tsx - Route shell → Analytics view: routes to
src/App.tsx - Route shell → Reports view: routes to
src/App.tsx - Route shell → Users view: routes to
src/App.tsx - Route shell → Settings view: routes to
src/App.tsx - Dashboard view → Dashboard data hook: requests data
src/Dashboard.tsx - Reports view → Dashboard data hook: requests data
src/pages/Reports.tsx - Users view → Dashboard data hook: requests data
src/pages/Users.tsx - Dashboard data hook → API client: fetches through
hooks/use-dashboard.ts - API client → API routes: calls API
README.md - API routes → SQL database: queries
backend/main.py - API routes → Product records: filters records
backend/main.py - API routes → Analytics routes: registers routes
backend/main.py - API routes → Product routes: registers routes
backend/main.py - API routes → External product routes: registers routes
backend/main.py - API routes → Protected sync route: registers routes
backend/main.py - API routes → Revenue metric engine: imports module
backend/main.py - Analytics routes → Analytics calculations: delegates to
- Product routes → Product queries: delegates to
backend/routers/products.py - Product queries → SQL database: queries
backend/services/products.py - Product queries → Product records: queries
backend/services/products.py - Revenue metric engine → SQL database: opens session
backend/metrics_engine.py - Revenue metric engine → Product records: aggregates
backend/metrics_engine.py - Protected sync route → External sync service: delegates to
backend/routers/external_sync.py - Protected sync route → SQL database: tracks sync state
backend/routers/external_sync.py - External product source → External sync service: supplies products
- External sync service → SQL database: writes products
backend/services/external.py