LIVE v0.0.1 commit 7f76a14

ดูแอดแบบ Realtime
ด้วย Fastify + TS

ดึงข้อมูลโฆษณา Facebook สดผ่าน Graph API
ROAS, ยอดขาย, แชท, Pareto, Heatmap, Budget Pacing — ครบในที่เดียว

20+
API Endpoints
9
Analytics
3
Cache Tiers
RBAC
Admin/Analyst/Viewer
AES
256-GCM Tokens
เริ่มต้นใช้งาน

ทุกอย่างที่ต้องการ อยู่ที่นี่

Developer Reference

API Endpoints

GET /health Health check — always 200 OK
GET /ready Readiness — DB backend + cache stats
GET /metrics Prometheus metrics (auth_login_success, live_cache_*, etc.)
GET /bridge/status System health summary for frontend
POST /auth/login Login with username/password → session cookie
POST /auth/logout Logout & clear session
POST /auth/change-password Change own password (require login)
GET /auth/token-profiles List encrypted token profiles (multi-account)
POST /live/accounts Fetch FB ad accounts (live from Graph API)
POST /live/dashboard Build dashboard bundle — since/until/scope
GET /demo/login Login UI (HTML)
GET /demo/live-dashboard Live Dashboard UI (HTML)
GET /demo/api-guide Interactive API testing guide
GET /demo/change-password Change password UI

🔒 เฉพาะ endpoint ที่มี LOGIN_REQUIRED=true เท่านั้นที่ต้อง login
📐 ดู ADR-0001 Architecture →

ภายใต้ hood

Stack & Architecture

Fastify 4.26 + tsx
เร็วที่สุดในบรรดา Node.js web framework — TypeScript runtime ผ่าน tsx, ไม่ต้อง build step
🗄️
SQLite + MySQL
Dev = SQLite (better-sqlite3 12), Prod = MySQL (mysql2) — auto-switch ตาม DATABASE_URL
🔐
AES-256-GCM
Token encryption at rest + env-decryption + log redaction — ไม่มี token หลุดใน error logs
📊
L1 + L2 Cache
In-memory L1 + SQLite/MySQL L2 + singleflight — ลดการยิง Graph API ซ้ำ
📈
Prometheus Metrics
auth_login_success, live_cache_hit_*, ingest_rows, ingest_ms_total — scrape ด้วย Grafana/Prometheus
🛡️
RBAC + Rate Limit
Admin/Analyst/Viewer roles + TTL per role + login rate limit + CSRF origin check + security headers