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

littlebag

v1.0.0

Published

A simple yet powerful reactive UI framework

Readme

littlebag

[!NOTE] littlebag is not production-ready yet. Feel free to build your hobby projects with littlebag and open issues/PRs to help the framework grow, any feedback will be appreciated!

littlebag aims to be the most lightweight web framework. It provides vital functions for managing reactive state and creating HTML components while being just ~340 bytes minified and compressed.

Ideology

  • Minimal size. littlebag was built with size in mind from the ground up. It's functions are almost code-golfed which not only reduces the bundled size, but also allows to think about the framework in a different way by filtering out things that are not really needed.

  • Functional programming. Components can be written as plain functions, which can be called just like usual, allowing for concise and readable code:

    function Component({ text }) {
      return html("span", {}, [text]);
    }
    
    function App() {
      return html("div", { className: "container" }, [
        Component({ text: "Hello world" })
      ]);
    }
  • No unnecessary abstraction. All components are basically node factories with reactive states. That means there is no need for a separate mount function — you can just append the returned node (unless the node needs to be removed later):

    function App() {
      return html("button", {}, ["Click me!"]);
    }
    
    document.body.append(App());
  • Granular reactivity. It is strongly encouraged to use primitive state instead of compound objects. This allows to only update the things that actually changed, leaving everything else intact.

    In fact, if you use TypeScript, trying to create a state with an object type will result in a type error.

Tutorial

Say you want to create a TODO list app. You don't want the pain of vanilla JavaScript, but you are too handsome and heroic to use bloated a web framework, so you choose littlebag.

You start with a simple layout using html:

function TodoItem({ text, done }) {
  return html("li", {}, [
    html("input", { type: "checkbox", checked: done }, []),
    html("input", { value: text }, []),
    html("button", {}, ["❌"])
  ]);
}

function App() {
  return html("div", {}, [
    html("h1", {}, ["TODO list"]),
    html("ul", {}, [
      TodoItem({ text: "Do the chores", done: false }),
      TodoItem({ text: "Pet my cat", done: true })
    ])
  ]);
}

document.body.append(App());

Add some reactivity with state and on*:

function TodoItem({
  text: [text, setText],
  done: [done, setDone]
}) {
  return html("li", {}, [
    html("input", {
      type: "checkbox",
      onchange: (ev) => setDone(ev.target.checked),
      checked: done
    }, []),
    html("input", {
      style: () => done() ? "text-decoration: line-through" : "",
      oninput: (ev) => setText(ev.target.value),
      value: text
    }, []),
    html("button", {}, ["❌"])
  ]);
}

function App() {
  return html("div", {}, [
    html("h1", {}, ["TODO list"]),
    html("ul", {}, [
      TodoItem({ text: state("Do the chores"), done: state(false) }),
      TodoItem({ text: state("Pet my cat"), done: state(true) })
    ])
  ]);
}

document.body.append(App());

Then use each to make a reactive list:

function TodoItem({
  text: [text, setText],
  done: [done, setDone],
  onremove
}) {
  return html("li", {}, [
    html("input", {
      type: "checkbox",
      onchange: (ev) => setDone(ev.target.checked),
      checked: done
    }, []),
    html("input", {
      style: () => done() ? "text-decoration: line-through" : "",
      oninput: (ev) => setText(ev.target.value),
      value: text
    }, []),
    html("button", { onclick: onremove }, ["❌"])
  ]);
}

function App() {
  const [todos, setTodos] = state([
    { text: state("Do the chores"), done: state(false) },
    { text: state("Pet my cat"), done: state(true) }
  ]);

  return html("div", {}, [
    html("h1", {}, ["TODO list"]),
    html("ul", {}, [
      each(todos, (todo) => {
        const [text] = todo.text;
        return TodoItem({
          ...todo,
          onremove() {
            setTodos(
              todos().filter(
                ({ text: [otherText] }) => otherText() !== text()
              )
            );
          }
        })
      })
    ])
  ]);
}

document.body.append(App());

And finally let's add a congratulation message for those lucky people who did all their TODOs!

function TodoItem({
  text: [text, setText],
  done: [done, setDone],
  onremove
}) {
  return html("li", {}, [
    html("input", {
      type: "checkbox",
      onchange: (ev) => setDone(ev.target.checked),
      checked: done
    }, []),
    html("input", {
      style: () => done() ? "text-decoration: line-through" : "",
      oninput: (ev) => setText(ev.target.value),
      value: text
    }, []),
    html("button", { onclick: onremove }, ["❌"])
  ]);
}

function App() {
  const [todos, setTodos] = state([
    { text: state("Do the chores"), done: state(false) },
    { text: state("Pet my cat"), done: state(true) }
  ]);

  return html("div", {}, [
    html("h1", {}, ["TODO list"]),
    keyed(
      () => todos().length === 0,
      (empty) =>
        empty
          ? "Everything's done 🎉"
          : html("ul", {}, [
              each(todos, (todo) => {
                const [text] = todo.text;
                return TodoItem({
                  ...todo,
                  onremove() {
                    setTodos(
                      todos().filter(
                        ({ text: [otherText] }) => otherText() !== text()
                      )
                    );
                  }
                })
              })
            ])
    )
  ]);
}

document.body.append(App());

Voilà! Here is your first little reactive app using littlebag.

Code structure

See the contributing guide for a description of the code structure and explanations of how to read (write) it.