A comprehensive web-based traffic violation payment system for the City of Las PiΓ±as, Philippines. This system enables citizens to search for violations, make online payments, and receive digital receipts, while providing administrators with tools to manage violations, monitor payments, and generate reports.
- Violation Lookup: Search violations by OVR number, plate number, or driver license number
- Online Payment: Integrated payment gateways (GCash, Maya, PayMongo, DragonPay, Debit/Credit Cards)
- Digital Receipts: QR code-enabled receipts sent via email/SMS
- Admin Dashboard: Complete management interface for LGU administrators
- User Authentication: Secure JWT-based authentication
- Notification System: SMS/email reminders for pending fines
- Violation History: User dashboard for violation history
- Dispute Submission: Upload evidence and submit disputes
- Traffic Education: Resources and penalty guides
- QR Code Integration: Physical tickets with QR codes
- Mobile PWA: Progressive Web App for mobile devices
- AI Analytics: Hotspot analysis and violation pattern detection
- Node.js - Runtime environment
- Express.js - Web framework
- PostgreSQL - Primary database
- Sequelize - ORM for database management
- JWT - Authentication and authorization
- bcryptjs - Password hashing
- Nodemailer - Email notifications
- Twilio - SMS notifications
- QRCode - QR code generation
- PDFKit - PDF receipt generation
- React.js - Frontend framework
- TailwindCSS - Styling framework
- Axios - HTTP client
- React Router - Client-side routing
- Chart.js - Data visualization
- PayMongo - Primary payment processor
- GCash - Mobile wallet integration
- Maya - Digital wallet integration
- DragonPay - Alternative payment processor
Before running this application, make sure you have the following installed:
- Node.js (v18.0.0 or higher)
- npm (v9.0.0 or higher)
- PostgreSQL (v12.0 or higher)
- Redis (v6.0 or higher) - Optional, for rate limiting
git clone <repository-url>
cd las-pinas-traffic-payment-systemnpm installCopy the environment template and configure your settings:
cp env.example .envEdit the .env file with your configuration:
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=las_pinas_traffic_db
DB_USER=postgres
DB_PASSWORD=your_db_password
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_here_make_it_long_and_random
JWT_EXPIRES_IN=24h
# Server Configuration
PORT=5000
NODE_ENV=development
# Email Configuration
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
EMAIL_FROM=traffic@laspinas.gov.ph
# SMS Configuration (Twilio)
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=+1234567890
# Payment Gateway Configuration
PAYMONGO_SECRET_KEY=pk_test_your_paymongo_secret_key
PAYMONGO_PUBLIC_KEY=pk_test_your_paymongo_public_key
# Admin Default Credentials
ADMIN_EMAIL=admin@laspinas.gov.ph
ADMIN_PASSWORD=admin123456Create a PostgreSQL database:
CREATE DATABASE las_pinas_traffic_db;npm run migratenpm run seednpm run devnpm startThe application will be available at http://localhost:5000
POST /api/auth/register
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@email.com",
"phoneNumber": "+639123456789",
"password": "SecurePass123!",
"driverLicenseNumber": "DL123456789"
}POST /api/auth/login
Content-Type: application/json
{
"email": "john.doe@email.com",
"password": "SecurePass123!"
}GET /api/violations/search?ovrNumber=OVR20240115001
GET /api/violations/search?plateNumber=ABC123
GET /api/violations/search?driverLicenseNumber=DL123456789GET /api/violations/:idPOST /api/payments/initiate
Content-Type: application/json
{
"ovrNumber": "OVR20240115001",
"paymentMethod": "gcash",
"payerName": "John Doe",
"payerEmail": "john.doe@email.com",
"payerPhone": "+639123456789"
}POST /api/payments/confirm
Content-Type: application/json
{
"paymentId": "PAY20240126001",
"gatewayTransactionId": "GCASH_123456789"
}GET /api/admin/dashboard
Authorization: Bearer <admin_token>GET /api/admin/users?page=1&limit=10
Authorization: Bearer <admin_token>- JWT Authentication: Secure token-based authentication
- Password Hashing: bcryptjs for secure password storage
- Rate Limiting: Protection against brute force attacks
- Input Validation: Comprehensive request validation
- CORS Protection: Cross-origin resource sharing security
- Helmet.js: Security headers middleware
- SQL Injection Protection: Sequelize ORM with parameterized queries
- XSS Protection: Input sanitization and output encoding
- User authentication and profile information
- Role-based access control (citizen, enforcer, admin)
- Traffic violation records
- Vehicle and driver information
- Fine calculation and status tracking
- Payment transaction records
- Gateway integration data
- Receipt generation and QR codes
npm testnpm run test:coverageEnsure all environment variables are properly configured for production:
NODE_ENV=production
PORT=5000
DB_HOST=your_production_db_host
DB_PASSWORD=your_production_db_password
JWT_SECRET=your_production_jwt_secretnpm run migratenpm startIf you already deployed the frontend to GitHub Pages and forgot to rebuild with the correct REACT_APP_API_URL, you can temporarily point the app to a different backend without rebuilding:
- Open your deployed site with the desired API URL appended as a query parameter:
https://vengeth.github.io/Traffic-Management-System/?apiBaseUrl=https://your-api-domain.com - The app validates the URL (HTTPS is required unless you are targeting
localhost) and stores it securely inlocalStorageusing thetrafficApiBaseUrlOverridekey. - Subsequent visits automatically use the stored override. To clear it, run the following in the browser console:
localStorage.removeItem("trafficApiBaseUrlOverride"); window.location.reload();
Note: This override is intended as an emergency fix. Always rebuild with the correct
REACT_APP_API_URLfor long-term deployments.
- Create a PayMongo account
- Get your API keys from the dashboard
- Configure webhook endpoints
- Update environment variables
- Register as a GCash merchant
- Configure API credentials
- Set up webhook notifications
- Configure SMTP settings in
.env - Set up email templates
- Test email delivery
- Create a Twilio account
- Get your Account SID and Auth Token
- Configure phone number
- Test SMS delivery
All API responses follow a consistent format:
{
"success": true,
"message": "Operation completed successfully",
"data": {
// Response data
}
}Error responses:
{
"success": false,
"message": "Error description",
"error": "ERROR_CODE"
}- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Email: support@laspinas.gov.ph
- Phone: +63 2 1234 5678
- Documentation: API Documentation
- Backend API development
- Database schema design
- Authentication system
- Payment gateway integration
- Email/SMS notifications
- Frontend React application
- Admin dashboard
- Mobile responsive design
- Advanced reporting
- Mobile PWA
- AI-powered analytics
- Integration with government systems
- Multi-language support
- Node.js: v18.0.0+
- PostgreSQL: v12.0+
- RAM: 2GB+
- Storage: 10GB+
- Node.js: v20.0.0+
- PostgreSQL: v15.0+
- Redis: v7.0+
- RAM: 4GB+
- Storage: 50GB+
- Database backups
- Log rotation
- Security updates
- Performance monitoring
- Payment gateway reconciliation
- Application health checks
- Database performance monitoring
- Payment transaction monitoring
- Error tracking and alerting
Las PiΓ±as Traffic Online Payment System - Streamlining traffic violation management for the City of Las PiΓ±as.
Developed by The Heedful