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`);
/ β¦