npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mahfuz-js

v1.4.3

Published

Mern Stack Development Tool

Readme

Mahfuz JS Backend Library

Overview

Mahfuz JS is a Backend library that provides various utilities including server setup, database connection, encryption, email sending, and GitHub release checking for backend development.

Installation

install using npm:

npm install mahfuz-js

Usage

Setup Backend Server

inside index.js

import 'dotenv/config';
import { Backend  } from 'mahfuz-js';

// Initialize Backend
const FrontendURL = process.env.FRONTEND_URL;
const dbConfig = {
  subdomain: process.env.DB_SUBDOMAIN,
  username: process.env.DB_USERNAME,
  password: process.env.DB_PASSWORD,
  cluster: process.env.DB_CLUSTER
};

const dbConnected = await Backend.ConnectToDataBase(dbConfig);
if(dbConnected) {
  const frontendConnected = await Backend.ConnectToFrontend(FrontendURL);
  if(frontendConnected) {
    Backend.ConfigureMiddlewares(true);
    Backend.AddSecurityHeaders(true);
    await Backend.StartServer(process.env.BACKEND_PORT)
  }
} else {
  console.log("database connection failed");
}

Utils Class

The Utils class provides utility functions for generating random numbers, handling async requests, and encrypting data.

import { Utils } from "mahfuz-js";
const Random = Utils.Random(10);
const encryptedString = Utils.Encrypt('your-string');
const isMatch = Utils.Compare('your-string', encryptedString);

ApiResponse

The ApiResponse class is used to standardize API responses.

const response = new ApiResponse(200, { key: 'value' }, 'Success message');

ApiError

The ApiError class is used to standardize API error responses.

const error = new ApiError(400, 'Error message', ['error1', 'error2']);

MahfuzMailer

The MahfuzMailer class is used to send emails using nodemailer.

const mailConfig = {
  Host: 'smtp.example.com', \\ Your SMTP server host address 
  Port: 465, \\ Your SMTP server port
  Username: 'your-username', \\ Your SMTP server username that SMTP server provided
  Password: 'your-password' \\ Your SMTP server password that SMTP server provided
  Name: 'Your Name', \\ Your name or company name
  From: '[email protected]', \\ Your email address that you used to register for the SMTP server
  To: '[email protected]',
  Subject: 'Subject',
  Body: 'html-content',
};


const isSent = await MahfuzMailer.SendMail(mailConfig);
if(isSent) {
  console.log("mail sent");
} else {
  console.log("mail could not send");
}

License

This project is licensed under the MIT License.

Author

Developed by Mohammad Mahfuz Rahman.

Happy Coding!