A production-ready, real-time AI-powered web application for optimizing bike rental fleets.
- Frontend: React (Vite) + Recharts + WebSockets + Supabase Auth.
- Backend: Node.js + Express + Socket.IO + Supabase verification.
- ML Layer: Python (Flask) with simple algorithms for demand prediction and rebalancing.
- Simulator: Python script faking live gps traces and data updates.
I've provided a bash script to start the whole suite together!
chmod +x start_all.sh
./start_all.shWhat this does:
- Starts the Python ML Service on
http://localhost:8000 - Starts the Simulation background script generating real-time payloads.
- Starts the Node.js API + WebSockets on
http://localhost:5000 - Starts the Vite Frontend on
http://localhost:5173
- Go to Supabase and click "New Project".
- Add a strong password for your database.
- Navigate to Project Settings -> API to get your keys.
- Open the Supabase SQL Editor.
- Run the
supabase_schema.sqlfile provided into an editor tab and hit Run to createstations,bikes,rides, andrevenue.
To link the project to Supabase, create .env files in frontend and backend.
frontend/.env
VITE_SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co
VITE_SUPABASE_ANON_KEY=YOUR_PUBLIC_ANON_KEY
VITE_API_URL=http://localhost:5000backend/.env
PORT=5000
SUPABASE_URL=https://YOUR_PROJECT_ID.supabase.co
SUPABASE_SERVICE_KEY=YOUR_SERVICE_ROLE_KEY
SUPABASE_JWT_SECRET=YOUR_JWT_SECRET_FROM_SUPABASE_SETTINGS
ML_SERVICE_URL=http://localhost:8000(Note: The codebase contains logic that bypasses strict checks if env variables are not found for easy local demo viewing, but ensure they are set for production functionality!)
- Live Dashboards: See real-time node pings for bike spots matching physical capabilities.
- AI Chat: An integrated chatbot capable of helping suggest dynamic price structures based on volume constraints logic.
- Socket Events: Completely event-driven UI updates smoothly in response to real-time events.