-3
Daily
19,187
stars
777
forks
304
watchers
503
prs
589
issues
26
releases
README
Hyperapp
The tiny framework for building hypertext applications.
- Do more with less—We have minimized the concepts you need to learn to get stuff done. Views, actions, effects, and subscriptions are all pretty easy to get to grips with and work together seamlessly.
- Write what, not how—With a declarative API that's easy to read and fun to write, Hyperapp is the best way to build purely functional, feature-rich, browser-based apps using idiomatic JavaScript.
- Smaller than a favicon—1 kB, give or take. Hyperapp is an ultra-lightweight Virtual DOM, highly-optimized diff algorithm, and state management library obsessed with minimalism.
Here's the first example to get you started. Try it here—no build step required!
html
import { h, text, app } from "https://unpkg.com/hyperapp"
const AddTodo = (state) = ({
...state,
value: "",
todos: state.todos.concat(state.value),
})
const NewValue = (state, event) = ({
...state,
value: event.target.value,
})
app({
init: { todos: [], value: "" },
view: ({ todos, value }) =
h("main", {}, [
h("h1", {}, text("To do list")),
h("input", { type: "text", oninput: NewValue, value }),
h("ul", {},
todos.map((todo) = h("li", {}, text(todo)))
),
h("button", { onclick: AddTodo }, text("New!")),
]),
node: document.getElementById("app"),
})
Check out more examples
The app starts by setting the initial state and rendering the view on the page. User input flows into actions, whose function is to update the state, causing Hyperapp to re-render the view.
When describing how a page looks in Hyperapp, we don't write markup. Instead, we use h() and text() to create a lightweight representation of the DOM (or virtual DOM for short), and Hyperapp takes care of updating the real DOM efficiently.
Installation
console
npm install hyperapp
Documentation
Learn the basics in the Tutorial, check out the Examples, or visit the Reference.
Packages
Official packages provide access to Web Platform APIs in a way that makes sense for Hyperapp. For third-party packages and real-world examples, browse the Hyperawesome collection.
| Package | Status | About |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| @hyperapp/dom | | Inspect the DOM, focus and blur. |
| @hyperapp/svg | Top issues
#757Provide a way to keep existing markup as is (Custom Elements, Hydration)22 comments · 2018-09-13#1048Usage with TypeScript15 comments · 2021-04-07#1123Future of hyperapp12 comments · 2025-07-15#1087@hyperapp/html: use a Proxy?9 comments · 2022-02-23#1077The dispatch initializer ends in an endless loop on init when dispatching any action 7 comments · 2021-12-17#1122Ownership of class when patching5 comments · 2025-04-23#1115Multiple apps on single page 5 comments · 2024-04-28#1111Cannot read properties of null (reading 'length')5 comments · 2023-03-05
Discussions
#1119Merlin, a Hyperapp alternative4 comments · 2024-09-15#1118Hyperapp + .NET1 comments · 2024-09-04#1102Micro-frontends approach to solve once and for all the "problem" of router/stateful components1 comments · 2022-12-20#1070Working hyperapp Dev tool for version 20 comments · 2021-07-23#1064Reworked a project for Hyperapp V20 comments · 2021-05-13#1061Does updating state always update DOM?1 comments · 2021-05-03#1058Actions that return actions OR actions-with-payloads0 comments · 2021-04-25#1052Potential Types Updates3 comments · 2021-04-18
Latest release
2.0.0 2.0.0 2019-07-26Hyperapp 2.0 brings a host of new features and improvements, empowering you to build more efficient and feature-rich web apps: - We're excited to introduce our new Tutorial, enhanced Examples, and comprehensive Reference. - New Features: Hyperapp 2.0 introduces several new features, including Effects, Subscriptions, and an enhanced Dispatch mechanism. - Explore the flowchart to gain a clearer insight into Hyperapp's workflow. 🔍 Features - h() and text(): The h() function creates virtual DOM nodes (VNodes) for defining views, while text() generates text content nodes for insertion.