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

complete-auth

v1.1.1

Published

### Developer: PRAMOD THYAGARAJ

Downloads

56

Readme

Complete Auth

Developer: PRAMOD THYAGARAJ

Connect

An easy-to-use module for handling user and admin authentication via email OTP. This module supports login and signup flows for both users and admins, providing a robust and secure way to manage authentication in your application.


Features

Login

  1. Login as User:

    • Users can log in using their email and a One-Time Password (OTP) sent to their email.
  2. Login as Admin:

    • Admins can log in using their email and a One-Time Password (OTP) sent to their email.

Signup

  1. Signup as User:

    • Users can sign up by entering their email and receiving an OTP to verify their account.
  2. Signup as Admin:

    • Admins can sign up by entering their email. An OTP will be sent to the super admin's email for verification before the account is created.

Setup Guide

Prerequisites

  1. Node.js: Ensure you have Node.js installed (>= 14.x recommended).
  2. npm: Ensure npm is available for managing dependencies.

Step 1: Install the Package

Install the complete-auth package via npm:

npm install complete-auth

Step 2: Create a .env File

In the root directory of your project, create a .env file to configure the backend API endpoint:

VITE_BACKEND_ENDPOINT=http://localhost:8000/api
  • Replace http://localhost:8000/api with your actual backend API URL.

Step 3: Usage Guide

1. Import and Initialize the Module

Import the module into your application and initialize it.

import { login, signup } from "authentication-module";

2. Login Functions

Login as User
login("user", {
  email: "[email protected]",
  otp: "123456", // OTP sent to the user's email
})
  .then((response) => console.log("Login successful:", response))
  .catch((error) => console.error("Login failed:", error));
Login as Admin
login("admin", {
  email: "[email protected]",
  otp: "123456", // OTP sent to the admin's email
})
  .then((response) => console.log("Admin login successful:", response))
  .catch((error) => console.error("Admin login failed:", error));

3. Signup Functions

Signup as User
signup("user", {
  email: "[email protected]",
})
  .then((response) => console.log("Signup successful:", response))
  .catch((error) => console.error("Signup failed:", error));
Signup as Admin
signup("admin", {
  email: "[email protected]",
})
  .then((response) => console.log("Admin signup request sent:", response))
  .catch((error) => console.error("Admin signup failed:", error));

Step 4: Backend API Setup

Ensure the backend API supports the following endpoints:

Endpoints

  1. POST /user/login:
    • Handles user and admin login with email OTP.
  2. POST /user/signup:
    • Handles user signup and sends OTP to the user's email.
  3. POST user/signup/admin:
    • Sends an OTP to the super admin for admin account creation.

Environment Variables

| Variable | Description | Example | | ----------------------- | -------------------- | --------------------------- | | VITE_BACKEND_ENDPOINT | Backend API base URL | http://localhost:8000/api |


Key Features

  1. Easy Integration:
    • Simplifies OTP-based login and signup processes for users and admins.
  2. Secure:
    • Ensures account verification through OTP mechanisms.
  3. Customizable:
    • Supports environment-based configuration for different backend endpoints.

Troubleshooting

  1. "Module not found" Error:

    • Ensure the package is installed correctly using npm install complete-auth.
  2. Backend Not Responding:

    • Verify the VITE_BACKEND_ENDPOINT in the .env file is pointing to a valid backend API.
  3. Login/Signup Fails:

    • Ensure the backend API is running and properly configured to handle the respective endpoints.

Happy authenticating! 🎉