Coder Social home page Coder Social logo

harshbalwanix / reminderservice Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 105 KB

This repository houses the source code for an email reminder service built with Node.js and Express. It utilizes Sequelize for database interactions, Nodemailer for email functionality, Cron for job scheduling, and RabbitMQ for message queuing.

JavaScript 100.00%
amqp cron expressjs nodejs nodemailer rabbitmq sequelize

reminderservice's Introduction

Email Reminder Service

This repository contains the code for an email reminder service built using Node.js and Express. The service is designed to send email reminders at specified times.

Table of Contents

Getting Started

Prerequisites

  • Node.js installed
  • NPM installed
  • A message broker (e.g., RabbitMQ) for message queue functionality

Installation

  1. Clone the repository:
git clone https://github.com/your-username/your-repo.git
  1. Install dependencies:
npm install
  1. Configure your environment variables by creating a .env file based on the provided .env.example.
  2. Run the application:
npm start

Project Structure

The project is organized as follows:

index.js: Entry point of the application. controllers/: Contains the ticket controller. config/: Configuration files, including server configuration. models/: Defines the Notification Ticket model using Sequelize. repository/: Handles database interactions for tickets. services/: Email service and related functions. utils/: General utility functions and the job scheduler. messageQueue.js: Handles interactions with the message queue.

Tech Stack

  • Node.js: Server-side JavaScript runtime
  • Express: Web framework for Node.js
  • Sequelize: Promise-based Node.js ORM for PostgreSQL, MySQL, MariaDB, SQLite, and MSSQL
  • Nodemailer: Module for sending emails with Node.js
  • Cron: Library for scheduling tasks in Node.js
  • AMQP (RabbitMQ): Message broker for handling message queues

Usage

The application exposes an API endpoint for creating tickets (POST /api/v1/tickets) to register email reminders. The job scheduler periodically checks for pending reminders and sends emails accordingly.

Configuration

The application uses environment variables for configuration. The configuration file is located in config/serverConfig.js. Make sure to set the required variables in your .env file.

Components

Server Setup

The index.js file sets up the Express server, initializes middleware, defines API routes, and starts the server.

Ticket Controller

The controllers/ticket-controller.js file contains the logic for creating a ticket, which represents an email reminder.

Server Configuration

The config/serverConfig.js file manages the server configuration, including port, email credentials, and message broker details.

Email Configuration

The config/emailConfig.js file configures the nodemailer transporter with the email credentials.

Notification Ticket Model

The models/notificationticket.js file defines the Sequelize model for the Notification Ticket.

Ticket Repository

The repository/ticketrepository.js file handles interactions with the database for ticket-related operations.

Email Service

The services/email-service.js file contains functions for sending basic emails, fetching pending emails, updating tickets, creating notifications, and subscribing to events.

Job Scheduler

The utils/job.js file sets up a cron job to periodically check for pending emails and send reminders.

Message Queue

The utils/messageQueue.js file handles interactions with the message queue, including creating channels, subscribing to messages, and publishing messages.

Feel free to customize and extend the functionality as needed for your use case!

reminderservice's People

Contributors

harshbalwanix avatar

Watchers

 avatar

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.