Built with Node.js, Express, PostgreSQL, and basic JavaScript
- Node.js 18.x or higher
- PostgreSQL 14+ (local) or Supabase account (cloud)
- npm or yarn
# Clone the repository
git clone https://github.com/your-username/movex.git
cd movex
# Install dependencies
cd backend
npm install
# Setup your environment settings
cp ../.env.example ../.env
# Edit .env with your own settings
# Start the server
npm start- Main App: http://localhost:4000
- System Status: http://localhost:4000/api/health
- Admin Section: http://localhost:4000/dashboards/admin/admin-dashboard.html
MoveX is organized into 6 functional modules:
| # | Module | Description |
|---|---|---|
| 1 | User Management | Registration, login, roles, and session handling |
| 2 | Franchise and Staff Operations | Franchise management and staff assignments |
| 3 | Customer Booking and Pricing | Online booking and rate calculation |
| 4 | Pickup and Dispatch Management | Scheduling pickups and assigning deliveries |
| 5 | Shipment Tracking and Delivery | Real-time tracking and proof of delivery |
| 6 | Reports and Analytics | Dashboard metrics and business reports |
MoveX uses a Single-system design built for safety, made to be an "Iron Fortress" for your delivery data.
- No special setup needed: We do not use complex tools like Webpack. The code you see is exactly what runs in the browser.
- Shadow Router (
dashboard-layout.js): A custom tool that catches clicks to load pages quickly without reloading the whole site. - Keeps your data visible: The Sidebar and Header stay active while you move between pages, so the screen doesn't "blink."
- File Protection: Your private files (
.html) are NOT public. A security layer checks if you are logged in before showing them. - Safe Session Control: We use secure random codes instead of simple passwords in the browser. Admins can stop any user's login instantly.
movex/
├── dashboards/ # Unified Dashboard System
│ ├── admin/ # admin-dashboard.html, admin-users.html, etc.
│ ├── franchisee/ # franchisee-dashboard.html, franchisee-shipments.html, etc.
│ ├── staff/ # staff-dashboard.html, staff-assignments.html
│ └── user/ # user-dashboard.html
├── backend/
│ ├── middleware/ # Security check-posts (auth, limits, etc.)
│ ├── routes/ # Main URL paths
│ ├── src/
│ │ ├── app.js # Main server file
│ │ ├── config/ # Database setup
│ │ ├── controllers/ # App logic
│ │ └── session.js # Managing logins (saved in DB)
│ ├── sql/ # Combined database setup files (001-003)
│ └── utils/ # Helper tools
├── js/ # Frontend JavaScript files
│ ├── dashboard-layout.js # Unified Layout Manager
│ ├── dashboard-guard.js # Role-based protection logic
│ └── ... # Role-specific core files
├── styles/ # CSS design files
├── ERDIAGRAM/ # ER Diagram visualization (Chen notation)
├── index.html # Main login page
├── SETUP.md # Guide for real online setup
├── API.md # Detailed server connection guide
├── ARCHITECTURE.md # How the system is built
└── README.md # This file
/adminvs/dashboards:- Admin: High-security area. For managing users and settings.
- Dashboards: Special views for franchisees and staff (works on mobile).
/backend/src/session.js: Controls the login timer. It cleans up old logins every 15 minutes.
| Role | What they can do | Dashboard link |
|---|---|---|
| Admin | Full control of the system | /dashboards/admin/admin-dashboard.html |
| Franchisee | Manage their own branch | /dashboards/franchisee/franchisee-dashboard.html |
| Staff | Daily work and parcel updates | /dashboards/staff/staff-dashboard.html |
| User | Simple tasks and viewing | /dashboards/user/user-dashboard.html |
Copy .env.example to .env and fill in:
# Required
NODE_ENV=development
PORT=4000
JWT_SECRET=your-32+-character-secret
SESSION_SECRET=your-32+-character-secret
HEALTH_CHECK_KEY=secret-key-for-health-check
# Database settings
DATABASE_URL=postgresql://... # Full connection link
# OR use individual details:
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=movex_auth| Method | Path | Description |
|---|---|---|
| POST | /api/auth/register |
Create a new account |
| POST | /api/auth/login |
Log in (using username) |
| POST | /api/auth/logout |
Log out |
| GET | /api/auth/me |
Show current user info |
| GET | /api/me |
Full profile & franchise details |
| Method | Path | Description |
|---|---|---|
| GET | /api/dashboard/me |
My dashboard data |
| GET | /api/dashboard/admin |
Admin dashboard data |
| GET | /api/dashboard/admin/stats |
Main system numbers |
| GET | /api/dashboard/public/serviceable-cities |
Cities where we work |
| Method | Path | Description |
|---|---|---|
| GET | /api/dashboard/admin/shipments |
List all parcels |
| POST | /api/dashboard/admin/shipments/create |
Create a new parcel |
| Method | Path | Description |
|---|---|---|
| GET | /api/health |
Simple status check |
| GET | /api/health/detailed |
Full system status |
| GET | /api/health/ready |
Readiness check |
| GET | /api/health/live |
Liveness check |
- ✅ Safe Passwords: Hiding passwords using "Bcrypt" (very strong).
- ✅ Secure Cookies: Keeping login session safe in the browser (HttpOnly).
- ✅ Saved Logins: Logins stay active even if the server restarts.
- ✅ Request Limits: Blocks hackers trying to guess passwords too fast.
- ✅ CORS: Only allows your own website to talk to the server.
- ✅ Browser Protection: Extra safety layers for the browser (CSP).
- ✅ Global No-Cache Policy: Ensuring updates appear instantly without manual refreshes.
- ✅ In-Depth Validation: Ensuring all data sent by users is correct.
- ✅ Database Safety: Stops bad code from entering your database (SQL injection).
- ✅ Auto-Redirect: Logged-in users are automatically sent to their dashboard.
MoveX uses PostgreSQL with the following tables:
| Table | Primary Key | Description |
|---|---|---|
| organizations | organization_id | Franchise branches |
| users | username | User accounts |
| sessions | session_id | Active login sessions |
| password_resets | reset_id | Password recovery tokens |
| shipments | tracking_id | Parcel tracking records |
See: ERDIAGRAM/index.html for visual ER diagram.
See SETUP.md for the full setup guide.
# 1. Create the database
createdb movex_auth
# 2. Run these files in order to setup the tables
psql -d movex_auth -f backend/sql/001_schema.sql
psql -d movex_auth -f backend/sql/002_security.sql
psql -d movex_auth -f backend/sql/003_seeds.sql- Add Parcels: Full details for both sender and receiver.
- Address Details: Name, Phone, Address, and Pincode for both sides.
- Weight: Track parcel weight in KG.
- Cost: Manage how much the delivery costs.
- Workflow: Move status from "Pending" to "Delivered".
- Delivery Date: Automatically calculate when the parcel will arrive.
View everything in one place:
- Live status badge.
- Sender and receiver contact info.
- Route visualization (Start → End).
- Money, weight, and booking dates.
- Timeline of recent updates.
- Print with one click: Right from the parcel details window.
- Autofill: All data is pulled from the database automatically.
- Barcodes: Barcodes are made automatically for every parcel.
- One-time use: Labels are made only when you click print, so they don't fill up the server.
| Field | Where it comes from |
|---|---|
| Tracking ID | From your database |
| Barcode | Made from the Tracking ID |
| Route | Start city and End city |
| Receiver | Name, Address, Phone, Pincode |
| Sender | Name and City |
| Weight | Total weight in KG |
| Price | Total cost in ₹ |
| Return Address | Sender's full address |
MoveX uses Supabase Storage for parcel photos:
- Photos are organized by their Tracking ID.
- Private storage that only allowed users can see.
- Supports JPEG, PNG, WebP, and more.
- Maximum file size: 5MB per photo.
- Backend: Render (Node.js Web Service)
- Frontend: Cloudflare (Pages / Workers)
- Database: Supabase (PostgreSQL)
Configuring the connection between them is handled via js/config.js (Frontend) and Environment Variables (Backend).
- Set
NODE_ENV=production. - Use long, random secrets for your passwords and tokens (32+ characters).
- Setup your Supabase database.
- Update your
FRONTEND_URLso the app works online. - Make sure your website uses a secure padlock (HTTPS).
- ERDIAGRAM/index.html - Visual ER Diagram (Chen Notation)
- SETUP.md - Full guide for real setup.
- API.md - Full list of server paths and data.
- ARCHITECTURE.md - Deep dive into how code is organized.
- .env.example - List of all settings you can use.
- Fork the project.
- Make a new branch (
git checkout -b feature/new-stuff). - Add your changes and commit (
git commit -m 'Added something cool'). - Push and open a request to merge.
MoveX - Moving logistics forward