How distortion-12/esports-arena works
Project Type and Purpose
• This is a full-stack MERN (MongoDB, Express.js, React, Node.js) web application called “eSports Arena.”
• Purpose: allow users to discover official esports tournaments, create and manage community events, register/participate in scrims, and view live scorecards.
File Structure Analysis
• Monorepo with two top-level folders:
• backend/ – Node.js + Express server
– index.js (server entry point)
– routes/ (auth, players, tournaments, users)
– middleware/auth.js (JWT verification)
– models/ (Mongoose schemas for User, Player, Tournament)
– utils/sendEmail.js (Nodemailer OTP service)
• frontend/ – React single-page app
– public/ (static HTML, manifest, robots)
– src/
· components/ (Header, Footer, TournamentCard, etc.)
· pages/ (Home, Dashboard, Auth, TournamentDetail, LiveWatch, etc.)
· hooks/useAuth.js (auth state & token management)
· App.js, PrivateRoute.js, index.js
• Config: package.json, .gitignore in both folders; frontend uses React Router + Axios; backend uses environment variables for MongoDB, JWT, email.
README Highlights
• Key features: user registration/login with OTP email, protected routes, official vs. community events, tournament management, personal dashboard.
• Tech stack: React (frontend), Express/Node (backend), MongoDB/Mongoose, JWT, bcryptjs, Nodemailer (Gmail).
• Deployment runtimes: frontend on http://localhost:3000, backend on http://localhost:5000.
a. Main Components
• React Frontend
• Express/Node Backend API
• MongoDB Database
• External Email Service (Gmail via Nodemailer)
• Authentication Layer (JWT + bcryptjs)
b. Component Relationships
1. User interacts with React app in browser.
2. React makes HTTP requests to Express API (public & protected endpoints).
3. Express middleware verifies JWT (auth.js) for protected routes.
4. Express controllers (routes/) perform CRUD on MongoDB via Mongoose models.
5. On signup/login, backend sends OTP email through sendEmail util (Nodemailer → Gmail SMTP).
c. Architectural Patterns & Principles
– Client-Server (RESTful API)
– Layered Architecture:
• Presentation (React UI)
• Application (Express routing + middleware)
• Data (MongoDB via Mongoose)
– Separation of Concerns: models vs. routes vs. middleware vs. utils
– Secure authentication (JWT tokens + protected routes)
d. Key Technologies & Frameworks
– React.js + React Router + Axios
– Express.js + Node.js
– MongoDB + Mongoose
– JSON Web Tokens (JWT)
– bcryptjs (password hashing)
– Nodemailer (email OTP)