====== API Design ====== Traffic Elf uses simple PHP-based JSON APIs. ===== Design Goals ===== * Simple endpoints * Readable JSON * No framework dependency (initially) ----- ===== Example: Clients API ===== Endpoint: /api/clients.php query("SELECT * FROM clients ORDER BY name"); echo json_encode($stmt->fetchAll()); ----- ===== Example: Campaigns API ===== Endpoint: /api/campaigns.php query("SELECT * FROM campaigns ORDER BY start_date DESC"); echo json_encode($stmt->fetchAll()); ----- ===== Frontend Usage ===== fetch('/api/clients.php') .then(res => res.json()) .then(data => renderGrid(data));