notize

MIT License

Stars
0

notize

notize is basic TypeScript notify template for multiple notifiers like email, sms, etc. Notifiers listen to their own queue and send notifications according to their own functioning as soon as a message is received as follows.

Json notify schema:

{
    template: "PLAIN_TEXT | <another template name>", // if it is "PLAIN_TEXT" we don't use any template, we send data directly.
    from: {}, // Sender info
    to: {},  // Reciver info
    data: {
        // Words to change and their values in the template
        // key: value,
        // or just string for "PLAIN_TEXT" type
    },
    date: ""// the date the message was sent to the queue, it is optional.
}

Table of Contents:

Folder Structure

.
 docker-compose.yml
 LICENSE
 nodemon.json
 package.json
 package-lock.json
 README.md
 sample.env
 build
 src
  ConfigService.ts
  Constants
   Notifier.ts
   Queue.ts
  index.ts # Start point, read configration and consume notifiers
  Interfaces.ts
  Notifiers # Notify adaptors, they are implements INotifier.
   MailNotfier.ts
  QueueAdapter.ts # RabbitMQ client
 tsconfig.json

Usage

Installation

Install the source code

git clone [email protected]:saracalihan/notize.git
cd notize

Install depencencies

npm i

Set Environment Variables

Copy sample.env to .env file then set environment variables like RabbitMQ settings.

cp sample.env .env

Start Queues

We use RabbitMQ on Docker for message queues.

docker compose up -d

Run Project

For development:

Restarts project when a file is saved.

npm run start:dev

For production:

Build TypeScript code to JavaScript.

npm run build

Run code

npm run start

Contribution

License

This project is under the MIT License.

Related Projects