This is the backend service for managing chess games played between users and robotic chess players. Built with Node.js, Express.js, and MongoDB, it provides RESTful APIs to manage robots, games, moves, and retrieve various statistics.
This backend system powers a robotic chess teaching platform, enabling teachers and developers to:
-
Manage robots with their statuses and performance statistics.
-
Track and manage chess games between students and robots.
-
Record and manipulate individual chess moves.
-
Retrieve useful statistics about games, students, and robots.
-
Robot Management: CRUD operations for chess-playing robots.
-
Game Management: Track games, their status, results, and associated robot/student.
-
Move Management: Record, update, and delete moves within games.
-
Statistics: Aggregate statistics on performance, win rates, top players, and more.
-
Node.js – Backend runtime
-
Express.js – Web framework
-
MongoDB – NoSQL database
-
Mongoose – ODM for MongoDB
-
dotenv – Environment variable management
-
helmet – Security middleware
-
cors – Cross-Origin Resource Sharing
-
express-validator – Input validation
-
morgan – HTTP request logging
Follow these steps to set up the backend locally:
# Clone the repository
git clone https://github.com/RoboKnight-INSAT/TeacherDashboard-Backend.git
# Navigate to the TeacherDashboard-Backend folder
cd TeacherDashboard-Backend
# Install dependencies
npm install
# Create a .env file in the root directory and add the following:
PORT=5000
NODE_ENV=development
MONGO_URI= #this is a secret url contact for more info, but you can create your own MongoDB cluster and it would work fine
# Start the development server
npm run dev-
GET /api/robots: Get a paginated list of robots (with filters). -
GET /api/robots/:id: Get details of a specific robot. -
POST /api/robots: Create a new robot. -
PUT /api/robots/:id: Update robot details. -
DELETE /api/robots/:id: Delete a robot (only if not assigned to games).
-
GET /api/games: Get a list of games (filterable by robot, student, status). -
GET /api/games/:id: Get details and moves of a specific game. -
POST /api/games: Create a new game and assign a robot. -
PUT /api/games/:id: Update game status or info. -
DELETE /api/games/:id: Delete a game and release the robot.
-
GET /api/moves/game/:gameId: Get all moves for a game. -
GET /api/moves/:id: Get a specific move. -
POST /api/moves: Add a move to a game. -
PUT /api/moves/:id: Update a move. -
DELETE /api/moves/:id: Delete a move.
-
GET /api/stats: Get overall system statistics. -
GET /api/stats/robots: Get statistics per robot. -
GET /api/stats/students: Get statistics per student.
backend/
├── controllers/ # API logic for each entity
├── models/ # Mongoose models (Robot, Game, Move)
├── routes/ # Route definitions
├── middleware/ # Custom middleware (e.g., error handling, validation)
├── config/ # Configuration and DB connection
├── .env # Environment variables
├── server.js # Server entry point
The following variables must be defined in your .env file:
| Variable | Description |
|---|---|
PORT |
Port on which the server will run |
NODE_ENV |
Environment (e.g., development, production) |
MONGO_URI |
MongoDB connection string |
For any questions or issues, please contact: +216 55253276 [email protected]