A robust User Management System built with Node.js, Express, and MongoDB featuring role-based access control and secure authentication flows.
- Role-Based Access Control (Admin/User)
- Secure Authentication with session management
- Email Verification workflow
- Password Hashing & token generation
- MVC Architecture for clean code organization
- Middleware Integration for request handling
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose
- Authentication: Session-based with security layers
- Architecture: MVC Pattern
ums/
βββ models/ # Database models
βββ views/ # Frontend templates
βββ controllers/ # Business logic
βββ routes/ # Application routes
β βββ userRoute.js # User routes
β βββ adminRoute.js # Admin routes
βββ middleware/ # Custom middlewares
βββ public/ # Static assets
βββ config/ # Configuration files
- Clone the repository
git clone https://github.com/your-username/user-management-system.git
cd user-management-system- Install dependencies
npm install- Start MongoDB
mongod- Run the application
npm start- Access the application
User Panel: http://localhost:3000
Admin Panel: http://localhost:3000/admin
- MVC Pattern: Clear separation of Models, Views, and Controllers
- Middleware Power: Strategic request processing at different layers
- Folder Structure: Impact on code maintainability and scalability
- Multi-layer Authentication: Multiple security checks for robust protection
- Session Management: Secure user session handling
- Password Security: Hashing and token generation best practices
- Email Verification: Complete user verification workflow
- Role-Based Permissions: Different access levels for Admin and Users
- Route Protection: Secure endpoint access based on user roles
- User Registration with email verification
- Secure Login with session creation
- Role-based Authorization for different access levels
- Protected Routes with middleware checks
- Secure Logout with session destruction
GET /- Home pageGET /login- User loginGET /register- User registrationPOST /verify-email- Email verification
GET /admin- Admin dashboardGET /admin/users- User managementPOST /admin/users- User operations
- β User Registration & Email Verification
- β Secure Login/Logout System
- β Admin & User Role Separation
- β Session-based Authentication
- β Password Security with Hashing
- β Protected Routes with Middleware
Feel free to contribute to this project by submitting issues or pull requests.
This project is open source and available under the MIT License.