Welcome to the SafePath High-Concurrency Backend MVP! This document provides detailed instructions to boot, test, and interact with your custom microservices architecture completely locally.
Ensure your local machine has the following installed:
- Docker & Docker Compose (for Kafka, Zookeeper, Redis, PostgreSQL, and Go Backend)
- Node.js 18+ (for the Vite Frontend)
- Go 1.22+ (optional, if you wish to run the background mock simulator outside of Docker)
The entire backend is deeply containerized. This includes the AntiGravity Go API, Apache Kafka messaging queue, Redis caching layer, and PostgreSQL persistence.
- Open your terminal in the root project directory:
cd /home/varad/Projects/SafePath-MVP - Start the cluster:
docker compose up --build -d
- To verify everything is running cleanly, check the application logs to see successful connections:
docker compose logs -f app
(You should see logs indicating Kafka and Postges initialized successfully without errors)
The frontend React client has been updated to sever Supabase endpoints heavily relying on your local backend port 8080.
- Open a new terminal tab.
- Navigate to the frontend directory:
cd /home/varad/Projects/SafePath-MVP/frontend - Install dependencies (using the legacy peer deps flag due to Vite module boundaries):
npm install --legacy-peer-deps
- Start the Vite development server:
npm run dev
- Open your web browser at
http://localhost:5173.
To see the application "come alive" with mock users pinging their locations and dynamically rendering simulated Danger Zones offline:
- Open a new terminal tab.
- Formally boot the Mock Simulator:
cd /home/varad/Projects/SafePath-MVP/backend/cmd/seed go run main.go - Checking back on your frontend, you should immediately witness map pings adjusting coordinates automatically every 3 seconds!
Here are the primary testing phases to ensure your architecture is successfully deployed:
- Simply open the dashboard. You should seamlessly observe static fallback "Danger Zones" populated onto the geofence fetched natively from
http://localhost:8080/api/v1/dangerzonesrather than WebSockets.
- With the Simulator daemon running, watch your app console / map for incoming tracking coordinate patches.
- You can cross-reference the success on the backend by watching
docker compose logs -f appconfirming200 OKonPATCH /api/v1/location.
- Inside the UI on
http://localhost:5173, locate the START TRIP / SOS button. - Click and hold the red SOS button for a continuous exactly 3 seconds.
- The
🚨 EMERGENCY ALERToverlay will immediately trigger. - Under the hood, this pushed a
POST /api/v1/sospayload cleanly routed through Kafka streams natively. Check the backenddocker logsto spot the[Twilio Mock]interceptor completing the loop and simulating text alerts!
Enjoy building out the rest of the hackathon!