This repository contains the backend source code for a high-performance, cloud-native Fleet Management System (FMS). The system is designed for real-time vehicle telemetry data ingestion, storage, processing, and visualization. It's built to handle thousands of concurrent data points per second, ensuring reliability and low latency for modern fleet operations.
This project focuses on the core backend services. The frontend React application can be found in its own repository.
- High-Throughput Telemetry Ingestion: A robust API endpoint (
/api/telemetry) designed to handle high-velocity data from thousands of IoT devices simultaneously. - Real-Time Updates: Utilizes WebSockets (via Phoenix Channels) to push live data to connected clients, enabling real-time vehicle tracking and dashboard updates.
- Secure Authentication: Implements JWT-based authentication for all protected API endpoints and WebSocket connections.
- Core Fleet Management APIs: Provides RESTful APIs for managing:
- Vehicles
- IoT Devices
- API Authentication Tokens
- Role-Based Access Control (RBAC): Basic authorization distinguishing between
adminanduserroles to control access to resources. - Time-Series Database: Leverages TimescaleDB (a PostgreSQL extension) for efficient storage and querying of telemetry data.
The system is designed with a cloud-native architecture, separating concerns between the frontend, backend, and database.
- Backend (Elixir/Phoenix): This repository. A highly concurrent application that serves the API and manages WebSocket connections.
- Database (TimescaleDB/PostgreSQL): Stores all relational and time-series data. The schema is designed to link vehicles, IoT devices, and their telemetry efficiently.
- Frontend (React): A separate single-page application that consumes the API and displays data in real-time.
- IoT Clients (Python Simulation): Scripts to simulate IoT devices sending telemetry data to the backend.
The entire infrastructure is defined using Terraform for automated deployment on Amazon Web Services (AWS), utilizing services like EC2, ECS, ALB, S3, and Route 53.
For a detailed visual representation, see the Infrastructure Diagram.
- Backend: Elixir, Phoenix Framework
- Database: PostgreSQL with TimescaleDB Extension
- Infrastructure: AWS (EC2, ECS, ALB, S3, CloudFront, Route 53)
- Infrastructure as Code: Terraform
- Containerization: Docker
- CI/CD: GitHub Actions, Docker Hub
To get the backend running locally, you will need Elixir, Phoenix, PostgreSQL, and Docker installed.
- Clone the repository.
- Install dependencies.
- Set up the database:
- Ensure your local PostgreSQL server is running.
- Create the development database.
- Run migrations.
- Configure environment variables:
- You will need to create a configuration file for your environment variables. The project expects variables like
DATABASE_URL,SECRET_KEY_BASE, andJWT_SECRET.
- You will need to create a configuration file for your environment variables. The project expects variables like
- Start the Phoenix server.
The application will be running at http://localhost:4000.
- Implement anomaly detection and user notifications for events like high RPM or low fuel.
- Develop a full Python client script for physical IoT hardware.
- Expand API functionality with more granular query parameters and complete all CRUD operations.
- Integrate advanced analytics and reporting modules for historical data analysis.