ResQMesh: Building a Real-Time Emergency Dispatch Engine on Real City Maps
How I built a routing platform that finds shortest paths across a real OpenStreetMap city graph in milliseconds, and shipped it as a single JAR on Amazon EC2.
The problem
When an ambulance is dispatched, the shortest route on paper isn't always the fastest route in reality. Roads close, junctions clog, and responders need a shared, live picture of what's happening. I wanted to build a system that treats the city as a graph and keeps routing decisions current as conditions change.
That became ResQMesh, an emergency response and routing platform I built for [hackathon name].
What ResQMesh does
- Routes on a real city, not a toy grid. A Python script using OSMnx pulls the actual street network from OpenStreetMap (I used Lower Manhattan) and exports it as a graph of nodes and edges.
- Computes shortest paths fast. The backend runs Dijkstra's algorithm across thousands of nodes and edges and returns routes in milliseconds. [Add your measured latency here.]
- Streams live updates. A Spring Boot WebSocket server pushes events to the dashboard over STOMP, so dispatchers see changes without refreshing.
- Looks the part. The React dashboard has a dark-mode, glassmorphic design with live Leaflet map overlays.
Architecture
Layer | Tech |
|---|---|
Data engineering | Python + OSMnx generate the city graph as JSON |
Backend | Java 21, Spring Boot 3.3.3, Spring Data JPA/Hibernate, Flyway migrations |
Database | PostgreSQL (H2 for local dev) |
Real-time | WebSocket with SockJS and StompJS |
Frontend | React (Vite), Leaflet / React-Leaflet, custom CSS |
Deployment | Docker / single executable JAR on Amazon EC2 |
[Insert architecture diagram: OSM → Python script → JSON graph → Spring Boot (seeds DB, serves API + WebSocket + static React build) → Browser, all running on EC2.]
Key design decisions
1. Turn OpenStreetMap into a graph once, then seed it.
fetch_city.py takes a bounding box, uses OSMnx to download the street network, and writes manhattan_graph.json into the backend's resources. On startup, Spring Boot seeds the graph into the database. Switching to a new city means editing coordinates and rerunning the script.2. One artifact to deploy. I build the Vite frontend, copy the output into Spring Boot's
static folder, and package everything with Maven. The result is a single JAR. Tomcat serves both the API and the UI, so there's no separate frontend host, no CORS setup, and nothing to keep in sync.3. Push, don't poll. Emergency dispatch is time-sensitive. WebSockets let the server push events the moment they happen instead of having clients ask repeatedly.
Deploying on AWS
Because the app is one JAR, deployment on Amazon EC2 is simple:
- Launch an EC2 instance with Java 21.
- Build the production bundle and package the app:
bash
cd frontend && npm run build && cd .. mkdir -p src/main/resources/static cp -r frontend/dist/* src/main/resources/static/ ./mvnw clean package -DskipTests- Copy the JAR to the instance and run:
bash
java -jar target/resqmesh-0.0.1-SNAPSHOT.jar- Point the app at PostgreSQL through
application.yml(or use H2 for a quick demo).
The repo also includes a
Dockerfile and docker-compose.yml for containerized runs.[Add: instance type you used, security group setup, how you exposed the app, rough cost.]
Where I'd take it next on AWS
(Roadmap ideas, not things I've built yet. Edit this to match your real plans.)
- Amazon RDS for PostgreSQL to move the database off the instance, with automated backups.
- Application Load Balancer + Auto Scaling for resilience during demand spikes.
- Amazon Location Service or Amazon Kinesis for live responder tracking and event ingestion at scale.
- Amazon CloudWatch for latency and WebSocket connection metrics.
What I learned
- Real geographic data is messy, and most of the effort went into cleaning and shaping the graph rather than the algorithm.
- Bundling frontend and backend together removed a whole class of deployment problems.
- [Add 1–2 personal lessons from the hackathon.]
Try it
If you're building something in emergency tech, routing, or real-time systems, I'd love to hear from you in the comments.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article