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 🙏

© 2025 – Pkg Stats / Ryan Hefner

domify-js

v1.0.6

Published

A frontend framework to teach web developers how frontend frameworks work.

Readme

DomifyJS

DomifyJS is a lightweight, flexible frontend framework built from scratch in JavaScript to understand how modern frontend frameworks work under the hood. It allows the developers to describe their UI and let the framework handle the DOM operations Instead of manually creating and updating DOM elements.

Table of Contents

Purpose

The main purpose is to abstract away direct DOM manipulation and provide a more structured way to build web applications. Instead of manually creating and updating DOM elements, developers can describe their UI and let the framework handle the DOM operations.

Installation

npm install domify-js

How It Works

The framework works through three main systems:

  1. Virtual DOM System
  2. State Management
  3. DOM Updates

How to Use DomifyJS

API Reference

createElement(tag, props, children)

Creates a virtual DOM element.

Parameters:

  1. tag (string): HTML tag name ('div', 'p', 'button', etc.)
  2. props (object): Properties and event handlers
  3. children (array): Child elements or text content

createApp({ state, reducers, view })

Creates and initializes the application.

Parameters:

  1. state (object): Initial application state
  2. reducers (object): State update functions
  3. view (function): Main view function that returns virtual DOM

Usage Example

// Counter App
const state = { count: 0 };

const reducers = {
  increment: (state) => ({
    ...state,
    count: state.count + 1,
  }),
  decrement: (state) => ({
    ...state,
    count: state.count - 1,
  }),
};

function App(state, emit) {
  return createElement("div", {}, [
    createElement("h1", {}, [`Count: ${state.count}`]),
    createElement(
      "button",
      {
        on: { click: () => emit("decrement") },
      },
      ["-"]
    ),
    createElement(
      "button",
      {
        on: { click: () => emit("increment") },
      },
      ["+"]
    ),
  ]);
}

createApp({ state, reducers, view: App }).mount(document.getElementById("app"));

Vanilla JS vs DomifyJS

Vanilla JavaScript:

// Create elements
const div = document.createElement("div");
const button = document.createElement("button");
button.textContent = "Click me";
div.appendChild(button);

// Add event listener
button.addEventListener("click", () => {
  const count = parseInt(div.dataset.count || "0");
  div.dataset.count = count + 1;
  updateUI();
});

// Update UI
function updateUI() {
  div.textContent = `Count: ${div.dataset.count}`;
  div.appendChild(button);
}

DomifyJS:

// Define state
const state = { count: 0 };

// Define reducers
const reducers = {
  increment: (state) => ({
    ...state,
    count: state.count + 1,
  }),
};

// Create view
function App(state, emit) {
  return createElement("div", {}, [
    createElement("h1", {}, [`Count: ${state.count}`]),
    createElement(
      "button",
      {
        on: { click: () => emit("increment") },
      },
      ["Click me"]
    ),
  ]);
}

// Create app
createApp({ state, reducers, view: App }).mount(document.getElementById("app"));

Benefits Over Vanilla JS

  • No Direct DOM Manipulation
    • Framework handles DOM updates
    • Developers focus on describing UI
  • Structured State Management
    • Centralized state
    • Predictable updates
    • Clear data flow
  • Declarative Code
    • Describe what you want
    • Framework handles how to do it
  • Event Handling
    • Simplified event system
    • Automatic cleanup

Current Limitations

  • Performance
    • Full DOM rebuild on every state change
    • Will be optimized in future versions
  • Basic Features
    • Simple state management
    • No component system yet
    • No lifecycle methods

Framework Flow

Initial Setup:

  1. Create virtual DOM structure
  2. Set up state management
  3. Initialize event system

When State Changes:

  1. Reducer creates new state
  2. Framework rebuilds virtual DOM
  3. Updates real DOM

Event Handling:

  1. User interaction triggers event
  2. Event dispatches action
  3. Reducer updates state
  4. View updates automatically

This framework is designed for learning purposes and demonstrates fundamental concepts used in modern frontend frameworks like React, Vue, and others.