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.
- Host: GitHub
- URL: https://github.com/pintu544/backendauthsocket
- Owner: pintu544
- Created: 2024-11-07T17:05:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T02:17:05.000Z (over 1 year ago)
- Last Synced: 2025-01-21T14:47:32.939Z (over 1 year ago)
- Topics: bcrypt, expressjs, jwt, mongodb, nodejs, socket-io
- Language: JavaScript
- Homepage: https://backendauthsocket.onrender.com
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
-
User Management:
- Admins can create, edit, delete players.
- Blocking/unblocking players to control login access.
-
Game Data Management:
- Real-time update of banana click counts.
- Endpoints for managing player data and game stats.
-
Real-Time Communication:
- Integrated Socket.io for real-time updates on click counts and user activity.
-
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