7 ms·
Show HN: Mizu.js – Lightweight HTML templating library for any-side rendering
Hey HN,
I'd like to share a fun project I've been working on: mizu.js.
It's a js library that add functional attributes support into your html, designed to be a simple and flexible alternative to fully-fledged web frameworks (such as Vue, React, and Angular), while offering more capabilities than other lightweight options (like Alpine.js and htmx).
As it's written using modern ES features and due to its isomorphic nature, it can be run in both browsers and runtimes (Node, Deno, Bun) without any changes.
This makes it ideal for client-side and server-side rendering, as well as static site generation, whichever environment you prefer.
Just include the script in any web page (or backend) to get started.
You can template content, bind attributes, add interactivity, handle HTTP interactions, create custom components, and much more — all out of the box, without any configuration, transpilation steps, or builds.
I hope you'll find mizu.js as exciting and useful as I do and I'd love to get your feedback!
You can learn more about it at https://mizu.sh https://mizu.sh!
Online playground: https://mizu.sh/playground https://mizu.sh/playground
Custom builder: https://mizu.sh/build https://mizu.sh/build
Code coverage: https://mizu.sh/coverage https://mizu.sh/coverage
GitHub: https://github.com/lowlighter/mizu https://github.com/lowlighter/mizu
## Motivation ##
Nowadays, setting up a complete environment and installing thousands of packages is often required just to create a simple "Hello World" page.
Yet, with the current ECMAScript standard, vanilla JS has never been more powerful.
It offers built-in custom HTML components, proxies for changes tracking, weak references for better memory management, and many new data structures and methods.
So why is web development still insanely complex?
mizu.js aims to avoid adding bloat on top of native features, and instead focus on providing convenience helpers.
It's basically "glue" around all these native features with added sugar, a recipe for a lightweight yet powerful utility.
All evaluated expressions are interpreted as vanilla JavaScript, and you add your instructions directly into your HTML.
So if you know already know about JS/HTML, then you're already 80% know of how to use mizu.js (add an extra 10% if you've used Vue, Alpine.js or htmx in the past as some syntax and concepts are inspired by it), the rest is basically just remembering the directive names.
The learning curve is that small.
Also, you may have heard of https://matcha.mizu.sh https://matcha.mizu.sh, a CSS stylesheet to instantly make your web page stylized.
Well, it's a great companion to mizu.js. With both of them, you can create MVPs for your projects super fast!
- tonyhart7 2y agobut what is the cons here???? anything you mention about the pros, there must be cost to make right?? after fast skimming it, I found its gonna be hard to separate concern when build interactive UI
- deleted 2y ago[deleted]
- progx 2y agoIt is a simple lib for simple things. If you need more, there exists "hundreds" of frameworks for more.
- pvg 2y agoA related thread about half a year ago https://news.ycombinator.com/item?id=40455944 https://news.ycombinator.com/item?id=40455944
- corinroyal 2y agoI love the information architecture of this site. You jump right in to demonstration code and a reference and only later the marketing text. So refreshing. I can see at a glance what the project is and what makes it different. Kudos!
- lowlighter 2y agoThanks! It's always hard to find a nice balance between explaining your project and showing how it actually work
- phplovesong 2y agoFeels like knockoutjs, i recall using it 10 years ago. It was all so simple back then.
- MortyWaves 2y agoI recently used it in a legacy site. I had forgotten most of it but I remembered enough. Turns out knockout introduced components, around 2015 or so. Yeah, actual components like you’d encounter with any modern framework/library like React. It has some nuances but they are pretty much real components, and I was able to make some pretty advanced functionality in an otherwise typical spaghetti code disaster. Even wrote unit tests for it. People were in disbelief any of this was even possible. Turns out that while modern patterns and tooling go a long way, they you still need to put effort into making quality software of any kind.