A Node.js backend application with modular architecture, supporting user authentication, game logic, transactions, notifications, and more.
.
├── controllers/ # Business logic for routes
├── middleware/ # Express middleware for authentication, validation, and custom responses
├── models/ # Mongoose models for MongoDB collections
├── routes/ # Express route definitions
├── utils/ # Utility functions and helpers
- admin.js: Admin-related business logic and operations.
- affiliate.js: Affiliate system logic.
- auth.js: Authentication logic (login, registration, password reset, etc.).
- firebaseToken.js: Logic for managing Firebase device tokens.
- game.js: Core game logic and operations.
- notification.js: Notification sending and management.
- round.js: Game round management.
- transaction.js: Transaction processing and business logic.
- auth.js: Authentication and validation middleware (JWT verification, registration/login param checks, admin token checks, etc.).
- customResponse.js: Custom response class for standardized API responses.
- game.js: Middleware related to game logic.
- transaction.js: Middleware for transaction validation.
- user.js: Main user schema (phone, username, password, balances, referrals, OTP, restrictions, etc.).
- admin.js, AdminXAFLog.js: Admin and admin log schemas.
- transaction.js, pendingTransaction.js, XAFTransfer.js: Transaction and transfer schemas.
- game.js, round.js, userBet.js: Game, round, and betting schemas.
- firebaseToken.js, UnregisteredUserFirebaseToken.js: Firebase device token storage.
- balanceLog.js, ReferralRewardLog.js: Logging and reward tracking.
- globalSetting.js: Global settings schema.
- index.js: Main entry point, basic health check route.
- user.js, admin.js, game.js, transaction.js, affiliate.js, firebaseToken.js, pawapaycalls.js: Route files for user management, admin, game logic, transactions, affiliate system, Firebase token management, and payment gateway callbacks.
- common.js: Utility functions for password hashing, JWT, SMS, push notifications, and more.
- errorCodes.js: Centralized error code definitions for consistent API responses.
- firebase.js, firebase-adminsdk.json: Firebase admin SDK setup.
- game.js: Game-related utility functions.
- notificationTemplates.js: Templates for notifications.
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file with your MongoDB URI, JWT secret, Twilio credentials, and other required secrets.
- Create a
-
Run the server:
npm start
-
API Endpoints:
- See the
routes/
folder for available endpoints (user, admin, game, transaction, etc.).
- See the
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT (or specify your license)