A Rust telematics API built with Axum, SeaORM, Tokio, and Postgres.
- Rust 1.85 or newer
- Docker and Docker Compose
Start Postgres:
docker compose up -dCreate a local environment file:
cp .env.example .envApply database migrations:
DATABASE_URL=postgres://telematics:telematics@localhost:5455/telematics \
cargo run --manifest-path migration/Cargo.toml -- upRun the API:
cargo runThe server listens on http://localhost:3000.
Health check:
curl http://localhost:3000/Vehicles are keyed by number_plate. The create and update request body is:
{
"number_plate": "KDA123X",
"make": "Toyota",
"model": "Hilux",
"year": 2024
}Available endpoints:
| Method | Path | Description |
|---|---|---|
POST |
/vehicles |
Create a vehicle and return the created plate |
GET |
/vehicles |
List all vehicles |
GET |
/vehicles/{plate} |
Get one vehicle by plate |
PUT |
/vehicles/{plate} |
Update a vehicle by plate |
DELETE |
/vehicles/{plate} |
Delete a vehicle by plate |
Create a vehicle:
curl -X POST http://localhost:3000/vehicles \
-H "Content-Type: application/json" \
-d '{
"number_plate": "KDA123X",
"make": "Toyota",
"model": "Hilux",
"year": 2024
}'List vehicles:
curl http://localhost:3000/vehiclesGet a vehicle:
curl http://localhost:3000/vehicles/KDA123XUpdate a vehicle:
curl -X PUT http://localhost:3000/vehicles/KDA123X \
-H "Content-Type: application/json" \
-d '{
"number_plate": "KDA123X",
"make": "Toyota",
"model": "Land Cruiser",
"year": 2025
}'Delete a vehicle:
curl -X DELETE http://localhost:3000/vehicles/KDA123XCreate a tracker ping:
curl -X POST http://localhost:3000/pings \
-H "Content-Type: application/json" \
-d '{
"number_plate": "KDA123X",
"latitude": -1.286389,
"longitude": 36.817223,
"speed": 42.5,
"recorded_at": "2026-08-03T09:00:00+03:00"
}'List pings for a vehicle:
curl "http://localhost:3000/pings?plate=KDA123X&page=1"