A full-stack delivery management system built with Go (Gin) for the backend and Vue (Vite) for the frontend.
- Go 1.18+
- Node.js 16+
- PostgreSQL
-
Clone the repository:
git clone https://github.com/yourusername/yourrepo.git cd yourrepo -
Configure environment variables:
- update
.envwith your database credentials
DB_HOST=localhost DB_PORT=5432 DB_USER=postgres DB_PASSWORD=mysecretpassword DB_NAME=mydatabase DB_SSLMODE=disable
- update
-
Backend setup
-
Install dependencies:
go mod tidy
-
Run the backend:
go run main.go
The backend will start on http://localhost:8080.
-
-
Frontend Setup
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Run the frontend:
npm run dev
The frontend will start on http://localhost:5173.
-
Backend: Developed in Go using the Gin web framework. .
Frontend: Built with Vue.js and Vite for a fast, reactive user interface. Leaflet for handling map renders and axios as the browser HTTP client.
Database: PostgreSQL is used as the relational database, storing all core data such as users, deliveries, and statuses.
we can use the place warehouse on map and place order on map to put warehouses and orders on the map, and these will get synced to the db. We can also add agents using the form.
We have the Haversine distanc to calculate the distance from the warehouses to the orders.
The backend uses a modified round-robin algorithm for even allotment of orders to agents, minimising the cost incurred. The Haversine distance between each warehouse is calculated alloted to the nearest warehouse
Key Characteristics:
- Cycles through agents in sequence: Agent1 → Agent2 → Agent3 → Agent1 → ...
- Fair distribution - each agent gets equal opportunity
- Good for workload balance
Alternatively I have also written a least loaded algorithm that we can switch to, for better individual utilisation of agents.
Key Characteristics:
- Always prioritizes agent with fewest current orders
- Maximizes individual agent utilization
- Better for reaching higher payout tiers (25+, 50+ orders)
There is a
internal/db/seed.sqlfile in the repo, that we have written to seed test data into our database. It generates -
- 60 orders in a day/agent
- 20 agents per warehouse
- 10 warehouses around New Delhi (Arbitrarily chosen city).
- The map render after seeding using our script
Now we can click Allocate orders button to allocate these orders

UI will give us the metrics at the bottom of the page
We can scrolling for metrics on orders



