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.
- Host: GitHub
- URL: https://github.com/nandanaraju/backend_assignment
- Owner: nandanaraju
- Created: 2025-02-02T17:33:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-02T17:50:16.000Z (about 1 year ago)
- Last Synced: 2025-02-02T18:31:14.340Z (about 1 year ago)
- Topics: expressjs, mongoose, nodejs, postman
- Language: JavaScript
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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**