eManager is a backend application built with Express.js and MongoDB, designed to handle user authentication, management, and resource handling efficiently. The project follows best practices for API development, including a modular architecture with controllers, middleware, and structured database models.
- User authentication (JWT-based)
- Role-based access control (RBAC)
- CRUD operations for users and resources
- Middleware for logging, error handling, and validation
- Secure password hashing with bcrypt
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ORM
- Authentication: JSON Web Tokens (JWT), bcrypt
- Middleware: Express Validator, Morgan (for logging)
eManager/
│── src/
│ ├── config/ # Configuration files (DB, environment variables)
│ ├── controllers/ # Business logic for API endpoints
│ ├── middlewares/ # Authentication, validation, error handling
│ ├── models/ # Mongoose schemas and database models
│ ├── routes/ # API route definitions
│ ├── utils/ # Helper functions
│ ├── app.js # Express app setup
│── .env.example # Environment variables template
│── package.json # Dependencies and scripts
│── README.md # Project documentation
Ensure you have the following installed:
- Node.js (v16 or later)
- MongoDB (local or cloud instance)
-
Clone the repository:
git clone https://github.com/abjerry97/emanager.git cd emanager
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.example
to.env
and update the values accordingly.
- Copy
-
Start the server:
npm start
The server will run on
http://localhost:5000
by default.
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /api/auth/register |
Register a new user | ❌ |
POST | /api/auth/login |
Authenticate user & get token | ❌ |
GET | /api/users |
Get all users (Admin only) | ✅ |
GET | /api/users/:id |
Get user by ID | ✅ |
PATCH | /api/users/:id |
Update user details | ✅ |
DELETE | /api/users/:id |
Delete user (Admin only) | ✅ |
Contributions are welcome! Please open an issue or submit a pull request with improvements.
This project is licensed under the MIT License.