A backend application to manage and track poker game data. Built with Node.js, Express, and MySQL.
Pocker_Tracker_backendmysql/
├── config/ # Database and app configuration
├── controllers/ # API route handlers
├── middleware/ # Authentication & custom middleware
├── models/ # Database models (tables)
├── routes/ # API routes
├── uploads/ # File uploads
├── .env # Environment variables
├── .gitignore
├── package.json
└── poker.js # Entry point of the application
- Node.js
- Express.js
- MySQL
- dotenv
- bcryptjs (for password hashing)
- jsonwebtoken (for authentication)
Here’s an overview of the key tables:
Table Name | Description | Relationships |
---|---|---|
users |
Stores user info | user_id linked to games and transactions |
games |
Stores poker game sessions | game_id linked to transactions |
transactions |
Tracks bets, wins, and losses | user_id → users , game_id → games |
tables |
Stores poker table info | table_id → games |
chips |
Tracks chip counts per user per game | user_id → users , game_id → games |
- User ↔ Games: One user can participate in multiple games.
- Game ↔ Transactions: Each game has multiple betting transactions.
- User ↔ Chips: Each user’s chip count is tracked per game.
- Node.js v14+
- MySQL server
- Clone the repo:
git clone https://github.com/AnuragFrantic/Pocker_Tracker_backendmysql.git
cd Pocker_Tracker_backendmysql
- Install dependencies:
npm install
- Create a
.env
file:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=poker_tracker
JWT_SECRET=your_jwt_secret
- Run the app:
node poker.js
POST /api/users/register
→ Register a new userPOST /api/users/login
→ User loginGET /api/games
→ Fetch all gamesPOST /api/games
→ Create a new gamePOST /api/transactions
→ Add a new transactionGET /api/users/:id/chips
→ Get user’s chips
(Check routes/
folder for more endpoints.)
Uses JWT tokens. Users must send the token in the Authorization
header as:
Authorization: Bearer <token>
MIT License. See LICENSE for details.