A comprehensive poker session management application designed for tracking buy-ins, credits, payouts, and session history for casual poker games. Built with a modern React frontend and Express.js backend.
- Create and manage poker sessions with creator tracking
- Real-time session monitoring with active/inactive status
- Session archiving for historical record keeping
- Comprehensive search and filtering with pagination
- Add players dynamically to ongoing sessions
- Track individual buy-ins with timestamped history
- Credit system for player-to-player transactions
- Automated net balance calculations
- Cash-out management with final chip counts and payouts
- Multi-language support (Portuguese, English, Spanish)
- Multi-currency support (BRL, USD, EUR)
- Dark/Light theme toggle
- Responsive design for desktop and mobile
- Real-time data updates with optimistic UI
- Comprehensive error handling with user-friendly messages
- JWT-based authentication with secure session management
- SQLite database with automatic schema migration
- RESTful API with comprehensive error handling
- Type-safe development with TypeScript
- Modern development tools with hot reloading
- React 19 with TypeScript
- Vite for build tooling and development server
- Tailwind CSS for styling
- Framer Motion for animations
- React Router for navigation
- Axios for API communication
- React Hot Toast for notifications
- Lucide React for icons
- Node.js with Express.js
- SQLite with sqlite3 driver
- JWT for authentication
- bcrypt for password hashing
- CORS and rate limiting for security
- ESM modules throughout
- ESLint with TypeScript support
- Prettier for code formatting
- Concurrently for running multiple processes
- Nodemon for backend hot reloading
- Node.js >= 18.0.0
- npm >= 8.0.0
git clone https://github.com/yourusername/friday-night-poker.git
cd friday-night-poker# Install all dependencies (root, client, and server)
npm run install:allCreate a .env file in the server directory:
PORT=4000
JWT_SECRET=your-super-secret-jwt-key-here
NODE_ENV=development# Development mode (starts both client and server)
npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend: http://localhost:4000
# Navigate to server directory and create a user
cd server
node scripts/createUser.jsfriday-night-poker/
βββ client/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ contexts/ # React contexts (Auth, Preferences)
β β βββ hooks/ # Custom React hooks
β β βββ pages/ # Route components
β β βββ services/ # API service layer
β β βββ types/ # TypeScript type definitions
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ package.json
βββ server/ # Express.js backend application
β βββ controllers/ # Request handlers
β βββ lib/ # Database configuration
β βββ middleware/ # Express middleware
β βββ routes/ # API routes
β βββ scripts/ # Utility scripts
β βββ services/ # Business logic layer
β βββ package.json
βββ package.json # Root package.json
npm run dev # Start both client and server in development mode
npm run build # Build the client for production
npm run lint # Lint both client and server
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
npm run format:check # Check code formatting
npm run type-check # Run TypeScript type checking
npm run install:all # Install dependencies for all workspacescd client
npm run dev # Start Vite development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Lint frontend code
npm run type-check # TypeScript type checkingcd server
npm run dev # Start server with nodemon
npm start # Start server in production mode
npm run lint # Lint backend codeThe application uses SQLite with the following main tables:
id- Primary keyis_active- Session status (boolean)created_at- Creation timestampcreated_by- Creator name (optional)deleted_at- Soft deletion timestamp
id- Primary keysession_id- Foreign key to sessionsname- Player namenet_balance- Calculated balance (buy-ins - credits)buy_ins_log- JSON array of buy-in historycredits_log- JSON array of credit historyis_active- Player statusfinal_chip_count- Chips at cash-outpayout- Final payout amount
id- Primary keyemail- User email (unique)password_hash- Hashed passwordrole- User role (default: 'user')created_at- Creation timestamp
POST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user
GET /api/sessions- List sessions with paginationPOST /api/sessions- Create new sessionGET /api/sessions/:id- Get session detailsPUT /api/sessions/:id/end- End sessionDELETE /api/sessions/:id- Archive sessionGET /api/sessions/archived- List archived sessions
GET /api/sessions/:id/players- List session playersPOST /api/sessions/:id/players- Add player to sessionPOST /api/sessions/:id/buyins- Register buy-inPOST /api/sessions/:id/credits- Register credit transferPOST /api/sessions/:id/cashout- Cash out player
The application supports multiple languages:
- Portuguese (pt) - Default
- English (en)
- Spanish (es)
Currency support:
- Brazilian Real (BRL)
- US Dollar (USD)
- Euro (EUR)
The application includes:
- Light theme (default)
- Dark theme
- System preference detection
- Persistent theme selection
- JWT-based authentication with secure HTTP-only cookies
- Password hashing using bcrypt
- Rate limiting on API endpoints
- CORS protection with configurable origins
- Input validation and sanitization
- SQL injection protection using parameterized queries
Set the following environment variables for production:
NODE_ENV=production
PORT=4000
JWT_SECRET=your-super-secret-production-jwt-key# Build the client
npm run build
# The built files will be in client/dist/
# Serve them with your preferred static file serverThe SQLite database file is automatically created in server/data/poker.sqlite. Ensure this directory is writable and backed up regularly.
- 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
- Follow ESLint and Prettier configurations
- Use TypeScript for type safety
- Write meaningful commit messages
- Add tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with modern web technologies
- Inspired by the need for better poker session management
- Community feedback and contributions welcome
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
Happy Poker Night! π°