Brian Lovin
/
Hacker News
Daily Digest email

Get the top HN stories in your inbox every day.

PufPufPuf

I have tried Hyperapp some time ago. It's usable for small apps, but the lack of ecosystem makes it unfit for anything larger -- as is usual for all niché JS frameworks.

Funnily, the "ecosystem" page contains just Lorem Ipsum (https://hyperapp.dev/ecosystem) and the Awesome Hyperapp section for V2 is almost empty (https://github.com/jorgebucaran/awesome-hyperapp)

foobarbecue

Is niché a portmanteau of niche and cliché?

bigblind

No, it's niche with a French accent

sqrt17

Fun fact: niche is a French word that doesn't have an accent. So niché is the heavy metal ümlaut version.

slim

niche with a french accent sounds like the "nish" in "varnish".

Uehreka

It’s pronounced “NEE-chuh”.

escapecharacter

Like Nietzsche?

pkghost

Good content.

jorgebucaran

We're so close to the official V2 release, but there are still issues. I'll make sure to fix most by then. You totally have a point about the lack of an ecosystem, but building one is where the fun is. I am sure we'll get there! Thank you for your feedback.

ricardobeat

It's been like that for months - seems like the project is not seeing the activity they expected for v2.

Also server-side routing is broken and that link will not work.

jorgebucaran

We are very close to the official V2 release, but right now that page is still a WIP.

The link works fine, though.

satyrnein

Also, if you click "join us" and then "tutorial" your scroll position is in an unexpected place.

dsissitka

It’s broken here too.

vages

The link does not work.

HHalvi

Their guide (https://hyperapp.dev/guides) page is also filled with Lorem Ipsum.

jorgebucaran

Ouch, yes, that's also a WIP, thank you for checking in, though.

bigblind

The quickstart is quite clear, but I'd love to see some slightly larger examples like, how is state passed between components? How do event handlers work? The API page seems sparse as well.

But it looks like a great start

HumblyTossed

> but the lack of ecosystem makes it unfit for anything larger

What does this mean?

apozem

Some problems are hard, common and already solved. Sometimes solving these problems yourself adds no unique value to your product. In that case, you should just use a well-reviewed external ecosystem package.

A large project will run into many of these problems. It is a waste to re-invent the wheel because a cool new framework has too few pre-made wheels.

RobertKerans

Lack of libraries, as sibling says. Any libraries that exist are not generally well supported relative to similar libs for popular frameworks. Much smaller community, much less ease at finding others who may have had similar issues. Fewer eyes on, fewer bugs picked up. Fewer contributors, slower fixes/updates. Docs there are tend to atrophy faster.

Developed with Hyperapp on big prod apps about three years; was used to inject small amounts of interactive functionality into existing apps (.Net with jQuery powered frontends). Sorta worked, nice, simple idea, but docs almost nonexistent at the time (to be fair there's very little to it), was in process of being dumped for React just as I was leaving (to work on apps with Elm frontends, which Hyperapp takes a lot from, and suffers from similar issues, heh)

sb8244

I interpret this as you need to do everything yourself rather than using off-the-shelf libraries.

AndrewUnmuted

To be fair, they did make a pretty deliberate effort to warn visitors that the website is incomplete, with some animated text:

> this site is a wip, stay in touch!

jorgebucaran

Thank you. That's a marquee haha.

mr0010110fixit

So I have extensively used hyperapp (1 and 2) for hybrid mobile applications that run the cab of big rigs. We actually won best in show this year at Freight Waves for our two apps.

These are medium/larger apps, with lots of functionality, need to hook into native device features (done with ionic capacitor, and custom plugins), and need to be fast, robust, and flexible. Hyperapp has allowed all of those things.

Hyperapp can and will work, with larger applications, but hyperapp does not have super strict "guide rails" like other more popular frameworks do, so its up to you to design, and implement a clean code base. It ships with minimum overhead, and you can either roll features you need, or see if someone in the community has created them.

I have worked with angular (1,2,4,6) and react for quite a few projects, and I actually work faster, and end up with a better end product using hyperapp. Its an amazing little framework. Sure, not having stricter guide rails you can write very poor apps in hyperapp, it will let you do stuff poorly, but if you play to its strengths, and get comfortable with it, it really shines.

toastercat

Hey there, really happy to hear of the success you've had with Hyperapp. I've played with Hyperapp v1 in the past for small toy projects, and it was relatively easy to become productive with. I'm wondering if you have any open toy projects or boilerplate you could share for v2, as I'm looking to jump back on it when I get the chance, and would love to see what a scalable project skeleton looks like.

mr0010110fixit

I do not have anything that is open as of now (but about to start a new project soon)

I would check out https://medium.com/hyperapp/a-walk-through-hyperapp-2-b1f642...

to get your toes wet though, good resource, also feel fee to join the hyperapp slack https://hyperappjs.herokuapp.com/ nice community and super helpful.

WA

Why didn’t you go with Ionic or Stencil? Did you roll your own design?

mrozbarry

Bit of a Hyperapp fanboy here, so bare with me.

First, I think Hyperapp can make both small and big applications, opposed to u/PufPufPuf's opinion. A lot of people have this opinion because they are more familiar with v1's wired-in actions, which can become quite unruly. In the latest version, actions are decoupled, and can be organized/extracted however you see fit.

I've made a handful of applications in both v1 and the current released Hyperapp, and they work very well. If you want to see the latest Hyperapp in action, you can check these out:

- A timer for mob programming: https://github.com/mrozbarry/mobtime

- A canvas game, using Hyperapp for dom/state: https://github.com/mrozbarry/smash

- A router for Hyperapp: https://github.com/mrozbarry/hyperapp-router

I have a handful of older youtube videos regarding v1, you can check them out here:

- Intro to Hyperapp (v1): https://youtu.be/uWIyjI8nkz0

- Hyperapp (v1) forms and localstorage: https://youtu.be/qpt6aaMxm1E

- Unit testing hyperapps (v1): https://youtu.be/5wvPUj--HaA

Note, they are outdated, but there isn't much on youtube about Hyperapp in general.

One thing to keep in mind is the naming. A lot of people talk about "Hyperapp" as the first version, and "v2" as the current version, but this is wrong. It's more like "v1" (legacy) and "Hyperapp" (current). It gets confusing, because not everyone is on the same page with that, but this the the naming Jorge (primary author/creator of Hyperapp) has mentioned several times.

franciscop

> "A lot of people have this opinion because they are more familiar with v1's wired-in actions, which can become quite unruly."

u/PufPufPuf only mentions the lack of ecosystem, nothing about the wired-in actions/etc, so it's odd that you defend v1 vs v2 instead of the lack of ecosystem here. This should probably have been a reply to that thread as well because otherwise it's two very unrelated comments in the list.

mrozbarry

Yeah, I should have split things into a reply and a separate thread for the other stuff. That said, I didn't have any comment on the ecosystem - there's definitely a lack of userland things for Hyperapp, and that's for a number of reasons, the biggest being the latest is still in a bit of a transition period from v1, and as a community we didn't think someone would be posting about Hyperapp and make it to the top of hacker news. That really put us on the spot to try and get on here and explain the state of Hyperapp since we're probably more in a release candidate/late-beta situation rather than a full blown release.

carapace

( s/bare/bear/ )

mrozbarry

You are absolutely correct!

paultannenbaum

Your mobtime app does not look like it was built with hyperapp, but instead is using ferp.

mrozbarry

While the backend (src directory) is certainly ferp, the frontend (unbundled js in public) is 100% Hyperapp.

beders

Someone got inspired by re-frame, I see :) I like the approach. Wondering if there's a way to get ever closer to hiccup (without having to resort to JSX)

Also, letting the framework decide if a function inside the markup should be called or not gives opportunity for more optimizations that go beyond VDOM diffing. That would require an even more declarative approach.

i.e. [h1, {}, [MyComponent, {}]]

vs.

h("h1", {}, MyComponent({}))

If the framework figures out that MyComponent wasn't changed, it can re-use the VDOM nodes.

jorgebucaran

Yep, there's a feature called Lazy (will be renamed to memo for the official release) that allows you to do just that! :)

Shish2k

Been using this for a while and loving it - it feels like functional programming for GUIs (“describe what you want the end result to look like, and the framework makes it happen” as opposed to “describe what steps to execute”).

I’m pretty sure a lot of frameworks have similar mindsets, but Hyperapp is the one that I found works with the fewest headaches :P (as opposed to eg React, where I spent hours simply trying to untangle the knot of thousands of dependencies before I could get step 1 of the quickstart tutorial to compile...)

As an example of how trivial problems require trivial code:

https://github.com/shish/divetools2/blob/master/src/screens/...

https://scuba.shish.io/#screen=MaxOperatingDepth

ptu

I'm a big re-frame fan from the Clojurescript world so this all looks rather familiar. For me it's a great framework and worth learning Clojurescript for.

Seeing the h() function makes me realise how much I miss Hiccup syntax for HTML and your component tree, especially with editor support for parens it's a joy. But it looks nicer than JSX.

I'm going to give Hyperapp a try, I like the small size aspect especially, and familiarity of the overall architecture, my fear is that if you're going off-piste enough to avoid the React/Angular well trodden track on an app, you might as well go the whole way and use Re-frame which is very pragmatic, with JS interop it's possible to do pretty much anything you want. And whilst the type system and compiler of Elm is nice, the slightly more 'infamous' parts of restrictions to JS extensions make it more limited in the real world.

queuep

Haven't been using react because of the JSX, but is this really where we are heading? https://hyperapp.dev/tutorial#rendering-to-the-dom

Looks like som obfuscated JS-code..

pjmlp

If I ever need to render HTML from JavaScript, this is my solution, https://lit-html.polymer-project.org/ or tagged templates directly, although I rather prefer straight MVC separation, SSR/Angular/Vue style.

raziel2p

Mithril was doing this exact thing before React became big - it's what we're moving away from (with JSX), not where we're heading.

lhorie

I wouldn't necessarily say we're moving one way or another. React technically released before Mithril. It just so happens React became more popular and JSX is idiomatic in React. But hyperscript is usually compatible w/ JSX (in fact, in Mithril you can choose whether you want to use JSX or hyperscript)

Personally, I think indentation w/ hyperscript tends to look more natural for large sets of props, e.g.

    h('div', {
      id: 'hello',
      title: 'hello'
      onclick: () => {
        console.log('hello')
      },
    }, [
      // hi
      'hello'
    ])

    // vs

    <div
      id="hello"
      title="hello"
      onclick={() => {
        console.log('hello')
      }}      
    >
      {/*hi*/}
      hello
    </div>
With Mithril's variety of hyperscript in particular there are also some other neat features, such as the ability to pass css selectors as the first argument, e.g. `h('input[type=password].password')` or `const TailwindComponent = '.rounded-lg.md:w-56'; const element = <TailwindComponent />`.

toastercat

Many projects still predominantly use Hyperscript with the option to use JSX (including Mithril and Hyperapp, and others like RE:DOM, snabbdom to name a few). Even React has an option to use it if you want to skip the JSX compile-step. So I wouldn't say we're necessarily moving away from it.

Personally, I prefer Hyperscript. It took maybe a day for me to get over its perceived ugliness and actually appreciate that it's plain, valid JavaScript.

pjmlp

Going back to PHP and ASP you mean.

jrwr

Hay! There is some power in being able to bang out a page with <h1>Hello <?php echo "World"; ?></h1>

marcosdumay

Text templates are the technology for web development. They are so much better than anything else that there's no comparison.

There are some bad templates implementation, and some good ones. The original PHP and ASP are bad. But that doesn't mean templates are bad.

lyjackal

*improving on PHP and ASP

mhd

With thing like GraphQL, I get a definite ColdFusion vibe, too.

tobr

> obfuscated

I’ve heard this reaction before when people see hyperscript-like APIs. I don’t understand it. Isn’t it abundantly clear what is going on if you know DOM and JS? What is your suggestion if you don’t like hyperscript and don’t like JSX? Parsing string templates at run-time?

deergomoo

Wasn't the unwieldiness of render functions the entire reason JSX was created?

michaelcampbell

Not sure of the reason, but it's a godsend comparatively. The reaction against JSX I find to be largely by people who've never actually used it.

If you keep your components small, as is best practice, whatever gut reaction one feels to it (which IMO is misplaced to begin with) is minimized, and quite readable.

onetom

If you keep your components small, then using this `h` function instead of JSX doesn't make a lot of difference from readability perspective.

Also, don't forget that `h` is just a function, so nothing prevents you from creating your convenience functions, which allow more concise/readable code, eg:

const div = (...args) => h("div", ...args) const span = (...args) => h("span", ...args)

(or something along those lines)

I've experimented with this approach before (in ClojureScript) and you can get pretty far with it:

https://github.com/enumatech/cljs-abi-viewer/blob/state-chan...

In fact the Hoplon (https://hoplon.io/) framework as already doing this many years ago, even just using the DOM directly.

gnud

My big issue with JSX is that it forces you to use a pre-processor and source maps.

If you have to do that anyway, I think I could use JSX instead of "pure" JS.

onetom

ah, and the article also mentioned https://github.com/developit/htm which pretty much provides what JSX does, just in a lot less complex way (at the cost of a little run-time)

undefined

[deleted]

lf-non

Haha, I have spent my fair share of time procrastinating over what a type-safe JSX alternative would look like for React.

The most ergonomic solution (well, atleast for me) has been their old factory API upon which I layered a set of convenience utilities [1]. I have been trying it out in a hobby project and I find the reduction of className boilerplate, elimination of closing tags etc. quite productive. And unlike alternatives like react-pug etc. I don't have to compromise with type checking of attributes.

I'll probably release it as a library after doing some performance evaluation and if needed, wrapping it in a babel-macro [2] that eliminates the runtime overhead.

--

[1] Example in CodeSandbox: https://codesandbox.io/s/pedantic-shape-lq9q9?file=/src/reac...

Code in github gist: https://gist.github.com/lorefnon/53377e4d6a6b13adbcfa155f486...

[2] https://github.com/kentcdodds/babel-plugin-macros

ollysb

Elm defines separate functions for each element type which in js would look like

    view: () => div({id: "app", class: "container"}, [
      div({class: "filter"}, [
      " Filter: ",
      span({class: "filter-word"}, "ocean"),
      button({}, "\u270E")
    ]),

I'm admittedly used to this from years using Elm but to my eye I'd far rather use this than JSX.

jorgebucaran

100% agree, that's exactly what @hyperapp/html package attempts:

- https://www.npmjs.com/package/@hyperapp/html

scrump3y

that is pretty much how React looks like after JSX is compiled to "pure" Javascript.

jorgebucaran

Thank you! This is exactly the kind of feedback that we need to improve our presentation. I might just update the tutorial to use @hyperapp/html [1] instead.

[1]: https://www.npmjs.com/package/@hyperapp/html

hellcow

Please don't. Not everyone uses these additional libraries or preprocessors, and it was a big hurdle to figure out what was actually being generated behind the scenes in the v1 docs.

A good approach is to show us what we need to do with no other dependencies (i.e. just as you're doing now with this h() function), and link to alternative syntaxes/libraries that may be optionally used instead.

jorgebucaran

Thank you for the feedback. I'll keep this in mind too. I'm definitely not advocating JSX usage. I favor hyperscript myself, but I understand it's an acquired taste.

Idiomatic JavaScript alternatives that don't involve compilation include:

- https://github.com/zaceno/hyperlit, and the aforementioned - https://www.npmjs.com/package/@hyperapp/html

onetom

the tutorial is great this way. it's gradually introducing concepts and shows what's possible with very few building blocks. at the end, it would be nice to mention that at the cost of some extra code and learning a few more functions/concepts, you can gradually make application code either more concise with @hyperapp/html or having a different aesthetic or more familiarity - similar to JSX - with htm or the hyperapp-tailored variant of it, hyper-lit.

but please keep the current didactic of piecemeal introduction of concepts, providing clear reasons for their existence!

tobr

A nice flourish would be to have every example with both, and have a global switch to pick which one you prefer.

bshimmin

In the tutorial it says: "In this tutorial we'll stick with `h` to keep it simple and close to the metal." I'm pretty sure they put that in there just to aggravate the HN crowd.

jorgebucaran

There's a a JSX-like ttl for Hyperapp too, check it out:

https://github.com/zaceno/hyperlit

d0m

I think they use "Close to the metal" as a way to say "Less abstractions"

mrozbarry

The `h` function isn't too bad to read if you keep small/manageable components. Obviously, any component, whether JSX or something else, with enough content in it, becomes quite hard to read.

Personally, I like using `h` over JSX - JSX can be nice to read, but for people that don't know how it works behind the scenes, it makes things look like magic.

Once you know how Hyperapp works behind the scenes, it's much easier to make the decision to JSX if that's something you care about when developing. I have the same opinion about React, and other libraries that have a strong preference to JSX over their native/function implementations.

stepstop

Or it’s a joke? Assume good intentions

reaktivo

You might find using htm with hyperapp useful: https://www.npmjs.com/package/htm

davydog187

Just use https://preactjs.com/ and call it a day

ggregoire

What are the caveats? Why doesn't everybody use preact instead of react?

davydog187

There’s not many. I used it for several years on theoutline.com and it was great

afshinmeh

I have built https://gridjs.io on top of Preact. It's pretty stable and the API is very nice. Supports most events/callbacks that React has (nothing against Hyperapp though)

schwartzworld

there's a valuable comment if I ever saw one

k__

This.

I like how HyperApp takes this to another level, but the ecosystem of Preact is simply better.

czechdeveloper

I love it, but I actually stuck with version 1, which was way more intuitive for me.

Just a side note, I'm not fulltime front-end, so keeping up with modern frameworks is out of my capacity.

It's great for smart components to my standard multi-paged systems, but I used it even for small PWA applications.

hellcow

I resisted the change to v2 for a long time. In the end I found that v2's state management is much better, so it might be worth a look for that alone.

czechdeveloper

I read about it but it just did not click as V1 did. Also I will not rewrite old code just for sake of change and I want all system to be on same framework if possible. I may actually do my own fork where only difference will be passing root state and root actions in addition to partial ones, which will fix great amount of issues I have.

hellcow

Agreed.

The lack of lifecycle events in v2 complicates things a great deal for seemingly no reason. Subscriptions and Events are similar enough that they could have become a single thing, instead of having two highly similar but not-quite-the-same things to grok. The tuple syntax it uses is very strange coming from v1.

I wish I could call it a strict upgrade instead of saying "some things are worse, but other things are better."

jorgebucaran

I haven't done a great job at explaining why the current Hyperapp is superior than its previous incarnation, but V2 isn't officially out yet, so I encourage you circle back to it when it is.

bharani_m

I've used this for building the browser extensions for my app [1].

It is simple, easy to understand and easy to reason with. However, I would recommend this only for small apps. As soon as your app's features/complexity increases, you end up writing a lot of biolerplate code that libraries like Vue or Preact already handle you for.

[1] https://www.emailthis.me

richeyryan

I haven't used Hyper but I'm looking for something to use for a browser extension I'm making.

I'd love to hear what kind of boilerplate you had to write that Vue or Preact handle. It can be hard to see these gaps ahead of time so I'd appreciate the benefit of your experience.

jorgebucaran

Curious to hear what boilerplate you think Vue or Preact already handles for you.

shash7

Your open source browser extension framework was really helpful to me a few years ago!

bharani_m

Glad you found it useful.

I had sort of neglected it for a while, but during the course of the lockdown, I have started working on a major rewrite - replacing Gulp with Webpack, adding support for Edge, etc. Will release it soon :)

Daily Digest email

Get the top HN stories in your inbox every day.

Hyperapp – A tiny framework for building web interfaces - Hacker News