Livelocd is a lightweight Axum-compatible plugin for real-time location tracking via WebSockets and a JSON API. Easily drop it into any Rust backend to enable live geolocation dashboards, game user tracking, or delivery fleet monitoring.
- 📡 WebSocket support for sending real-time location updates
- 👂 Subscribe to all users or individual users' locations
- 🌐 REST API to query current locations
- 🧩 Designed as a plugin for Axum or Loco.rs apps
- ⚡ Built with minimal dependencies, powered by tokio, axum, and serde_json
In your project’s Cargo.toml:
livelocd = { path = "../livelocd" } # or use Git/crates.io in the future
In your Axum project:
use axum::Router;
use livelocd::livelocd_routes;
#[tokio::main]
async fn main() {
let app = Router::new().merge(livelocd_routes());
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
}
- GET /ws/send-location — Send JSON with a user_id and any arbitrary fields (e.g., lat/lng)
- GET /ws/subscribe — Receive real-time updates for all users
- GET /ws/subscribe/:user_id — Subscribe to updates for a specific user
{
"user_id": "user123",
"lat": 33.7489954,
"lng": -84.3879824,
"status": "moving"
}
- GET /api/users — Get current known location for all users
- GET /api/users/:user_id — Get most recent location for a single user
You are responsible for securing the WebSocket and API endpoints (auth, rate limiting, etc.) based on your use case.
- Live fleet or delivery tracking
- Multiplayer game player positions
- Dashboards for location-aware apps
- IoT geolocation feeds
Use websocat:
# Send location
websocat ws://localhost:3000/ws/send-location
{"user_id": "car-1", "lat": 40.7, "lng": -74.0}
# Subscribe to all
websocat ws://localhost:3000/ws/subscribe
MIT
Pull requests welcome! Let’s make real-time dashboards in Rust even easier.
.png)

