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

little-web-framework

v1.0.1

Published

A lightweight experimental web framework built in TypeScript using composition.

Readme

Little Web Framework

A lightweight, experimental frontend web framework built from scratch with TypeScript.

Overview

This framework is designed to demonstrate advanced TypeScript patterns and the principles of object-oriented programming, specifically favoring composition over inheritance. It provides a structured way to build web applications by separating concerns into distinct, reusable modules.

Installation

npm install little-web-framework

How to use

This framework operates by combining a Model (which handles data, events, and API synchronization) with a View (which handles rendering HTML and user events).

1. Creating a Model

Because the framework uses composition, you build your custom data entities by injecting the Attributes, Eeventing, and Sync modules into the base Model.

import { Model, Attributes, Eeventing, Sync } from 'little-web-framework';

export interface UserProps {
  id?: string;
  name?: string;
  age?: number;
}

const rootUrl = 'http://localhost:3000/users';

export class User extends Model<UserProps> {
  // A static factory method makes initialization cleaner
  static buildUser(attrs: UserProps): User {
    return new User(
      new Attributes<UserProps>(attrs),
      new Eeventing(),
      new Sync<UserProps>(rootUrl)
    );
  }
}

2. Creating a View

To create a UI component, extend the View class. You must define an HTML template and you can map DOM events using eventsMap.

import { View } from 'little-web-framework';
import { User, UserProps } from './User';

export class UserForm extends View<User, UserProps> {
  // Map standard DOM events to methods using 'eventName:selector' syntax
  eventsMap(): { [key: string]: () => void } {
    return {
      'click:.set-age': this.onSetAgeClick,
      'click:.set-name': this.onSetNameClick
    };
  }

  onSetAgeClick = (): void => {
    // Calling .set() on the model automatically triggers a "change" event
    this.model.set({ age: Math.round(Math.random() * 100) });
  };

  onSetNameClick = (): void => {
    const input = this.parent.querySelector('input');
    if (input) {
      this.model.set({ name: input.value });
    }
  };

  template(): string {
    return `
      <div>
        <h1>User Form</h1>
        <div>User name: ${this.model.get('name')}</div>
        <div>User age: ${this.model.get('age')}</div>
        <input placeholder="Enter new name" />
        <button class="set-name">Change Name</button>
        <button class="set-age">Set Random Age</button>
      </div>
    `;
  }
}

3. Rendering to the DOM

Once your Model and View are defined, you bind them together. The View automatically re-renders whenever the Model's data changes.

import { User } from './User';
import { UserForm } from './UserForm';

// 1. Initialize the model
const user = User.buildUser({ name: 'Alice', age: 25 });

// 2. Find the root DOM element
const root = document.getElementById('root');

if (root) {
  // 3. Initialize and render the View
  const userForm = new UserForm(root, user);
  userForm.render();
} else {
  throw new Error('Root element not found');
}