An open API service indexing awesome lists of open source software.

https://github.com/nandanaraju/backend_assignment

This is a RESTful API for managing users, groups, and notifications. It enables user profile creation, group management, and automatic notifications when a new member joins a group.
https://github.com/nandanaraju/backend_assignment

expressjs mongoose nodejs postman

Last synced: 3 months ago
JSON representation

This is a RESTful API for managing users, groups, and notifications. It enables user profile creation, group management, and automatic notifications when a new member joins a group.

Awesome Lists containing this project

README

          

# πŸ‘€ User & πŸ‘₯ Group Management API

## πŸ“š Overview
This is a RESTful API for managing users, groups, and πŸ”” notifications. It enables user profile creation, group management, and automatic notifications when a new member joins a group.

## πŸ› οΈ Tech Stack
- **Backend:** Node.js, Express.js
- **Database:** MongoDB with Mongoose ORM πŸ’
- **Authentication:** JWT πŸ”’ (Future enhancement)
- **Testing:** Postman πŸš€ (for API request validation)

## πŸš€ Installation
1. **πŸ“₯ Clone the repository:**
```sh
git clone https://github.com/nandanaraju/Backend_Assignment.git
cd Backend_Assignment
```

2. **πŸ“¦ Install dependencies:**
```sh
npm install
```
3. **βš™οΈ Create a `.env` file** and add MongoDB connection:
```env
PORT=5000
MONGO_URI=mongodb://localhost:27017/task_backend
```
4. **πŸš€ Start the server:**
```sh
node app.js
```

## πŸ“‘ API Endpoints
### πŸ‘€ User Management
| Method | Endpoint | Description |
|--------|------------------|-------------------------|
|βž• POST | `/api/users` | Create a new user |
|πŸ“‹ GET | `/api/users` | Retrieve all users |
| ✏️ PUT | `/api/users/:id` | Update a user's details |
|πŸ—‘οΈ DELETE | `/api/users/:id` | Delete a user |

### πŸ‘₯ Group Management
| Method | Endpoint | Description |
|--------|------------------------------|----------------------------------|
|βž•POST | `/api/groups` | Create a new group |
|βž• POST | `/api/groups/:groupId/addMember` | Add a member to a group |

### πŸ”” Notification Management
| Method | Endpoint | Description |
|--------|-----------------------------|--------------------------------|
|πŸ“‹ GET | `/api/notifications/:userId` | Retrieve notifications for a user |
|✏️ PUT | `/api/notifications/:id/read` | Mark notification as read |
|πŸ—‘οΈ DELETE | `/api/notifications/:id` | Delete a notification |

## πŸ“ˆ Scalability Considerations
- **πŸ—‚οΈ Database Indexing:** Indexed `email` in User schema for fast lookups.
- **🧩 Microservices:** Separate User, Group, and Notification into independent services.
- **⚑ Caching:** Use Redis for frequent queries like user profile fetches.

## πŸ§ͺ Testing with Postman
1. **Published Link** : [Link](https://documenter.getpostman.com/view/36810693/2sAYX3sPKU)
2. **πŸ” Replace `:id`, `:userId`, and `:groupId` with actual values**
3. **πŸš€ Run requests and validate responses**