
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
create-minijs
Advanced tools
A minimal JavaScript framework built from scratch demonstrating core framework concepts including DOM abstraction, routing, state management, and event handling.
node server.mjs
Visit http://localhost:3000 to see the todo example.
MiniFramework follows the inversion of control principle - the framework calls your code, not the other way around. This is achieved through:
The framework uses a Virtual DOM to efficiently update the real DOM:
// Virtual nodes are plain objects
const vnode = {
tag: 'div',
attrs: { className: 'container' },
children: ['Hello World']
};
Components extend the base Component class:
import { Component, createNode } from './framework/index.js';
class MyComponent extends Component {
constructor(props) {
super(props);
this.state = { count: 0 };
}
handleClick() {
this.setState({ count: this.state.count + 1 });
}
render() {
return createNode('div', {}, [
createNode('p', {}, `Count: ${this.state.count}`),
createNode('button', {
onclick: () => this.handleClick()
}, 'Increment')
]);
}
}
Use the createNode function to create virtual DOM nodes:
import { createNode } from './framework/index.js';
// Simple element
const element = createNode('div', { className: 'container' }, 'Hello');
// Element with children
const complex = createNode('div', {}, [
createNode('h1', {}, 'Title'),
createNode('p', {}, 'Content')
]);
// Element with events
const interactive = createNode('button', {
onclick: (e) => console.log('Clicked!'),
className: 'btn'
}, 'Click me');
Events are added as attributes starting with 'on':
const button = createNode('button', {
onclick: (event) => {
console.log('Button clicked');
},
onmouseover: (event) => {
console.log('Mouse over');
}
}, 'Interactive Button');
Elements can be nested by passing children as the third parameter:
const nested = createNode('div', { className: 'parent' }, [
createNode('div', { className: 'child' }, [
createNode('span', {}, 'Deeply nested content')
])
]);
Attributes are passed as the second parameter:
const input = createNode('input', {
type: 'text',
placeholder: 'Enter text...',
className: 'form-input',
id: 'my-input',
value: 'default value'
});
Components can manage local state using setState:
class Counter extends Component {
constructor(props) {
super(props);
this.state = { count: 0 };
}
increment() {
this.setState({ count: this.state.count + 1 });
}
render() {
return createNode('div', {}, [
createNode('span', {}, `Count: ${this.state.count}`),
createNode('button', { onclick: () => this.increment() }, '+')
]);
}
}
The framework provides a global store for shared state:
// Add a reducer
app.store.addReducer('counter', (state = 0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
});
// In components, dispatch actions
this.dispatch({ type: 'INCREMENT' });
// Get state
const count = this.getGlobal('counter');
The framework includes a simple client-side router:
// Navigation in components
this.navigate('/about');
// Check current route
const isHome = this.framework.router.matchRoute('/');
// Route-based rendering
render() {
const route = this.framework.router.getCurrentRoute();
if (route === '/') {
return createNode('div', {}, 'Home Page');
} else if (route === '/about') {
return createNode('div', {}, 'About Page');
}
}
Traditional libraries require you to call their methods:
// Library approach - you call the library
const element = document.createElement('div');
element.textContent = 'Hello';
document.body.appendChild(element);
Frameworks control the flow and call your code:
// Framework approach - framework calls your render method
class MyComponent extends Component {
render() {
return createNode('div', {}, 'Hello'); // Framework calls this
}
}
The framework manages when components:
This ensures consistent behavior and optimal performance.
This pattern makes applications predictable and debuggable.
The included TodoMVC implementation demonstrates all framework features:
Run the example to see the framework in action!
FAQs
just a mini framework based on react and vue js
We found that create-minijs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.