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

microsql

v0.0.5

Published

A tiny file-based database for TypeScript and JavaScript projects.

Downloads

39

Readme

MicroSQL

A lightweight, git-friendly SQL database that stores data as JSON files

MicroSQL is a zero-dependency database engine for JavaScript/TypeScript projects. Run SQL-like queries on JSON files without SQLite, Postgres, or any database server. Perfect for open source projects where you want users to clone and run immediately.


Why MicroSQL?

  • Zero setup - No database installation, no configuration files, just JSON
  • Git-friendly - Human-readable diffs, easy to version control, no binary .db files
  • Zero dependencies - Pure Node.js, works everywhere
  • Familiar syntax - If you know SQL, you already know MicroSQL

Installation

npm install microsql

Or with pnpm:

pnpm add microsql

Quick Start

import { MicroSQL } from "microsql";

const db = new MicroSQL("./data");

db.query(`INSERT INTO users (id, name, age, city) VALUES (1, "Alice", 25, "Berlin")`);
db.query(`INSERT INTO users (id, name, age, city) VALUES (2, "Bob", 30, "Paris")`);

const users = db.query(`SELECT * FROM users WHERE age > 20`);
console.log(users);

Each table is stored as ./data/users.json - no database server required.


Features

Supported SQL Operations

| Feature | Example | |---------|---------| | SELECT | SELECT name, age FROM users | | INSERT | INSERT INTO users (id, name) VALUES (1, "Alice") | | UPDATE | UPDATE users SET age = 26 WHERE name = "Alice" | | DELETE | DELETE FROM users WHERE id = 1 | | WHERE | WHERE age > 25 AND city = "Berlin" | | LIKE | WHERE email LIKE "%@gmail.com" | | JOIN | JOIN orders ON users.id = orders.user_id WHERE users.age > 25 | | IN | WHERE id IN (1, 2, 3) | | ORDER BY | ORDER BY age DESC | | LIMIT | LIMIT 10 |

WHERE Clause Operators

  • Comparison: =, >, <, >=, <=
  • Pattern matching: LIKE with % (any chars) and _ (single char)
  • List membership: IN (value1, value2, ...)
  • Logic: AND, OR with parentheses support

Examples

Basic CRUD

const db = new MicroSQL("./data");

db.query(`INSERT INTO products (id, name, price) VALUES (1, "Laptop", 999)`);

const products = db.query(`SELECT * FROM products`);

db.query(`UPDATE products SET price = 899 WHERE id = 1`);

db.query(`DELETE FROM products WHERE id = 1`);

Filtering and Sorting

db.query(`SELECT * FROM users WHERE age >= 18 AND city = "Berlin"`);

db.query(`SELECT name FROM users WHERE email LIKE "%@company.com"`);

db.query(`SELECT name FROM users WHERE id IN (1, 3, 5)`);

db.query(`SELECT name, age FROM users ORDER BY age DESC LIMIT 5`);

Complex Queries

db.query(`
  SELECT name, email 
  FROM users 
  WHERE (city = "Berlin" AND age > 25) OR status = "premium"
  ORDER BY name ASC
  LIMIT 10
`);

Use Cases

MicroSQL is perfect for:

  • Open source projects - Users can clone and run without database setup
  • Prototypes and demos - Quick data persistence without infrastructure
  • CLI tools - Store configuration and state in readable JSON
  • Static site generators - Keep data in version control
  • Small applications - Where SQLite is overkill

When NOT to Use MicroSQL

  • High-traffic production applications (no concurrency control)
  • Large datasets (>10,000 rows per table)
  • Applications requiring transactions or ACID guarantees
  • Multi-user write scenarios (no locking mechanism)

How It Works

  1. Each table is stored as a separate JSON file (./data/tablename.json)
  2. Queries are parsed with regex-based SQL parser
  3. Operations load JSON, apply logic in-memory, and save back
  4. No indexes or query optimization (trades performance for simplicity)

File Structure

./data/
├── users.json
├── products.json
└── orders.json

Each JSON file contains an array of objects:

[
  { "id": "1", "name": "Alice", "age": "25" },
  { "id": "2", "name": "Bob", "age": "30" }
]

Limitations

  • No concurrency control - Not safe for simultaneous writes
  • No indexes - All queries are full table scans
  • Limited SQL - Subset of SQL features only

Roadmap

  • [ ] GROUP BY and aggregate functions (COUNT, SUM, AVG)
  • [ ] Type coercion (proper number/boolean handling)

License

MIT