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

node_gateway_library

v1.0.9

Published

This Node.js library provides integration with the **ABDM Connector** for key functionalities like **M1**, **M2**, and **Scan & Share** workflows. It supports both **SQL-based databases** and **MongoDB** for flexible backend storage.

Readme

Argusoft Node Gateway Library

This Node.js library provides integration with the ABDM Connector for key functionalities like M1, M2, and Scan & Share workflows. It supports both SQL-based databases and MongoDB for flexible backend storage.


📦 Installation

1. Install Gateway Library

To add The library run following command in your project:

npm install argusoft-node_gateway_library


## 🔧 Environment Setup

Create a `.env` file in your project root directory and add the following fields. These details will be provided by the **ABDM Connector**:

.env

CLIENT_ENVIRONMENT = (staging or prod) GATEWAY_CLIENT_ID = Your Cliend id GATEWAY_CLIENT_SECRET = Your Clinet Secret GATEWAY_USERNAME = Client username GATEWAY_PASSWORD = Client password


### 📌 Reference Image

![Environment Setup Example](./assets/env-example-node.png)

---

## 🗄️ Database Integration for Scan and Share

This library supports both SQL-based databases and MongoDB for **Scan and Share** functionality.

### 🏗️ Table Creation

#### For SQL Databases (PostgreSQL Example)

> The provided SQL script is designed for **PostgreSQL**. If you're using **MySQL**, **SQL Server**, **Oracle**, or **MongoDB**, kindly adjust the script to fit your database syntax.

```sql
CREATE SCHEMA gateway;

CREATE TABLE gateway.abdm_scan_and_share_patient_registration (
    id INT AUTO_INCREMENT PRIMARY KEY,
    token_number INT,
    created_on TIMESTAMP,
    hfr_id VARCHAR(255),
    custom_id VARCHAR(255),
    patient_name VARCHAR(255),
    patient_dob DATE,
    patient_gender VARCHAR(50),
    abha_address VARCHAR(50) NULL,
    abha_number VARCHAR(50) NULL, 
    patient_address TEXT,
    phone_number TEXT
);

CREATE TABLE gateway.abdm_token_details (
    id INT AUTO_INCREMENT PRIMARY KEY,
    hfr_id VARCHAR(255),
    last_generated_token_number INT,
    last_generated_token_date DATE,
    counter_id VARCHAR(255)
);

🛠️ Database Initialization

Before using Scan and Share features, initialize the database connection as shown below:

For MongoDB

await gatewayLibrary.dbConfig.initialize({
    dbType: "mongodb",
    dbConfig: {
        uri: "mongodb://localhost:27017",
        dbName: "gateway"
    }
});

For SQL Databases

(PostgreSQL, MySQL, SQL Server, Oracle)

await gatewayLibrary.dbConfig.initialize({
    dbType: "postgres",   // or "mysql", "oracle", "sqlserver"
    dbConfig: {
        host: "localhost",
        user: "postgres",
        database: "gateway",
        password: "",
        port: 5432, // specify appropriate port
    }
});

📦 Usage Examples

const gatewayLibrary = require('@argusoft/node_gateway_library');

// 🔍 M1 Usage Example
const result = await gatewayLibrary.m1Service.searchAbha({
    mobileNumber: "8824827401",
    benefitName: ""
});

// 🔗 M2 Usage Example
const result = await gatewayLibrary.m2Service.getRecordLinkingStatus(
    "90902966-1fde-4bc2-a1fe-75f9d8645687"
);

// 📱 Scan and Share Example
const result = await gatewayLibrary.scanAndShareService.getQRCode(
    "IN2410099120_1", 
    "842d61c9-8f24-4245-94ea-37c43ede781c", 
    "89289",
    parseInt("900"), 
    parseInt("700")
);

💡 Developer Tip

For all functions, clear parameter recommendations are provided via Type Safety and runtime validation. If incorrect or missing parameters are passed, the library will provide descriptive error messages to guide you.