Production-ready web platform connecting customers with tailors for custom clothing orders. Features real-time notifications, geolocation-based tailor discovery, comprehensive measurement management, and automated deployment via CI/CD pipeline.
Live Demo: https://smart-tailoring-opv5.onrender.com
Customer → Authentication → Measurement Management → Tailor Discovery (Maps) → Order Placement
↓
Admin Panel ← Notifications ← Order Tracking ← Payment ← Tailor Dashboard
- Customer Registration - Email OTP verification with secure sessions
- Measurement Input - Save multiple measurement profiles with custom notes
- Tailor Discovery - Find nearby tailors using MapLibre + OpenStreetMap
- Order Creation - Place orders with saved/custom measurements
- Real-time Updates - Push notifications for order status changes
- Review System - Rate and review completed services
- ✅ Email OTP Authentication - Secure registration and password recovery
- ✅ Dynamic Measurement System - Customizable measurement fields per order
- ✅ Geolocation Services - MapLibre GL with reverse geocoding
- ✅ Real-time Notifications - Server-sent events for instant updates
- ✅ Order Management - Complete workflow from placement to completion
- ✅ Review & Rating System - Customer feedback with 5-star ratings
- ✅ Admin Dashboard - Comprehensive analytics and user management
- ✅ Database Connection Pooling - HikariCP-style pooling for performance
- ✅ Migration System - Version-controlled database schema changes
- ✅ CI/CD Pipeline - Automated deployment via GitHub Actions
| Metric | Value |
|---|---|
| Database Tables | 12 core tables |
| API Endpoints | 40+ REST endpoints |
| User Roles | 3 (Customer, Tailor, Admin) |
| Authentication | Session-based + CSRF protection |
| Security Features | 10+ security layers |
| Test Coverage | 120+ integration tests |
| Architecture Pattern | Repository + Service Layer |
- Language: PHP 8.2+
- Database: MySQL 5.7+ / MariaDB 10.3+
- Email: PHPMailer 6.x
- Configuration: PHP Dotenv
- UI: HTML5, CSS3, JavaScript (ES6+)
- Maps: MapLibre GL JS + OpenStreetMap
- Notifications: Server-Sent Events (SSE)
- Styling: Custom CSS with responsive design
- Version Control: Git + GitHub
- CI/CD: GitHub Actions
- Deployment: Automated SSH deployment
- Server: Apache/Nginx
- Environment: Docker-ready
smart-tailoring/
├── admin/ # Admin panel
│ ├── dashboard.php # Analytics & statistics
│ ├── customers.php # Customer management
│ ├── tailors.php # Tailor management
│ ├── orders.php # Order monitoring
│ ├── api/ # Admin API endpoints
│ └── includes/ # Admin navigation & security
├── api/ # REST API
│ ├── auth/ # Authentication endpoints
│ ├── measurements/ # Measurement CRUD
│ ├── orders/ # Order management
│ ├── notifications/ # Real-time notifications
│ ├── profile/ # User profile management
│ └── reviews/ # Review system
├── config/ # Configuration
│ ├── db.php # Database connection + pooling
│ ├── security.php # Security functions (CSRF, XSS)
│ ├── session.php # Session management
│ └── email.php # SMTP configuration
├── database/ # Database layer
│ ├── DatabaseConnectionPool.php # Connection pooling
│ ├── DatabaseMigrationManager.php # Migration runner
│ └── migrations/ # Schema version control
├── repositories/ # Data access layer
│ └── CustomerRepository.php # Repository pattern
├── services/ # Business logic layer
├── customer/ # Customer dashboard
├── tailor/ # Tailor dashboard
├── .github/workflows/ # CI/CD pipelines
│ └── deploy.yml # Automated deployment
├── tests/ # Testing suite
│ ├── integration_test.php # 70+ manual tests
│ └── run_tests.php # 50+ automated tests
└── docs/ # Documentation
├── DEPLOYMENT_GUIDE.md # Production deployment
├── DATABASE_README.md # Database documentation
└── SECURITY_QUICKSTART.md # Security guidelines
- PHP 8.2 or higher
- MySQL 5.7+ or MariaDB 10.3+
- Composer
- Apache/Nginx with mod_rewrite
- OpenSSL extension
composer installcp .env.example .envEdit .env with your configuration:
# Application Settings
APP_ENV=development
APP_DEBUG=true
APP_URL=http://localhost/smart-tailoring
# Database Configuration
DB_HOST=localhost
DB_NAME=smart_tailoring
DB_USER=root
DB_PASS=
# SMTP Configuration (Gmail example)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SMTP_FROM=your-email@gmail.com
# Session Security
SESSION_LIFETIME=7200
SESSION_SECURE=false
SESSION_HTTPONLY=true
# Database Connection Pool
DB_POOL_MIN=2
DB_POOL_MAX=10Create database:
CREATE DATABASE smart_tailoring CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;Run migrations:
php migrate.php runThis creates:
customers- Customer accounts and profilestailors- Tailor profiles with shop detailsorders- Order management with status trackingmeasurements- Customer measurement profilesmeasurement_fields- Dynamic measurement datareviews- Customer reviews and ratingsnotifications- Real-time notification systemadmins- Admin user managementcontact_messages- Contact form submissionsemail_otp- Email verification codesadmin_activity_log- Admin action trackingdispute_reports- Dispute management
INSERT INTO admins (username, password, name, email, role, created_at)
VALUES ('admin', '$2y$10$[hash]', 'Administrator', 'anupamkushwaha639@gmail.com', 'super_admin', NOW());Generate password hash:
<?php echo password_hash('your_password', PASSWORD_DEFAULT); ?>chmod 755 uploads/profiles uploads/shops
chmod 755 logs/- Customer Portal:
http://localhost/smart-tailoring/ - Tailor Dashboard:
http://localhost/smart-tailoring/tailor/ - Admin Panel:
http://localhost/smart-tailoring/admin/
php run_tests.phpRuns 50+ automated tests:
- Database connectivity
- File structure validation
- Security configuration
- API endpoint availability
- Session management
- Email configuration
Access via Admin Panel → Integration Tests button
Or directly: http://localhost/smart-tailoring/integration_test.php
Test Categories:
- Authentication (Registration, Login, OTP)
- Customer Features (Measurements, Orders, Profile)
- Tailor Features (Order Management, Status Updates)
- Admin Panel (Dashboard, User Management)
- Public Pages (Homepage, Contact, FAQ)
- API Endpoints (REST API validation)
- Security (CSRF, XSS, SQL Injection protection)
- Response Time: <200ms average (local)
- Database Queries: Optimized with connection pooling
- Concurrent Users: Supports 100+ simultaneous users
- Scalability: Horizontal scaling ready
- Caching: Browser caching + ETags configured
| Feature | Implementation |
|---|---|
| Password Security | bcrypt hashing (cost=10) |
| CSRF Protection | Token-based validation |
| SQL Injection | PDO prepared statements |
| XSS Prevention | htmlspecialchars() + CSP headers |
| Session Security | HTTP-only, SameSite, secure cookies |
| Session Hijacking | User agent validation |
| HTTPS Enforcement | Auto-redirect (production) |
| HSTS | Strict Transport Security header |
| Content Security Policy | Restricts resource loading |
| Environment Variables | Sensitive data in .env (gitignored) |
# Run deployment checker
php deployment_check.phpManual Checklist:
- Set
APP_ENV=productionin.env - Set
APP_DEBUG=false - Configure HTTPS certificate
- Update
SESSION_SECURE=true - Configure production SMTP
- Set proper file permissions
- Enable error logging
- Configure database backups
- Test health check:
/api/health.php
Setup GitHub Secrets:
- Go to:
https://github.com/anupamkushwaha85/smart-tailoring/settings/secrets/actions - Add these secrets:
| Secret | Description |
|---|---|
SSH_HOST |
Server IP/domain |
SSH_USER |
SSH username |
SSH_PRIVATE_KEY |
Private SSH key |
SSH_PORT |
SSH port (default: 22) |
DEPLOY_PATH |
Server deployment path |
Deploy:
git add .
git commit -m "feat: new feature"
git push origin mainGitHub Actions automatically:
- ✅ Runs tests
- ✅ Backs up production database
- ✅ Deploys via SSH
- ✅ Runs migrations
- ✅ Performs health check
- ✅ Rollback on failure
- Deployment Guide - Complete deployment instructions
- Database Architecture - Schema documentation
- Security Guide - Security best practices
- CI/CD Setup - GitHub Actions configuration
- API Reference - REST API documentation
- Payment gateway integration (Stripe/Razorpay)
- SMS notifications via Twilio
- Mobile app (React Native)
- AI-powered measurement recommendations
- Multi-language support (i18n)
- Advanced analytics dashboard
- WebSocket for real-time chat
- Progressive Web App (PWA)
- Docker containerization
- Kubernetes deployment
This repository is connected to a production deployment server. Please follow these guidelines:
- Create an Issue - Describe the bug/feature
- Fork the Repository - For development only (not public deployment)
- Create Feature Branch -
git checkout -b feature/amazing-feature - Commit Changes -
git commit -m 'feat: Add amazing feature' - Push to Branch -
git push origin feature/amazing-feature - Open Pull Request - Submit for review
- Do NOT redistribute with minor changes
- Do NOT deploy modified versions publicly
- Do NOT remove author attribution
- Do NOT claim authorship
See LICENSE for complete terms.
Anupam Kushwaha
- 📧 Email: anupamkushwaha639@gmail.com
- 💼 LinkedIn: linkedin.com/in/anupamkushwaha85
- 🐙 GitHub: @anupamkushwaha85
This project is licensed under the MIT License with Additional Restrictions.
Key Points:
- ✅ Use for learning and education
- ✅ Contribute via issues and pull requests
- ❌ No redistribution with cosmetic changes
- ❌ No public deployment of modified versions
See LICENSE file for complete terms.
- Inspired by modern SaaS platforms
- Built using industry-standard security practices
- MapLibre GL for beautiful map integration
- PHPMailer for reliable email delivery
- OpenStreetMap for geolocation services
Built with ❤️ by Anupam Kushwaha
⭐ If you find this project helpful, please give it a star!
Note: This is a production-ready system. For commercial use or custom deployment, please contact the author.