/flexhostmail

FlexHostMail is a Node.js package designed for secure email-based OTP (One-Time Password) verification systems. In this beta release, we introduce new functionalities and improvements to enhance your OTP implementation.

Primary LanguageJavaScriptCreative Commons Zero v1.0 UniversalCC0-1.0

Email OTP Verification System

CodeScene Code Health workflow OpenSSF Best Practices NPM Version

Project Purpose

This Node.js project provides a system for secure email OTP (One-Time Password) generation, sending, and verification. It is designed for demonstration and learning purposes. It uses Fastify over Express : To focus on speed and efficiency, Fastify is optimized to handle a high volume of requests, making it an ideal choice for performance-critical applications where response time is a key factor.

Features

  • OTP Generation: Generates secure, random OTP codes.
  • Email Integration: Sends OTPs to users via email. Requires configuration with an email provider (Mailgun is supported).
  • OTP Storage & Validation: Securely stores OTPs as hashes in Redis for fast retrieval and validation(Redis is Required).

Setup

Prerequisites

  • Node.js
  • npm
  • Mailgun account
  • Running Redis instance

Instructions

  1. Clone the repository.

  2. Install dependencies: npm install.

  3. Create a .env file (never committed to version control) with the following fields:

    MAILGUN_API_KEY=your_mailgun_api_key
    REDISHOST=your_redis_hostname_or_ip
    REDISPASSWORD=your_redis_password
    MAILGUN_DOMAIN=your_mailgun_domain
    
    

Start

    `node index.js`
    `it listen to port localhost:9543` expose port according to your requirement

documentations

License