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

localmockdb

v1.0.6

Published

Zero-setup mock REST API with localStorage / IndexedDB persistence for frontend development

Readme

localmockdb

Zero-setup mock REST API for frontend development
Persist data using localStorage / IndexedDB — survives page reloads.

No backend. No config. Just install and start building.


🔗 Live Demo

👉 https://shrikant9907.github.io/localmockdb-demo/

Try the full CRUD flow in your browser — no setup required.


🚀 Why localmockdb?

Waiting for backend APIs slows you down.

With localmockdb, you can:

👉 Build and test UI independently
👉 Simulate real REST APIs (GET, POST, PUT, PATCH, DELETE)
👉 Persist data automatically (no manual state handling)
👉 Ship demos and prototypes faster


💡 What makes it simple for frontend projects?

localmockdb is designed for frontend-first development.

👉 No setup, no config
Just install and start using. No JSON files, no servers, no environment setup.

👉 API feels real
Use familiar REST methods like get, post, patch, delete.

👉 No state management needed
Data is automatically stored and persisted.

👉 Auto everything
IDs, timestamps, and responses are handled internally.

👉 Works directly inside components
No need for complex API layers.

👉 Safe for rapid iteration
Reset, test, rebuild — no backend dependency.

👉 Drop-in replace later
Easily switch to real APIs when backend is ready.


✨ Features

| Feature | Details | |--------|--------| | Persistence | localStorage (default) or IndexedDB | | Full CRUD | GET, POST, PUT, PATCH, DELETE | | API-like responses | statusCode, success, data, error, meta | | Method validation | Returns 405 for invalid methods | | Pagination | Supports ?page= and ?limit= | | Auto timestamps | createdAt, updatedAt | | Auto IDs | UUID generated automatically | | Namespacing | Multiple DB instances supported | | Zero dependencies | Pure TypeScript |


📦 Installation

npm

npm install localmockdb

pnpm

pnpm add localmockdb

yarn

yarn add localmockdb

⚡ Quick Start

import { createAPI } from "localmockdb";

const db = createAPI();

await db.post("/users", { name: "Shrikant" });
await db.get("/users");
await db.get("/users/1");
await db.patch("/users/1", { name: "Updated" });
await db.delete("/users/1");

Data is automatically persisted.


⚛️ React / Next.js Example

// lib/db.ts
import { createAPI } from "localmockdb";

export const db = createAPI();
import { useEffect, useState } from "react";
import { db } from "./lib/db";

export default function Users() {
  const [users, setUsers] = useState([]);

  useEffect(() => {
    loadUsers();
  }, []);

  async function loadUsers() {
    const res = await db.get("/users");
    if (!res.success) return;
    setUsers(res.data);
  }

  async function addUser() {
    await db.post("/users", { name: "New User" });
    loadUsers();
  }

  return (
    <div>
      <button onClick={addUser}>Add User</button>

      {users.map((user: any) => (
        <div key={user.id}>{user.name}</div>
      ))}
    </div>
  );
}

📡 Example Response

{
  "success": true,
  "statusCode": 200,
  "data": [
    {
      "id": "uuid",
      "name": "Shrikant",
      "createdAt": "2026-04-21T10:00:00.000Z",
      "updatedAt": "2026-04-21T10:00:00.000Z"
    }
  ]
}

🔄 Reset Database

await db.reset();

🎯 Use Cases

  • Frontend development without backend
  • Rapid prototyping
  • Learning React / Next.js
  • UI testing

⚠️ Not for Production

  • Not a real backend
  • Not for large-scale systems

📝 Notes

  • Uses localStorage by default
  • Data persists after refresh
  • Can be cleared manually

📄 License

MIT