Giter Site home page Giter Site logo

dev-force / node-kafka-alerts Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 1.0 1.19 MB

Easily deployable (Docker), extensible (clean architecture), template-based, plug and play micro-service. Real-time (Kafka) and batch processing (using a database) of messages which allows devs to send notifications using third party tools (like twilio/sendgrid). Uses concepts from Event-Sourcing and CQRS.

TypeScript 94.35% JavaScript 1.34% Dockerfile 0.68% Shell 2.66% Handlebars 0.86% Makefile 0.11%
nodejs typescript kafka kafka-consumer clean-architecture notification-service notifications alerts docker docker-compose event-sourcing cqrs microservice

node-kafka-alerts's Introduction

node-kafka-alerts

Tired of writing code every time you need to send an alert/notification? Then this repository is made for you.

I 've given life to this repository since we usually need to notify our application users for an event. This can be for example an email or an SMS which a user should receive after a certain event has happened (either from himself/herself or from another source).

This application supports instant notifications (which are sent directly to the end-users) and two types of windowed alerts/notifications. The first is notifying the end-user once for every alert/notification we should receive but discards duplicate values for the given window dynamically. The second is that is groups all notifications sent in the last time window and uses a batch template to show them all to the end user.

Templates should be already in place by the developer who's deploying the application and they should reside in templates folder.

Installation

Development

npm install
cp .env.example .env

Change .env values to the correct ones.

Also check config/default.json file in order to change configuration values to your liking.

Production

cp .env.example .env
cp config/default.json config/production.json

Change .env values to the correct ones including setting COMPOSE_FILE variable to docker-compose.yml:docker-compose.prod.yml.

Change config/production.json file in order to change configuration values to your liking.

Commands

Make

  • make build-and-run (Build docker container and run the application)

NPM Commands

  • start:dist => node ./dist/index.js (Runs transpiled Javascript from dist folder)
  • start:watch => nodemon (Runs nodemon and listens to file changes)
  • start:dev => ts-node src/index.ts (Runs index.ts directly without any transpilation)
  • build => tsc (Transpiles Typescript to Javascript and places it to dist folder)
  • coverage => nyc -r lcov -e .ts -x "*.test.ts" npm run test (Runs tests)
  • prettier:check => prettier --check ./src (Checks if the formatting is OK)
  • prettier:format => prettier --write ./src (Formats the codebase)
  • eslint => eslint ./src (Checks for linting issues)

Features

Enforces Clean Architecture's Dependency Rule using ESLint.

Uses prettier for formatting.

Uses husky for git hooks.

Uses pm2 for production deployments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.