An open API service indexing awesome lists of open source software.

https://github.com/pintu544/backendauthsocket

Real-time dashboard application where admins can manage players and monitor their activity, while players can engage by clicking a “Banana” button and track their ranking in real-time.
https://github.com/pintu544/backendauthsocket

bcrypt expressjs jwt mongodb nodejs socket-io

Last synced: 2 months ago
JSON representation

Real-time dashboard application where admins can manage players and monitor their activity, while players can engage by clicking a “Banana” button and track their ranking in real-time.

Awesome Lists containing this project

README

          





Fruits Click Game Dashboard - Backend


This is the backend portion of the Fruits Click Game Dashboard, handling user authentication, game data management, and real-time updates for the Fruits Click Game Dashboard application.


Features




  1. User Management:

    • Admins can create, edit, delete players.

    • Blocking/unblocking players to control login access.




  2. Game Data Management:

    • Real-time update of banana click counts.

    • Endpoints for managing player data and game stats.




  3. Real-Time Communication:

    • Integrated Socket.io for real-time updates on click counts and user activity.




  4. JWT Authentication:

    • Secure login and user authentication using JSON Web Tokens.




Tech Stack




  • Node.js - Runtime environment


  • Express - Backend framework


  • MongoDB - Database


  • Socket.io - Real-time updates


  • JWT - Authentication and authorization


Setup and Installation


Clone the Repository


bash




`git clone https://github.com/pintu544/BackendAuthSocket.git
cd BackendAuthSocket`

Install Dependencies


bash




npm install

Environment Variables


Create a .env file in the root directory and configure the following variables:

`PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret`


Running the Application


To start the server, run:


bash




`npm start`

The backend should be running at http://localhost:5000.


Live Demo


The live backend demo is available here.


API Endpoints


Authentication Endpoints




  • POST /api/v1/login - User login


  • POST /api/v1/register - User registration


  • GET /api/v1/dashboard - Dashboard (authentication required)


Admin Endpoints




  • GET /api/v1/users - Get all users (admin authentication required)


  • POST /api/game/players - Create a player (admin authentication required)


  • PUT /api/game/players/:id - Edit a player (admin authentication required)


  • DELETE /api/game/players/:id - Delete a player (admin authentication required)


  • POST /api/game/block/:id - Block a player (admin authentication required)


Game Endpoints




  • POST /api/game/click - Increment player’s “banana” click count


Project Structure


bash




BackendAuthSocket/
├── db/ # Configuration files (DB, JWT)
├── controllers/ # Functions handling requests
├── middleware/ # Middleware (auth and admin checks)
├── models/ # Mongoose models (User, Game Data)
├── routes/ # API routes
├── sockets/ # Socket.io event handlers
└── app.js # Main server entry point