How nammayatri/location-tracking-service works
Project type and purpose
• This is a Rust-based backend microservice named location-tracking-service.
• It ingests location events (via Kafka), applies domain logic (rate limiting, stop detection, safety checks, geo-fencing), stores/transforms state (in Redis), exposes HTTP APIs (healthchecks, location queries), and emits events to downstream systems.
• It’s intended to run as a standalone service under Nix, with Kafka and Redis as its main dependencies, and integrates with an external “dynamic-driver-offer-app” for authentication/testing.
File structure
• Top-level crates/ directory holds the service code:
• common/: shared utils (geo polygon, rate limiter, heap-size guard).
• domain/: business logic split into internal vs. UI-facing modules for actions and APIs.
• kafka/: producers, types, and configuration for consuming/producing messages.
• redis/: key definitions and commands for state storage.
• outbound/: adapters to external HTTP endpoints or services.
• middleware.rs: request/response interceptors (e.g., logging, auth).
• tools/: metrics (Prometheus), error handling.
• main.rs & drainer.rs: service entrypoints (HTTP server and background jobs).
• Config roots: geo JSON files (bus depot, blacklist, route configs), Dhall config for Nix, justfile/shell scripts for dev tasks.
README for additional insights
• Describes Nix-based setup, Rust build commands, service dependencies (Kafka, Redis via just services), and a Postman collection for API flows.
Key elements to capture
– Service entrypoints (main.rs, drainer.rs)
– Core modules (domain, common, kafka, redis, outbound)
– External dependencies (Kafka, Redis, external apps)
– Dev tools & config (Nix, Dhall, geo files, Postman)