{"id":19040501,"url":"https://github.com/zakircodearchitect/mern-role-based-access","last_synced_at":"2026-06-19T04:31:39.486Z","repository":{"id":259730193,"uuid":"879008065","full_name":"ZakirCodeArchitect/MERN-Role-Based-Access","owner":"ZakirCodeArchitect","description":"This backend authentication system, built with the MERN stack, provides user login, registration, and role-based access control. Users can register as admin, manager, or user, with each role having specific permissions and access to resources. Designed for use in educational applications where access is controlled based on user roles.","archived":false,"fork":false,"pushed_at":"2024-10-27T16:03:10.000Z","size":3369,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T22:32:56.404Z","etag":null,"topics":["backend-api","express-middleware","javascript","jwt-auth","jwt-authentication","jwt-tokens","nodejs-server","role-based-access-control","server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZakirCodeArchitect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-26T17:54:02.000Z","updated_at":"2024-10-27T16:03:13.000Z","dependencies_parsed_at":"2024-10-27T16:54:47.806Z","dependency_job_id":"b8ae1b28-ecaf-426d-a2de-5e78712ebd06","html_url":"https://github.com/ZakirCodeArchitect/MERN-Role-Based-Access","commit_stats":null,"previous_names":["zakircodearchitect/mern-role-based-access"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ZakirCodeArchitect/MERN-Role-Based-Access","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZakirCodeArchitect%2FMERN-Role-Based-Access","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZakirCodeArchitect%2FMERN-Role-Based-Access/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZakirCodeArchitect%2FMERN-Role-Based-Access/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZakirCodeArchitect%2FMERN-Role-Based-Access/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZakirCodeArchitect","download_url":"https://codeload.github.com/ZakirCodeArchitect/MERN-Role-Based-Access/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZakirCodeArchitect%2FMERN-Role-Based-Access/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34517748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend-api","express-middleware","javascript","jwt-auth","jwt-authentication","jwt-tokens","nodejs-server","role-based-access-control","server"],"created_at":"2024-11-08T22:23:03.567Z","updated_at":"2026-06-19T04:31:39.465Z","avatar_url":"https://github.com/ZakirCodeArchitect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MERN Authentication \u0026 Role-Based Access Control (RBAC) System\n\nThis project is a backend authentication system built with the MERN stack, designed for educational applications. It supports role-based access control (RBAC) with roles such as `admin`, `user`, and `manager`, allowing specific features to be restricted based on the user's role.\n\n## Features\n\n- 🔑 **User Authentication**: Register and log in with JWT for session management.\n- 🛡 **Role-Based Access Control**: Restrict access based on roles.\n- 🔒 **Protected Routes**: Middleware to control route access by role.\n- 🗝 **Password Hashing**: Secure password storage using bcrypt.\n- ⚠️ **Error Handling**: Consistent, secure API responses.\n\n## Tech Stack\n\n- **Backend**: Node.js, Express\n- **Database**: MongoDB with Mongoose\n- **Authentication**: JSON Web Tokens (JWT), bcrypt\n\n## Prerequisites\n\n- [Node.js](https://nodejs.org/)\n- [MongoDB](https://www.mongodb.com/)\n\n## Getting Started\n\nFollow these instructions to set up and run the project locally.\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/your-username/mern-auth-rbac.git\ncd mern-auth-rbac\n\n## API Endpoints\n\n### Auth Routes\n\n| Method | Endpoint               | Description               |\n|--------|-------------------------|---------------------------|\n| POST   | `/api/auth/register`    | Register a new user       |\n| POST   | `/api/auth/login`       | Login with user credentials |\n\n### User Routes\n\n| Method | Endpoint                | Description                            | Access Level       |\n|--------|--------------------------|----------------------------------------|--------------------|\n| GET    | `/api/users`             | Retrieve all users                     | Admin only        |\n| GET    | `/api/users/:id`         | Retrieve a specific user by ID         | Admin/Manager     |\n\n### Role-Based Access\n\n| Role    | Permissions                                                      |\n|---------|------------------------------------------------------------------|\n| Admin   | Full access to all routes and resources                          |\n| Manager | Access to specific management features                           |\n| User    | Limited access to general features                               |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakircodearchitect%2Fmern-role-based-access","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzakircodearchitect%2Fmern-role-based-access","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakircodearchitect%2Fmern-role-based-access/lists"}