A comprehensive, production-ready web application for managing football field bookings, community opponent finding, and administrative operations with real-time analytics.
- Smart Field Booking System: Real-time availability checking with dynamic pricing
- Community Opponent Finding: Advanced matchmaking for teams seeking opponents
- Comprehensive Admin Dashboard: Business analytics, revenue tracking, and operational insights
- Automated Email Notifications: Booking confirmations and customer communications
- Multi-Payment Integration: VietQR, cash, and bank transfer support
- Customer Feedback System: Integrated support and feedback management
- Revenue Analytics: Real-time financial tracking and reporting
- Field Utilization Metrics: Optimize field usage and pricing strategies
- Customer Insights: Booking patterns and customer behavior analysis
- Automated Reporting: Daily, weekly, monthly, and yearly business reports
- Time Slot Management: Dynamic locking/unlocking with auto-expiry
- Customer Management: Comprehensive booking and customer history
- Feedback Management: Priority-based customer support system
- Automated Maintenance: Scheduled cleanup and data optimization
- Runtime: Node.js (v18+) with Express.js framework
- Database: MySQL (v8.0+) with Sequelize ORM for data modeling
- Authentication: JWT-based secure authentication system
- Email Service: Nodemailer with Gmail SMTP integration
- Task Scheduling: Node-schedule for automated background processes
- Security: CORS, input validation, and error handling middleware
- Framework: React 18 with TypeScript for type safety
- Build Tool: Vite for fast development and optimized builds
- Styling: Tailwind CSS with custom component library
- Routing: React Router v6 for SPA navigation
- HTTP Client: Axios with interceptors for API communication
- Form Management: React Hook Form with validation
- UI Components: Custom component library with accessibility support
- Package Management: npm with workspace support
- Code Quality: ESLint, TypeScript strict mode
- Testing: Playwright for end-to-end testing
- Documentation: Comprehensive API and setup documentation
- Node.js: v18.0.0 or higher (Download)
- MySQL: v8.0 or higher (Download)
- npm: v8.0.0 or higher (included with Node.js)
- Git: For version control (Download)
- Operating System: Windows, macOS, or Linux
- Memory: Minimum 4GB RAM (8GB recommended)
- Storage: At least 2GB free space
- Network: Internet connection for package installation
# Clone the repository
git clone https://github.com/Himlamtech/FootballFiled.git
cd FootballField
# Install all dependencies (root, backend, frontend)
npm run install:all# Ensure MySQL is running on port 3306
# Create database and user (if needed)
mysql -u root -p
CREATE DATABASE FootballField;# Copy environment template
cp .env.example .envConfigure your .env file:
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=FootballField
DB_USER=root
DB_PASSWORD=Himlam04@
# JWT Security
JWT_SECRET=your_super_secure_jwt_secret_key_here
JWT_EXPIRES_IN=7d
# Email Service (Gmail SMTP)
EMAIL_USER=himlam.cursor1@gmail.com
EMAIL_PASS=tbuq mqvt abgr mfxu
EMAIL_FROM=himlam.cursor1@gmail.com
EMAIL_SERVICE=gmail
# Server Configuration
PORT=9002
FRONTEND_PORT=9001
NODE_ENV=development
# Optional: SendGrid Alternative
USE_SENDGRID=false
SENDGRID_API_KEY=your_sendgrid_api_key# Initialize database with schema and sample data
cd backend
node database/init-database.js
cd ..# Start both frontend and backend concurrently
npm start
# Or start services individually:
npm run start:backend # Backend API (port 9002)
npm run start:frontend # Frontend UI (port 9001)- Homepage: http://localhost:9001
- Field Booking: Browse available fields and make reservations
- Opponent Finding: Post team information and find opponents
- Customer Feedback: Submit feedback and view responses
- Admin Dashboard: http://localhost:9001/admin
- Default Credentials:
- Username:
admin - Password:
admin
- Username:
- Features:
- Real-time business analytics and revenue tracking
- Field and time slot management
- Customer booking management
- Feedback and support system
- Financial reporting and insights
- Base URL: http://localhost:9002/api
- Health Check: http://localhost:9002/api/ping
- Documentation: See
docs/API_DOCUMENTATION.md
docs/API_DOCUMENTATION.md- Complete API reference with 25+ endpointsdocs/FINAL_TESTING_REPORT.md- Comprehensive testing results and system analysisREADME.md- This setup and overview guide
# Authentication
POST /api/auth/admin/login # Admin login
GET /api/auth/admin/me # Get current admin
# Field Management
GET /api/fields # Get all fields
GET /api/fields/:id # Get field by ID
GET /api/timeslots # Get available time slots
# Booking System
GET /api/bookings # Get all bookings (admin)
POST /api/bookings # Create new booking
GET /api/bookings/:id # Get booking details
PUT /api/bookings/:id # Update booking (admin)
# Opponent Finding
GET /api/opponents # Get opponent posts
POST /api/opponents # Create opponent post
DELETE /api/opponents/:id # Delete opponent post
# Feedback System
GET /api/feedback # Get all feedback (admin)
POST /api/feedback # Submit feedback
POST /api/feedback/:id/reply # Reply to feedback (admin)
# Analytics & Dashboard
GET /api/dashboard/stats # Get dashboard statistics
GET /api/dashboard/chart # Get chart data
GET /api/dashboard/bookings # Get booking history- Admin - System administrators and authentication
- Fields - Football field information (4 fixed fields)
- TimeSlots - Available time slots with dynamic pricing
- Bookings - Field reservations and payment tracking
- Opponents - Team opponent finding and matchmaking
- Feedback - Customer feedback and support system
- Optimized Indexing: Strategic indexes for performance
- Data Integrity: Foreign key constraints and validation
- Automated Cleanup: Scheduled removal of expired data
- Audit Trail: Creation and modification timestamps
FootballField/
βββ π backend/ # Node.js Backend API
β βββ π controllers/ # Business logic controllers
β βββ π models/ # Database models (Sequelize)
β βββ π routes/ # API route definitions
β βββ π utils/ # Utility functions and helpers
β βββ π config/ # Configuration files
β βββ π database/ # Database setup and migrations
β βββ π server.js # Application entry point
β βββ π package.json # Backend dependencies
β βββ π .env # Environment configuration
βββ π frontend/ # React Frontend Application
β βββ π src/
β β βββ π components/ # Reusable React components
β β βββ π pages/ # Page-level components
β β βββ π services/ # API service layer
β β βββ π utils/ # Frontend utilities
β β βββ π hooks/ # Custom React hooks
β β βββ π layouts/ # Layout components
β βββ π public/ # Static assets
β βββ π package.json # Frontend dependencies
β βββ π vite.config.ts # Vite configuration
βββ π docs/ # Documentation
β βββ π API_DOCUMENTATION.md # Complete API reference
β βββ π FINAL_TESTING_REPORT.md # Testing and analysis
βββ π tests/ # Test files (Playwright)
βββ π package.json # Root package configuration
βββ π .env.example # Environment template
βββ π cleanup.sh # Project cleanup script
βββ π README.md # This file
npm start # Start both frontend and backend
npm run install:all # Install all dependencies
npm run build # Build frontend for production
npm test # Run comprehensive tests
npm run dev # Start development modecd backend
npm start # Start production server
npm run dev # Start development server with nodemon
npm run db:init # Initialize database
npm run cleanup # Clean expired opponent datacd frontend
npm run dev # Start development server (Vite)
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- Setup: Follow installation instructions
- Development: Use
npm run devfor hot reloading - Testing: Run
npm testbefore committing - Building: Use
npm run buildfor production builds - Deployment: Follow deployment guide below
# Set production environment
export NODE_ENV=production
# Build frontend
npm run build
# Start production server
npm start-- Optimize database for production
OPTIMIZE TABLE Admin, Fields, TimeSlots, Bookings, Opponents, Feedback;
-- Create additional indexes for performance
CREATE INDEX idx_bookings_date_status ON Bookings(bookingDate, status);
CREATE INDEX idx_opponents_expire ON Opponents(expireDate);- Change default admin credentials
- Use strong JWT secret
- Enable HTTPS in production
- Configure firewall rules
- Set up database backups
- Monitor application logs
- End-to-End Testing: Playwright for user workflows
- API Testing: Comprehensive endpoint testing
- Database Testing: Data integrity and performance
- Security Testing: Authentication and authorization
# Run all tests
npm test
# Run specific test suites
npx playwright test tests/focused-system.test.js
# Generate test reports
npx playwright test --reporter=html# Check MySQL service
sudo systemctl status mysql
# Restart MySQL
sudo systemctl restart mysql
# Check database exists
mysql -u root -p -e "SHOW DATABASES;"# Check port usage
lsof -i :9001 # Frontend
lsof -i :9002 # Backend
lsof -i :3306 # MySQL
# Kill processes if needed
kill -9 <PID>- Verify Gmail app password is correct
- Check firewall settings for SMTP
- Test email configuration with simple send
- Database: Regular optimization and indexing
- Frontend: Code splitting and lazy loading
- Backend: Connection pooling and caching
- Monitoring: Set up application monitoring
- Revenue Tracking: Real-time financial analytics
- Field Utilization: Booking efficiency metrics
- Customer Satisfaction: Feedback analysis
- System Performance: Response time monitoring
- Dashboard: Real-time business insights
- Reports: Automated daily/weekly/monthly reports
- Trends: Booking patterns and seasonal analysis
- Forecasting: Revenue and demand predictions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- TypeScript: Use strict type checking
- ESLint: Follow configured linting rules
- Comments: Document complex business logic
- Testing: Include tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check
docs/directory - Issues: Create GitHub issues for bugs
- Discussions: Use GitHub discussions for questions
- Email: Contact development team
- Regular Updates: Keep dependencies updated
- Security Patches: Apply security updates promptly
- Backup Strategy: Implement regular database backups
- Monitoring: Set up application and server monitoring
# 1. Clone and setup
git clone https://github.com/Himlamtech/FootballFiled.git
cd FootballField
npm run install:all
# 2. Configure environment
cp .env.example .env
# Edit .env with your settings
# 3. Initialize database
cd backend && node database/init-database.js
# 4. Start application
npm start
# 5. Access application
# Frontend: http://localhost:9001
# Admin: http://localhost:9001/admin (admin/admin)
# API: http://localhost:9002/apiπ Your Football Field Management System is now ready for production use!