Please sign in to access this page

 User Dashboard with Role-Based Access using Express & MongoDB

User Dashboard with Role-Based Access using Express & MongoDB

1 devlog
1h 42m
Created by Mahir

his is a user authentication dashboard built using Express.js, MongoDB, and EJS templating. It includes:

User signup and login functionality

Session-based authentication using express-session

Protected routes like /dashboard accessible only after login

Admin-only route (/admin) using role-based authorization

Light UI created using EJS and Bootstrap

Technologies used:

Node.js

Express.js

MongoDB

EJS for templating

Bootstrap for styling

This project helps me practice real-world Express concepts like session handling, middleware, route protection, and database integration.

Timeline

Set up project structure using Express. Configured MongoDB and created a User model with Mongoose.
Built authentication routes for login and signup. Implemented session using express-session and connect-mongo.
Created a protected dashboard route that only works after login. Designed views using EJS templates.
Implemented role support in users and created a middleware to protect admin-only routes. Admins now have access to /admin while normal users are denied.

Update attachment