A complete, production-ready full-stack application for managing service requests with real-time analytics, assignment scheduling, and comprehensive admin dashboard.
π Internship Test Project - Built as an assessment for Octick Pvt Ltd. All requirements completed with production deployment.
This project was built as an internship technical assessment. All requirements completed successfully.
- β Customer trip request submission form
- β Coordinator admin panel with authentication
- β Status management (pending β approved/rejected/scheduled)
- β Driver & vehicle assignment with scheduling
- β Search requests by customer name or phone
- β Daily analytics (request count for last 7 days)
- β REST API with CRUD operations (Create, Read, Update, Delete)
- β Input validation with clear error messages
- β Correct HTTP status codes (200, 201, 400, 404, 500)
- β Pagination on admin list endpoint
- β
/api/analytics/dashboardendpoint for statistics - β Seed data (7 drivers, 7 vehicles)
- β
Consistent JSON error shape with
messageanderrorsfields
- β Responsive customer form with client-side validation
- β Friendly error messages & success states
- β Admin authentication system
- β Requests table with status filter & inline actions
- β Analytics chart (bar chart for daily requests)
- β Modal for scheduling with driver/vehicle dropdowns
- β Loading states throughout application
- β Clean, readable components
- β Clear commit history (50+ commits with descriptive messages)
- β
Unit tests (
backend/src/tests/unit.test.js) - β
API tests (
backend/src/tests/api.test.js) - β Logging middleware (method, path, status, duration)
- β
.env.examplefiles with safe defaults - β
npm scripts for easy setup (
npm run dev,npm start) - β Comprehensive documentation
- β Production Deployment - Live demo on Render.com
- β Docker Compose - Full containerization setup
- β Role-based access control (coordinator/viewer)
- β Live updates via WebSockets/SSE
- Time Spent: ~12 hours over 5 days
- Commit Count: 50+ commits
- Lines of Code: Backend (~2,500), Frontend (~1,800)
- Features
- Live Demo
- Tech Stack
- Quick Start
- π Documentation
- Installation
- API Documentation
- Deployment
π― Lost in too many docs?
π Start here: docs/WHICH_FILE_TO_READ.md - Quick guide to find what you need!
Essential Docs:
- π QUICKSTART.md - Set up locally in 5 minutes
- π RENDER_DEPLOYMENT.md - Deploy to production
- π PROJECT_SUMMARY.md - System overview
- ποΈ ARCHITECTURE.md - Code structure
- ποΈ DATABASE_INFO.md - Database schema
π View all documentation β
π Live Application Deployed!
Access the demo at:
- π Frontend: https://service-request-management-system-zaf2.onrender.com/
- π Backend API: https://service-request-management-system.onrender.com/api
Demo Credentials:
Username: admin
Password: admin123
β οΈ Note: Free tier services may take 30-60 seconds to wake up after inactivity.
π Full Documentation: See docs/ folder for detailed guides.
- β Submit service requests with validation
- β Multiple service types (Package Delivery, Furniture Moving, etc.)
- β Real-time form validation
- β Success notifications
- β Secure JWT authentication
- β Real-time analytics & statistics
- β 7-day service requests chart
- β Service request management (CRUD)
- β Advanced filtering and search
- β Pagination support
- β Assignment scheduling
- β Status tracking workflow
- β Driver and vehicle management
- β RESTful API with MVC architecture
- β MySQL database with proper indexing
- β JWT authentication & authorization
- β Request/Response logging
- β Error handling middleware
- β Unit and API tests
- β Docker containerization
- β Responsive design
- β Production-ready configuration
- Node.js (v18+) - Runtime environment
- Express.js (v4.18) - Web framework
- MySQL (v8.0) - Database
- JWT - Authentication
- Bcrypt - Password hashing
- Winston - Logging
- Jest & Supertest - Testing
- React (v18.2) - UI library
- React Router - Navigation
- Axios - HTTP client
- Recharts - Data visualization
- CSS3 - Styling (responsive)
- Docker & Docker Compose - Containerization
- Nginx - Reverse proxy
- ESLint & Prettier - Code quality
- Nodemon - Development
βββββββββββββββββββ
β React SPA β
β (Frontend) β
ββββββββββ¬βββββββββ
β
HTTP/REST
β
ββββββββββΌβββββββββ
β Express API β
β (Backend) β
β - Controllers β
β - Middleware β
β - Routes β
ββββββββββ¬βββββββββ
β
MySQL
β
ββββββββββΌβββββββββ
β MySQL Database β
β - Users β
β - Requests β
β - Assignments β
β - Drivers β
β - Vehicles β
βββββββββββββββββββ
Model (Database) ββ> Controller (Business Logic) ββ> View (React Components)
β
Middleware
(Auth, Logging, Error)
- Node.js v18 or higher
- npm v9 or higher
- MySQL v8.0 or higher
- Git
- Docker v20+
- Docker Compose v2+
# Clone the repository
git clone <repository-url>
cd internTask
# Start all services
docker-compose up -d
# Wait 30 seconds for database initialization
# Access the application:
# - Customer Portal: http://localhost:3000
# - Admin Dashboard: http://localhost:3000/admin/login
# - Backend API: http://localhost:5000/api# Clone and install
git clone <repository-url>
cd internTask
npm run install:all
# Set up environment variables
cp .env.example .env
cd backend && cp .env backend/.env
cd ../frontend && cp .env frontend/.env
# Start MySQL (ensure it's running)
# Update backend/.env with your MySQL credentials
# Run migrations and seed data
cd backend
npm run migrate
npm run seed
# Start development servers (from root)
npm run dev
# Access:
# - Frontend: http://localhost:3000
# - Backend: http://localhost:5000git clone <repository-url>
cd internTask# Install all dependencies
npm run install:all
# Or install individually
npm install # Root
cd backend && npm install
cd ../frontend && npm installCreate .env files:
backend/.env
NODE_ENV=development
PORT=5000
DB_HOST=localhost
DB_PORT=3306
DB_USER=admin
DB_PASSWORD=admin123
DB_NAME=service_requests_db
JWT_SECRET=your_super_secret_jwt_key_change_in_production
JWT_EXPIRES_IN=24h
CORS_ORIGIN=http://localhost:3000frontend/.env
REACT_APP_API_URL=http://localhost:5000/api# Ensure MySQL is running
# Login to MySQL and create database (optional - migration does this)
mysql -u root -p
CREATE DATABASE service_requests_db;
EXIT;
# Run migrations
cd backend
npm run migrate
# Seed sample data
npm run seed# Option 1: Run both frontend and backend
npm run dev
# Option 2: Run separately
# Terminal 1 - Backend
cd backend
npm run dev
# Terminal 2 - Frontend
cd frontend
npm start# Build frontend
cd frontend
npm run build
# Start backend in production
cd backend
NODE_ENV=production npm start# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild and start
docker-compose up --build -d# View all commands
make help
# Install dependencies
make install
# Run development
make dev
# Run migrations
make migrate
# Seed database
make seed
# Run tests
make test
# Docker commands
make docker-up
make docker-downcd backend
npm testnpm test -- --coverage# Unit tests only
npm test -- unit.test.js
# API tests only
npm test -- api.test.js- Unit tests cover utility functions (password hashing, JWT)
- API tests cover authentication and service request endpoints
- Coverage reports generated in
backend/coverage/
http://localhost:5000/api
POST /api/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "admin123"
}
Response: 200 OK
{
"token": "eyJhbGc...",
"user": {
"id": 1,
"username": "admin",
"email": "[email protected]",
"role": "admin"
}
}POST /api/auth/register
Content-Type: application/json
{
"username": "newuser",
"password": "password123",
"email": "[email protected]"
}POST /api/service-requests
Content-Type: application/json
{
"customer_name": "John Doe",
"customer_email": "[email protected]",
"customer_phone": "555-1234",
"service_type": "Package Delivery",
"pickup_address": "123 Main St",
"delivery_address": "456 Oak Ave",
"preferred_date": "2024-12-01",
"special_instructions": "Handle with care"
}GET /api/service-requests?page=1&limit=10&status=pending&search=john
Authorization: Bearer <token>GET /api/service-requests/:id
Authorization: Bearer <token>PUT /api/service-requests/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "completed"
}PATCH /api/service-requests/:id/status
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "completed"
}POST /api/assignments
Authorization: Bearer <token>
Content-Type: application/json
{
"request_id": 1,
"driver_id": 1,
"vehicle_id": 1,
"scheduled_date": "2024-12-01T10:00:00"
}GET /api/assignments?page=1&limit=10
Authorization: Bearer <token>GET /api/analytics/dashboard
Authorization: Bearer <token>
Response:
{
"totalRequests": 25,
"pendingRequests": 5,
"completedRequests": 15,
"activeAssignments": 3,
"availableDrivers": 4,
"availableVehicles": 3
}GET /api/analytics/requests-by-day?days=7
Authorization: Bearer <token>
Response:
[
{ "date": "2024-11-20", "count": 3 },
{ "date": "2024-11-21", "count": 5 },
...
]200- Success201- Created400- Bad Request (validation error)401- Unauthorized (missing/invalid token)404- Not Found500- Internal Server Error
β¨ Complete deployment guide available in RENDER_DEPLOYMENT.md
Quick overview:
- Set up free MySQL database (Aiven)
- Deploy backend to Render
- Deploy frontend to Render
- Update README with live demo links
Total Cost: $0/month (Free tier) Deployment Time: 30-45 minutes
- Build and Start
docker-compose up -d --build-
Environment Variables Update
docker-compose.ymlwith production values -
Access Application
- Application: http://your-domain.com
- API: http://your-domain.com/api
cd backend
npm ci --production
npm run migrate
npm run seed
NODE_ENV=production npm startcd frontend
npm ci
npm run build
# Serve the 'build' folder with Nginx/ApacheNODE_ENV=production
DB_HOST=your-db-host
JWT_SECRET=change-this-to-random-secure-string
CORS_ORIGIN=https://your-domain.comserver {
listen 80;
server_name your-domain.com;
location / {
root /path/to/frontend/build;
try_files $uri /index.html;
}
location /api {
proxy_pass http://localhost:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}Problem: Can't connect to MySQL
Solution:
# Check MySQL is running
systemctl status mysql # Linux
brew services list # macOS
# Test connection
mysql -u admin -p
# Verify credentials in backend/.envProblem: Port 3000 or 5000 already in use
Solution:
# Find and kill process (Linux/macOS)
lsof -ti:3000 | xargs kill -9
lsof -ti:5000 | xargs kill -9
# Windows
netstat -ano | findstr :3000
taskkill /PID <PID> /FProblem: Containers won't start
Solution:
# Clean up Docker
docker-compose down -v
docker system prune -a
# Rebuild
docker-compose build --no-cache
docker-compose up -dProblem: Migration fails
Solution:
# Drop database and retry
mysql -u admin -p
DROP DATABASE service_requests_db;
EXIT;
# Re-run migration
cd backend
npm run migrate
npm run seedProblem: npm run build fails
Solution:
# Clear cache and reinstall
cd frontend
rm -rf node_modules package-lock.json
npm install
npm run buildusers
- id (PK)
- username (unique)
- password_hash
- email (unique)
- role (admin/user)
- created_at, updated_at
service_requests
- id (PK)
- customer_name
- customer_email
- customer_phone
- service_type
- pickup_address
- delivery_address
- preferred_date
- special_instructions
- status (pending/assigned/in_progress/completed/cancelled)
- created_at, updated_at
drivers
- id (PK)
- name
- phone
- license_number (unique)
- status (available/assigned/off_duty)
- created_at, updated_at
vehicles
- id (PK)
- model
- plate_number (unique)
- year
- capacity
- status (available/in_use/maintenance)
- created_at, updated_at
assignments
- id (PK)
- request_id (FK)
- driver_id (FK)
- vehicle_id (FK)
- scheduled_date
- status (scheduled/in_progress/completed/cancelled)
- created_at, updated_at
Username: admin
Password: admin123
This project is licensed under the ISC License.
Developed as a demonstration of full-stack development skills.
- Express.js community
- React community
- MySQL team
- Docker team
Need Help? Check the Troubleshooting section or create an issue.
Happy Coding! π