{"id":17651770,"url":"https://github.com/diegovictor/notifications-service","last_synced_at":"2025-07-02T21:33:23.936Z","repository":{"id":65100106,"uuid":"580174518","full_name":"DiegoVictor/notifications-service","owner":"DiegoVictor","description":"Micro-service to handle notifications. Project developed during the Node.js Ignite Lab 4.0","archived":false,"fork":false,"pushed_at":"2025-06-02T12:29:39.000Z","size":928,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-03T01:26:28.223Z","etag":null,"topics":["api","docker","javascript","js","kafka","nestjs","node","nodejs","notifications","notifications-service","sqlite","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DiegoVictor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2022-12-19T22:39:59.000Z","updated_at":"2025-06-02T12:29:43.000Z","dependencies_parsed_at":"2025-03-12T13:34:04.802Z","dependency_job_id":"819c4ba0-31e4-4f17-8f1e-07dfa694d2b4","html_url":"https://github.com/DiegoVictor/notifications-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DiegoVictor/notifications-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fnotifications-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fnotifications-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fnotifications-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fnotifications-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/notifications-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fnotifications-service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263218458,"owners_count":23432499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","docker","javascript","js","kafka","nestjs","node","nodejs","notifications","notifications-service","sqlite","ts","typescript"],"created_at":"2024-10-23T11:43:35.113Z","updated_at":"2025-07-02T21:33:23.907Z","avatar_url":"https://github.com/DiegoVictor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Notifications Service\n[![CircleCI](https://img.shields.io/circleci/build/github/DiegoVictor/notifications-service?style=flat-square\u0026logo=circleci)](https://app.circleci.com/pipelines/github/DiegoVictor/notifications-service)\n[![sqlite3](https://img.shields.io/badge/sqlite-003b57?style=flat-square\u0026logo=sqlite\u0026logoColor=white)](https://www.sqlite.org)\n[![prisma](https://img.shields.io/static/v1?label=prisma\u0026message=6.6.0\u0026color=2d3748\u0026logo=prisma\u0026style=flat-square)](https://www.prisma.io)\n[![typescript](https://img.shields.io/badge/typescript-5.8.3-3178c6?style=flat-square\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![NestJS](https://img.shields.io/badge/nestjs-11.0.19-E0234E?style=flat-square\u0026logo=nestjs)](https://nestjs.com)\n[![eslint](https://img.shields.io/badge/eslint-9.24.0-4b32c3?style=flat-square\u0026logo=eslint)](https://eslint.org/)\n[![jest](https://img.shields.io/badge/jest-29.7.0-brightgreen?style=flat-square\u0026logo=jest)](https://jestjs.io/)\n[![coverage](https://img.shields.io/codecov/c/gh/DiegoVictor/notifications-service?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/DiegoVictor/notifications-service)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/notifications-service/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\u003cbr\u003e\n[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=Notification%20Service\u0026uri=https%3A%2F%2Fraw.githubusercontent.com%2FDiegoVictor%2Fnotifications-service%2Fmain%2FInsomnia_2025-01-07.json)\n\nSmall microservice to handle notifications, it allows you to send and cancel notifications, mark as read/unread and get the recipient notifications list.\n\n## Table of Contents\n* [Installing](#installing)\n  * [Configuring](#configuring)\n    * [SQLite](#sqlite)\n    * [Kafka](#kafka)\n      * [Script](#script)\n    * [.env](#env)\n* [Usage](#usage)\n  * [Routes](#routes)\n    * [Requests](#requests)\n* [Running the tests](#running-the-tests)\n  * [Coverage report](#coverage-report)\n\n# Installing\nEasy peasy lemon squeezy:\n```\n$ yarn\n```\nOr:\n```\n$ npm install\n```\n\u003e Was installed and configured the [`eslint`](https://eslint.org/) and [`prettier`](https://prettier.io/) to keep the code clean and patterned.\n\n## Configuring\nThe application is using just one database: [SQLite](https://www.sqlite.org/index.html). For the fastest setup is recommended to use [docker-compose](https://docs.docker.com/compose/), you just need to up all services:\n```\n$ docker-compose up -d\n```\n\nOr follow the instructions in [SQLite](#sqlite) and [Kafka](#kafka) sections.\n\n### SQLite\nIt stores all the application's data. You just need to remember to run the migrations:\n```\n$ npx prisma migrate dev\n```\n\u003e See more information on [Prisma Migrate](https://www.prisma.io/docs/concepts/components/prisma-migrate).\n\n\n### Kafka\nKafka is used to receive notifications through events:\n```\n$ docker-compose up -d zookeeper kafka\n```\n\u003e Remember to run the application manually, see [Usage](#usage)\n\n#### Script\nThe repository is shipped with a script to help you to send random notifications to Kafka:\n```\n$ node scripts/send-message.js\n```\n\n### .env\nIn this file you may configure the path to the SQLite database file and Kafka settings. Rename the `.env.example` in the root directory to `.env` then just update with your settings.\n\n|key|description|default\n|---|---|---\n|DATABASE_URL|Path to SQLite file.|`file:./dev.db`\n|KAFKA_TOPIC|Name of the Kafka's topic.|`notifications.send-notification`\n|KAFKA_BROKER|Kafka Broker URL.|`localhost:9092`\n\n# Usage\nTo start up the app run:\n```\n$ yarn start:dev\n```\nOr:\n```\nnpm run start:dev\n```\n\n## Routes\n|route|HTTP Method|params|description\n|:---|:---:|:---:|:---:\n|`/notifications`|POST|Body with notification `content`, `category` and `recipientId`.|Create a new notification.\n|`/notifications/recipient/:id`|GET|`:id` of the recipient.|Lists recipient notifications.\n|`/notifications/recipient/:id/count`|GET|`:id` of the recipient.|Count recipient notifications.\n|`/notifications/:id/cancel`|PATCH|`:id` of the notification.|Set notification as canceled.\n|`/notifications/:id/read`|PATCH|`:id` of the notification.|Set notification as read.\n|`/notifications/:id/unread`|PATCH|`:id` of the notification.|Set notification as unread.\n\n### Requests\n* `POST /notifications`\n\nRequest body:\n```json\n{\n  \"content\": \"Lorem ipsum dolor sit amet\",\n  \"category\": \"example\",\n  \"recipientId\": \"69c9a4f1-adbb-44c7-97ca-eac8eee9f029\"\n}\n```\n\n# Running the tests\n[Jest](https://jestjs.io/) was the choice to test the app, to run:\n```\n$ yarn test\n```\nOr:\n```\n$ npm run test\n```\n\n## Coverage report\nYou can see the coverage report inside `tests/coverage`. They are automatically created after the tests run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Fnotifications-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Fnotifications-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Fnotifications-service/lists"}