How priyanshutrivedi/gameclassix_backend works
This is a Node/Express backend for a browser-based games product, with single-player game assistance, multiplayer rooms, accounts, profiles, leaderboards, and per-game statistics. A typical flow is a client request routed by the server to a game controller, which may call a game helper or update a statistics model; room play also uses Socket.IO events and shared in-memory room state. The excerpts show several controller relationships directly; other controller-to-helper/model links are supported by the SOURCE INDEX. Unshown controller behavior and storage wiring are not inferred.
Main entry points: index.js HTTP and Socket.IO server · authController.js Authentication · BingoController.js Bingo API · DotAndBoxesController.js Dots and Boxes API
Components 27
API and realtime
- HTTP and Socket.IO server
index.js - Room endpoints
controllers/RoomController.js
Game logic
- Bingo API
controllers/BingoController.js - Dots and Boxes API
controllers/DotAndBoxesController.js - Minesweeper API
controllers/MinesweeperController.js - Sudoku API
controllers/SudokuController.js - Tic-Tac-Toe API
controllers/TicTacToeController.js - Bingo board and move logic
HelperFunctions/Bingo/Bingo_FindOptimalNumber.js - Bingo board generator
HelperFunctions/Bingo/Bingo_createRandomBoard.js - Dots move logic
HelperFunctions/DotAndBoxes/DotAndBoxes_FindOptimalMove.js - Minefield generator
HelperFunctions/Minesweeper/Minesweeper_FindRandomBoardBoard.js - Sudoku generator
HelperFunctions/Sudoku/Sudoku_RandomSolvableSudokuWithSolution.js - Difficulty-based moves
HelperFunctions/TicTacToe/TicTacToe_FindMoveAccToDifficulty.js - Optimal move logic
HelperFunctions/TicTacToe/TicTacToe_FindOptimalMove.js
Accounts and rankings
- Authentication
controllers/authController.js - Profile management
controllers/profileController.js - Leaderboards
controllers/LeaderBoardController.js - User records
models/user.js
Game statistics
- Bingo statistics
models/BingoStats.js - Dots statistics
models/DotBoxesStats.js - Minesweeper statistics
models/MinesweeperStats.js - Sudoku statistics
models/SudokuStats.js - Tic-Tac-Toe statistics
models/TicTacToeStats.js
Runtime state
- Room state
shared.js - Database connection
db/db.js - Token verification
middlewares/verifyToken.js
Other components
- Game client
Connections 34
- Game client → HTTP and Socket.IO server: sends requests
- HTTP and Socket.IO server → Authentication: routes auth
index.js - HTTP and Socket.IO server → Profile management: routes profiles
index.js - HTTP and Socket.IO server → Leaderboards: routes rankings
index.js - HTTP and Socket.IO server → Bingo API: routes bingo
index.js - HTTP and Socket.IO server → Dots and Boxes API: routes dots
index.js - HTTP and Socket.IO server → Minesweeper API: routes minesweeper
index.js - HTTP and Socket.IO server → Sudoku API: routes sudoku
index.js - HTTP and Socket.IO server → Tic-Tac-Toe API: routes tic-tac-toe
index.js - HTTP and Socket.IO server → Room endpoints: routes rooms
index.js - HTTP and Socket.IO server → Room state: reads and updates
index.js - Room endpoints → Room state: checks room state
controllers/RoomController.js - Authentication → User records: creates and queries
controllers/authController.js - Authentication → Bingo statistics: creates and reads
controllers/authController.js - Authentication → Dots statistics: creates and reads
controllers/authController.js - Authentication → Minesweeper statistics: creates and reads
controllers/authController.js - Authentication → Sudoku statistics: creates and reads
controllers/authController.js - Authentication → Tic-Tac-Toe statistics: creates and reads
controllers/authController.js - Profile management → User records: reads and updates
controllers/profileController.js - Leaderboards → User records: aggregates rankings
controllers/LeaderBoardController.js - Bingo API → Bingo board and move logic: requests move
controllers/BingoController.js - Bingo API → Bingo board generator: generates board
controllers/BingoController.js - Bingo API → Bingo statistics: updates statistics
controllers/BingoController.js - Dots and Boxes API → Dots move logic: requests move
controllers/DotAndBoxesController.js - Dots and Boxes API → Dots statistics: updates statistics
controllers/DotAndBoxesController.js - Minesweeper API → Minefield generator: generates board
controllers/MinesweeperController.js - Minesweeper API → Minesweeper statistics: updates statistics
controllers/MinesweeperController.js - Sudoku API → Sudoku generator: generates puzzle
controllers/SudokuController.js - Sudoku API → Sudoku statistics: updates statistics
controllers/SudokuController.js - Tic-Tac-Toe API → Difficulty-based moves: requests move
controllers/TicTacToeController.js - Tic-Tac-Toe API → Tic-Tac-Toe statistics: updates statistics
controllers/TicTacToeController.js - Difficulty-based moves → Optimal move logic: delegates move
HelperFunctions/TicTacToe/TicTacToe_FindMoveAccToDifficulty.js - HTTP and Socket.IO server → Database connection: connects database
index.js - Dots and Boxes API → Token verification: uses verification
controllers/DotAndBoxesController.js