LASCMMG is a full-stack JavaScript application for managing billiards tournaments with real-time updates, comprehensive security, and modern web technologies.
- Tournament Management: Complete tournament lifecycle from creation to completion
- Player Management: Registration, profiles, and statistics tracking
- Real-time Updates: Live scoring and notifications via Socket.io
- Bracket Generation: Automatic match scheduling and bracket creation
- Leaderboards: Dynamic ranking and performance tracking
- Admin Dashboard: Comprehensive tools for tournament administrators
- Security First: JWT authentication, CSRF protection, rate limiting
- PWA Support: Installable, offline-capable progressive web app
- Audit Logging: Complete activity tracking and compliance features
- Performance Monitoring: Built-in metrics and slow query detection
- Runtime: Node.js 18+ with Express.js
- Database: SQLite (via better-sqlite3) with automated migrations
- Caching: Redis for sessions and performance optimization
- Authentication: JWT with secure httpOnly cookies
- Real-time: Socket.io for WebSocket communications
- Security: Helmet CSP, CSRF tokens, XSS protection, rate limiting
- Framework: React 19 with Vite for lightning-fast builds
- Styling: Tailwind CSS v4 for modern, responsive design
- Routing: React Router v7 for SPA navigation
- Forms: Formik with Yup validation
- Icons: Lucide React and React Icons
- Charts: Chart.js with React wrapper
- PWA: Service worker with offline support
- Linting: ESLint with security and React plugins
- Formatting: Prettier with consistent code style
- Testing: Vitest, React Testing Library, Cypress E2E
- Development: Nodemon for hot reloading
- Production: PM2 process management support
- Node.js 18+ LTS (v20 recommended)
- npm or pnpm package manager
- Redis server (local or Docker)
- SQLite3 (included with better-sqlite3)
# Clone the repository
git clone https://github.com/bernardopg/LASCMMG.git
cd lascmmg
# Install backend dependencies
npm install
# Install frontend dependencies
cd frontend-react && npm install && cd ..Create .env in the project root:
# Server Configuration
PORT=3000
NODE_ENV=development
# CORS Settings
CORS_ORIGIN=http://localhost:5173
# Security Keys (generate with: npm run generate-keys)
JWT_SECRET=your-64-char-random-string
COOKIE_SECRET=your-64-char-random-string
CSRF_SECRET=your-32-char-random-string
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100
# Database
DB_PATH=./backend/data/lascmmg.db
DB_BACKUP_PATH=./backend/backups/
# Redis
REDIS_URL=redis://localhost:6379
# Logging
LOG_LEVEL=info
AUDIT_LOG_ENABLED=true
# Performance
PERFORMANCE_MONITORING_ENABLED=true
QUERY_SLOW_THRESHOLD_MS=100Create frontend-react/.env:
VITE_API_BASE_URL=http://localhost:3000/api
VITE_SOCKET_URL=http://localhost:3000
VITE_APP_NAME=LASCMMG
VITE_ENV=development
VITE_ENABLE_PWA=truenpm run generate-keysnpm run setup:dbnpm run dev# Terminal 1 - Backend
npm run dev:backend
# Terminal 2 - Frontend
npm run dev:frontendOpen http://localhost:5173 in your browser
lascmmg/
βββ backend/ # Express server
β βββ server.js # Main entry point
β βββ lib/ # Core libraries
β β βββ db/ # Database and Redis
β β βββ middleware/ # Express middleware
β β βββ services/ # Business logic
β β βββ logger/ # Logging config
β β βββ performance/ # Monitoring
β βββ routes/ # API endpoints
βββ frontend-react/ # React application
β βββ src/ # React source
β βββ public/ # Static assets
β βββ package.json # Frontend deps
βββ scripts/ # Utility scripts
β βββ generate-keys.js
β βββ health-check.js
β βββ security-audit.js
βββ package.json # Root dependencies
POST /api/login- User loginPOST /api/logout- User logoutGET /api/csrf-token- Get CSRF token
GET /api/tournaments- List all tournamentsPOST /api/tournaments- Create tournamentGET /api/tournaments/:id- Get tournament detailsPUT /api/tournaments/:id- Update tournamentDELETE /api/tournaments/:id- Delete tournament
GET /api/players- List all playersPOST /api/players- Register playerGET /api/players/:id- Get player profilePUT /api/players/:id- Update player
POST /api/scores- Submit match scoresGET /api/scores/tournament/:id- Get tournament scores
GET /ping- Health checkGET /api/system/status- System statusGET /api/admin/backup- Backup managementGET /api/admin/performance- Performance metrics
- JWT Authentication: Secure token-based auth with refresh tokens
- CSRF Protection: Token validation for state-changing operations
- Rate Limiting: Configurable limits per endpoint
- Helmet CSP: Content Security Policy with per-request nonces
- XSS Protection: Input sanitization and output encoding
- SQL Injection Prevention: Parameterized queries
- Honeypot Fields: Bot detection on forms
- Secure Cookies: httpOnly, signed, SameSite strict
- Audit Logging: Complete activity tracking
# Run all tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
# Frontend tests
cd frontend-react && npm test
# E2E tests
cd frontend-react && npm run cypress:opencd frontend-react && npm run buildexport NODE_ENV=production
# Update .env with production valuespm2 start backend/server.js --name lascmmg
pm2 save
pm2 startup- HTTPS via reverse proxy (nginx/Apache)
- Strong, unique security secrets
- Redis authentication enabled
- Database backup automation
- Log rotation configured
- Monitoring and alerting setup
- Rate limits tuned for production
- CORS_ORIGIN set to production domain
# Start Redis
docker run -d --name lascmmg-redis -p 6379:6379 redis:7-alpine
# Build and run application
docker build -t lascmmg .
docker run -d --name lascmmg-app -p 3000:3000 --link lascmmg-redis lascmmgWe welcome contributions! Please follow these steps:
- 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
Please ensure:
- All tests pass
- Code follows the existing style
- Documentation is updated
- Commit messages are descriptive
This project is licensed under the MIT License - see the LICENSE file for details.
- Bernardo Pinto Gomes - Initial work and maintenance
- LASCMMG community for requirements and feedback
- Open source contributors for the amazing tools and libraries
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: For security concerns, please open a responsible disclosure issue