π Event Management Backend System
A scalable and secure RESTful API for managing events, users, categories, and event registrations. Built with Node.js , Express.js , and MongoDB , with user authentication, OTP verification, and Google OAuth support.
Technology
Purpose
Node.js
JavaScript runtime
Express.js
Web framework
MongoDB
NoSQL database
Mongoose
MongoDB object modeling
JWT
User authentication
bcryptjs
Password hashing
Passport.js
Google OAuth login
π Authentication Features
User signup & login with email/password
Email verification via OTP
Password reset with OTP
Google OAuth login
JWT-based route protection
π API Endpoints Overview
Method
Endpoint
Description
POST
/api/auth/signup
Register new user
POST
/api/auth/signup/verifyOTP
Verify user via OTP
POST
/api/auth/signup/resendOTPVerificationCode
Resend OTP
POST
/api/auth/signup/forget_password
Request password reset OTP
POST
/api/auth/login
Login with email/password
GET
/api/auth/google
Google OAuth login
GET
/api/auth/google/callback
OAuth callback
GET
/api/auth/logout
Logout
Method
Endpoint
Description
POST
/api/category/category
Create new category
GET
/api/category/categories
Fetch all categories
GET
/api/category/categories/:id
Get single category
PUT
/api/category/categories/:id
Update category
DELETE
/api/category/categories/:id
Delete category
Method
Endpoint
Description
POST
/api/event/
Create event
GET
/api/event/
List all events
GET
/api/event/:id
Get event by ID
PUT
/api/event/:id
Update event
DELETE
/api/event/:id
Delete event
π Event Registration Routes
Method
Endpoint
Description
POST
/api/registerEvent/register
Register for an event
GET
/api/registerEvent/:eventId/registrations
View all registrations for an event
authenticateUser: Protects private routes using JWT.
Passport.js for handling Google OAuth2 login.
src/
βββ config/ # DB connection, passport strategies
βββ controller/ # Business logic for routes
βββ middleware/ # JWT auth, request validation, error handlers
βββ model/ # Mongoose schemas and models
βββ route/ # All route handlers
β βββ auth/ # Auth routes (signup, login, Google)
β βββ category/ # Category CRUD routes
β βββ event/ # Event CRUD routes
β βββ registerEvent/ # Event registration routes
βββ util/ # Helper functions (e.g., OTP generator)
βββ app.js # Main Express app
βββ server.js # Server startup
Crevmick
GitHub: @crevmick
Check out the live version of this project:
π Event Management App