A full-stack application for managing mining logistics operations, built with React, Node.js, and MongoDB.
- Weekly Dispatch Board: Track daily convoy dispatches with drag-and-drop reordering
- Fleet Management: Manage SGC, KBTL, and TE fleets with status tracking
- Shift Assignment: Assign convoys to day/night shifts
- Monthly Planning: Set targets and track actual performance with KPI dashboard
- Holiday Management: Track holidays and border closures for Mongolia and China
- Incident Tracking: Log and monitor operational incidents
- Real-time KPIs: View dispatched, returned, and average hours metrics
- React 18 with Vite
- TailwindCSS for styling
- Zustand for state management
- React Router for navigation
- date-fns for date manipulation
- Axios for API calls
- Node.js with Express
- MongoDB with Mongoose ODM
- RESTful API architecture
convoy/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API service layer
│ │ ├── store/ # Zustand state management
│ │ └── App.jsx # Main app component
│ └── package.json
│
├── server/ # Node.js backend
│ ├── src/
│ │ ├── models/ # Mongoose schemas
│ │ ├── routes/ # Express routes
│ │ └── index.js # Server entry point
│ ├── .env # Environment variables
│ └── package.json
│
└── package.json # Root package.json
- Node.js 18+
- MongoDB (local or Atlas)
- npm or yarn
-
Clone the repository
cd convoy -
Install all dependencies
npm run install-all
Or install separately:
# Root dependencies npm install # Server dependencies cd server && npm install # Client dependencies cd ../client && npm install
-
Configure environment variables
Edit
server/.env:PORT=5000 MONGODB_URI=mongodb://localhost:27017/ot-mining-logistics NODE_ENV=development
-
Start MongoDB
Make sure MongoDB is running locally, or update
MONGODB_URIto point to your MongoDB Atlas cluster.
Run both client and server concurrently:
npm run devOr run separately:
# Terminal 1 - Server
npm run server
# Terminal 2 - Client
npm run client- Frontend: http://localhost:3000
- Backend API: http://localhost:5000/api
GET /api/convoys- Get all convoysPOST /api/convoys- Create convoyPUT /api/convoys/:id- Update convoyDELETE /api/convoys/:id- Delete convoyPOST /api/convoys/seed- Seed initial convoy data
GET /api/dispatches/:date- Get dispatch for a dateGET /api/dispatches/range?startDate=&endDate=- Get dispatches for date rangePUT /api/dispatches/:date- Update dispatchGET /api/dispatches/kpi/range?startDate=&endDate=- Get KPIs for date range
GET /api/plans/month/:year/:month- Get monthly plansPUT /api/plans/:date- Set daily planGET /api/plans/monthly/:year/:month- Get monthly targetPUT /api/plans/monthly/:year/:month- Set monthly target
GET /api/holidays/year/:year- Get holidays for yearPOST /api/holidays- Create holiday (supports date range)DELETE /api/holidays/:id- Delete holiday
GET /api/incidents/month/:year/:month- Get monthly incidentsPOST /api/incidents- Create incidentPUT /api/incidents/:id- Update incidentDELETE /api/incidents/:id- Delete incident
GET /api/shifts- Get all shift assignmentsPUT /api/shifts/:shiftType- Update shift convoysPOST /api/shifts/:shiftType/convoy- Add convoy to shiftDELETE /api/shifts/:shiftType/convoy/:convoyName- Remove convoy from shift
npm run buildThis builds the React app into client/dist/.
MIT