South Africa Traffic API — JavaScript/Node.js client for real-time South African traffic data
# 🚦 i-traffic South Africa API Client
A comprehensive JavaScript/Node.js client for the South African i-traffic.co.za API. Features modular architecture with CLI tools, web interface, and complete endpoint coverage for real-time traffic data including alerts, cameras, events, message signs, and roadways.
## 🌟 Features
- **🏗️ Modular Architecture**: Clean separation with base client, endpoint modules, CLI interface, and web demo
- **📊 Complete API Coverage**: All 5 i-traffic endpoints (alerts, cameras, events, message signs, roadways)
- **🗺️ Embedded Maps**: Generate iframe embed codes for interactive traffic maps with customizable regions and layers
- **🖥️ CLI Tools**: Full command-line interface for all operations with formatted output
- **🌐 Web Interface**: Interactive browser-based demo application with map generation tools
- **🔧 Developer Friendly**: TypeScript-ready with comprehensive JSDoc comments
- **⚡ Performance Optimized**: Parallel requests, error handling, and timeout management
- **🔒 Secure**: Environment-based API key management
- **📱 Cross-Platform**: Works in Node.js and modern browsers
- **📚 Well Documented**: Complete API reference and usage examples
## 🚀 Quick Start
### Installation
```bash
# Clone the repository
git clone
github.com
cd south-africa-traffic-api-client
# Install dependencies
npm install
# Set up your API key
cp .env.example .env
# Edit .env and add your i-traffic API key
```
### Basic Usage
```javascript
import { environment } from './config/environment.js';
import { ITrafficClient } from './src/endpoints/index.js';
// Initialize client
const client = new ITrafficClient(environment.getClientConfig());
// Get traffic alerts
const alerts = await client.alerts.getAll();
console.log(`Found ${alerts.length} traffic alerts`);
// Get active cameras
const activeCameras = await client.cameras.getActive();
console.log(`Found ${activeCameras.length} active cameras`);
/ …