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

snapsrv4u

v1.1.0

Published

Light-weight package for developers that need a reacting server in a blink of an eye

Readme

🚀 Mock API Server

A powerful and flexible mock API server that automatically generates realistic data based on your specifications using Faker.js, it also optionally integrates with a file-based CSV database "snap4db" to simulate persistent data and accordingly reacts as an API.

📦 Installation

npm install snapsrv4u

🚀 Quick start without a database

Supports GET requests only

const { MockApiServer } = require('snapsrv4u');

const server = new MockApiServer(4517); // default value

server.addRoute('/api/users', {
  method: 'GET',
  count: 10, // number of objects created
  properties: { // description of all the objects (created with faker.js)
    id: { type: 'id', zeros: 5 },
    name: { type: 'name' },
    email: { type: 'email' }
  }
});

server.start(); // starting the server

Supported types for Faker.js

| Category | Types | | -------- | -------------------------------------------------------------------------------------------------------- | | Numbers | number, float, id, uuid | | Strings | string, sentence, paragraph | | Dates | date, past, future, timestamp | | Personal | firstname, lastname, fullname, username, email, avatar, phone, gender, jobTitle, bio | | Location | latitude, longitude, city, country, address, zipcode | | Internet | url, ipv4, password, useragent | | Company | company, department, catchPhrase | | Commerce | product, price, color | | Boolean | boolean | | Custom | faker with method and options (e.g., faker: { method: 'music.genre' }) |

📝 Creating a server with database

GET POST and DELETE requests

const server = new MockApiServer(port); // port defaults to 4517

Adding POST routes

// POST request
server.addRoute('/sign-up', {
    method: 'POST', // required
    collection: 'users', // required
    properties: {
        name: { type: 'name' }, // describes the the property
        email: { type: 'email', unique: true } // can be a unique property
    }
});

Adding DELETE routes

Gets data from body, params or query

// POST request
server.addRoute('/delete-from-known-collection/:id', {
    method: 'DELETE',
    collection: 'users'
});

server.addRoute('/delete-from-unknown-collection/:id', {
    method: 'DELETE'
});

Adding GET routes

Gets data from body, params or query

// POST request
server.addRoute('/get-from-known-collection/:id', {
    method: 'GET',
    collection: 'users'
});

server.addRoute('/get-from-unknown-collection/:id', {
    method: 'GET'
});

Config Options

  • method: HTTP method ('GET', 'POST' or 'DELETE')
  • count: Number of items to generate (1 for single object, >1 for array). will only work with quick start
  • properties: Object describing the data structure

📚 Supported Data Types

| Type | Description | Options | |-----------|--------------------------------|----------------------------| | number | Random number | min, max | | string | Random string | min, max (length) | | boolean | Random true/false | - | | date | Random date | from, to | | name | Random full name | - | | email | Random email address | - | | uuid | Random UUID | - | | id | Numeric ID with padding | zeros (padding length) |

Or anything else from faker.js

🔧 Configuration Options

Each property can have these configurations:

  • type: (Required) Data type to generate
  • min: Minimum value/length
  • max: Maximum value/length
  • zeros: Number of digits for IDs
  • from: Start date for date ranges
  • to: End date for date ranges

Future features

  1. PUT requests
  2. Adding the option to send data automatically (on timer)
  3. Creating a log for incoming requests
  4. Customizable response (function)