A full-stack metro transit application built with React, TypeScript, Express, MongoDB, and Vite. Features real-time journey planning, station exploration, ticket management, and interactive network visualization.
Frontend
- React 19 + TypeScript + Vite
- React Router v7 for routing
- Tailwind CSS v4 for styling
- Motion (Framer Motion) for animations
- TanStack Query for data fetching
Backend
- Express.js + TypeScript (ESM)
- MongoDB with Mongoose
- JWT authentication with bcryptjs
- Express Rate Limit for API protection
- WebSocket support for real-time features
Deployment
- Netlify (frontend)
- Render / Railway / Fly.io (backend)
- Node.js 20+
- MongoDB (local or Atlas)
- npm or pnpm
# Install dependencies
npm install
# Start dev server (http://localhost:5173)
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewcd server
# Install dependencies
npm install
# Copy env template and configure
cp .env.example .env
# Edit .env with your MongoDB URI, JWT secret, etc.
# Start dev server (http://localhost:4000)
npm run dev
# Build for production
npm run build
# Start production server
npm startFrontend (.env in root):
VITE_API_URL=http://localhost:4000/api
VITE_WS_URL=ws://localhost:4000Backend (server/.env):
PORT=your-port-here
NODE_ENV=your-node-env-here
MONGODB_URI=your-mongodb-uri-here
JWT_SECRET=your-super-secret-jwt-key-change-me
JWT_EXPIRES_IN=7d
FRONTEND_URL=your-frontend-url-here| Feature | Description |
|---|---|
| Journey Planner | Multi-modal route planning with real-time data |
| Station Explorer | Interactive station details, facilities, connections |
| Network Map | Animated SVG/Canvas network visualization |
| Tickets | Purchase, manage, and validate digital tickets |
| Auth | JWT-based auth with signup/login, protected routes |
| Real-time | WebSocket hub for live updates (delays, crowding) |
| Design Studio | Creative tools for station concepts |
Root (Frontend)
npm run dev # Start Vite dev server
npm run build # Type-check + production build
npm run lint # Run Oxlint
npm run preview # Preview production buildServer
npm run dev # Start with tsx watch mode
npm run build # Compile TypeScript to dist/
npm start # Run compiled production server
npm run test # Run Vitest tests- Connect repo to Netlify
- Build command:
npm run build - Publish directory:
dist - Add environment variables in Netlify dashboard:
VITE_API_URL- Your backend API URLVITE_WS_URL- Your backend WebSocket URL
The netlify.toml ensures devDependencies (TypeScript, Vite) are installed during build without forcing a build-time environment override.
- Set
serveras root directory - Build command:
npm run build - Start command:
npm start - Add all backend environment variables
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/signup |
Register new user |
POST |
/api/auth/login |
Login, returns JWT |
GET |
/api/auth/me |
Get current user (protected) |
GET |
/api/stations |
List all stations |
GET |
/api/stations/:id |
Station details |
GET |
/api/journeys |
Plan journey |
GET |
/api/tickets |
User's tickets (protected) |
POST |
/api/tickets |
Purchase ticket (protected) |
WS |
/ws |
Real-time updates |
- Oxlint for fast linting (configured in
.oxlintrc.json) - TypeScript strict mode enabled
- ESM modules throughout
# Feature branches from main
git checkout -b feat/journey-planner
# Commit with conventional messages
git commit -m "feat: add multi-modal journey planner"
# Push and open PR
git push origin feat/journey-plannerDeveloped by the Tech Mobius Club