https://github.com/paoloprodossimolopes/node-microservice-notification
⚙️🔔 Node.js microservice using NestJS, TypeScript, and Prisma for notification management ⚙️🔔
https://github.com/paoloprodossimolopes/node-microservice-notification
ddd microservice nestjs node prisma testing typescript
Last synced: about 1 year ago
JSON representation
⚙️🔔 Node.js microservice using NestJS, TypeScript, and Prisma for notification management ⚙️🔔
- Host: GitHub
- URL: https://github.com/paoloprodossimolopes/node-microservice-notification
- Owner: PaoloProdossimoLopes
- Created: 2024-03-12T02:57:57.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T03:24:18.000Z (about 2 years ago)
- Last Synced: 2025-01-24T18:46:06.379Z (about 1 year ago)
- Topics: ddd, microservice, nestjs, node, prisma, testing, typescript
- Language: TypeScript
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Notifications
This is a Node.js microservice built with NestJS, TypeScript, and Prisma for efficient notification management. It supports creating, reading, unreading, canceling, and listing notifications for users, as well as counting a user's notifications.
[](https://insomnia.rest/run/?label=Node%20Notifications%20microservice&uri=https%3A%2F%2Fgithub.com%2FPaoloProdossimoLopes%2Fnode-microservice-notification%2Fblob%2Fmain%2FInsomnia.json)
## Features
- Create notifications
- Read notifications
- Mark notifications as unread
- Cancel notification sending
- List a user's notifications
- Count a user's notifications
## Installation
1. Clone the repository:
```bash
git clone https://your-repository-url.git
cd node-microservice-notification
```
2. Install dependencies:
```bash
npm install
```
3. Set up your environment variables:
Copy the `.env.example` file to a new file named `.env` and fill in your database and other environment settings.
4. Run the Prisma migrations:
```bash
npx prisma migrate dev
```
## Usage
To start the server in development mode, run:
```bash
npm run start:dev
```
For production mode, first build the project:
```bash
npm run build
```
Then start the server:
```bash
npm run start:prod
```
## Testing
To run the tests:
```bash
npm test
```
## API Endpoints
The service defines the following API endpoints:
- POST `/notifications` - Create a new notification
- GET `/notifications/to/:recipientId` - List all notifications sended to user
- GET `/notifications/to/:recipientId/count` - Count all notifications sended to user
- PATCH `/notifications/:notificationId/read` - Mark a notification as read
- PATCH `/notifications/:notificationId/unread` - Mark a notification as unread
- PATCH `/notifications/:notificationId/cancel` - Cancel a notification already sended
## Contributing
Contributions are welcome! Please feel free to submit a pull request.
## License
This project is unlicensed and free for use.