• Stars
    star
    19,043
  • Rank 1,369 (Top 0.03 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

1kB-ish JavaScript framework for building hypertext applications

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!

<script type="module">
  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"),
  })
</script>

<main id="app"></main>

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

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 npm Inspect the DOM, focus and blur.
@hyperapp/svg npm Draw SVG with plain functions.
@hyperapp/html npm Write HTML with plain functions.
@hyperapp/time npm Subscribe to intervals, get the time now.
@hyperapp/events npm Subscribe to mouse, keyboard, window, and frame events.
@hyperapp/http npm Talk to servers, make HTTP requests (#1027).
@hyperapp/random npm Declarative random numbers and values.
@hyperapp/navigation npm Subscribe and manage the browser URL history.

Need to create your own effects and subscriptions? You can do that too.

Help, I'm stuck!

If you've hit a stumbling block, hop on our Discord server to get help, and if you remain stuck, please file an issue, and we'll help you figure it out.

Contributing

Hyperapp is free and open-source software. If you want to support Hyperapp, becoming a contributor or sponsoring is the best way to give back. Thank you to everyone who already contributed to Hyperapp! <3

License

MIT

More Repositories

1

fisher

A plugin manager for Fish
Shell
7,560
star
2

awsm.fish

A curation of prompts, plugins & other Fish treasures ๐Ÿš๐Ÿ’Ž
4,066
star
3

nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
Shell
2,033
star
4

cookbook.fish

From Shell to Plate: Savor the Zest of Fish ๐Ÿฆž
2,002
star
5

colorette

๐ŸŒˆEasily set your terminal text color & styles
JavaScript
1,595
star
6

superfine

Absolutely minimal view layer for building web interfaces
JavaScript
1,564
star
7

classcat

Build a class attribute string quickly
JavaScript
905
star
8

getopts

Node.js CLI options parser
JavaScript
633
star
9

hydro

Ultra-pure, lag-free prompt with async Git statusโ€”just for Fish
Shell
609
star
10

hyperawesome

A curated list of awesome projects built with Hyperapp + more
492
star
11

replay.fish

Run Bash commands, replay changes in Fish ๐Ÿค
Shell
392
star
12

twist

Declarative JavaScript Testing
JavaScript
378
star
13

autopair.fish

Auto-complete matching pairs in the Fish command line
Shell
369
star
14

fishtape

100% pure-Fish test runner
Shell
345
star
15

spark.fish

โ–โ–‚โ–„โ–†โ–‡โ–ˆโ–‡โ–†โ–„โ–‚โ–
Shell
335
star
16

hyperapp-router

Declarative routing for Hyperapp V1 using the History API.
JavaScript
257
star
17

getopts.fish

Parse CLI options in Fish
Shell
220
star
18

gitio.fish

Create a custom git.io URL
Shell
88
star
19

hyperapp-html

Html helper functions for Hyperapp V1
JavaScript
81
star
20

pyenv

Pyenv support plugin for fish-shell
Shell
62
star
21

humantime.fish

Turn milliseconds into a human-readable string in Fish
Shell
21
star
22

.github

My health files
1
star
23

jorgebucaran.github.io

HTML
1
star