TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Best tiny JavaScript framework?

29 pointsby levthedevabout 8 years ago
I&#x27;m deciding on a Javascript framework to use in building a real time chat application with a tiny footprint. I can&#x27;t use React, Angular, Ember, or Vue because they are too large. I would build the app in vanilla Javascript, but I fear that it will become more and more difficult to maintain and I will end up reimplementing many already solved problems.<p>Some of the frameworks that I&#x27;ve seen that are small, fast, and well-liked are Preact, Inferno, Mithril, and Ractive. Does anyone have any experience with these, or even better, thoughts on a comparison between them?

21 comments

bmh_caabout 8 years ago
I designed tko (<a href="https:&#x2F;&#x2F;github.com&#x2F;knockout&#x2F;tko" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;knockout&#x2F;tko</a>) to make it easy to re-use the best parts of Knockout using tree-shaking ES6 imports.<p>When experimenting with substituting a few modules, I&#x27;ve gotten it down to 4.5k gzipped.<p>It&#x27;s still quite early on (alpha), but already some folks are using it in production. Plus, it&#x27;s mostly backwards-compatible with Knockout.<p>While it might not be an ideal, usable solution for this problem yet, it&#x27;s definitely moving in the direction of filling exactly this niche (among others).
neilsimp1about 8 years ago
Is there a maximum file size that you&#x27;re looking for? Because Vue.js is pretty small, 23K after gzip:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Restuta&#x2F;cda69e50a853aa64912d" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Restuta&#x2F;cda69e50a853aa64912d</a>
评论 #13830377 未加载
Svenskungankaabout 8 years ago
There are two that I know of that are truly tiny: Monkberry[0] and RE:DOM[1] which are respectively 1kb and 2kb in size.<p>[0]: <a href="http:&#x2F;&#x2F;monkberry.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;monkberry.js.org&#x2F;</a><p>[1]: <a href="https:&#x2F;&#x2F;redom.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;redom.js.org&#x2F;</a>
评论 #13830409 未加载
rk06about 8 years ago
<a href="http:&#x2F;&#x2F;mithril.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mithril.js.org&#x2F;</a><p>Size &lt; 8kb gzipped (includes routing and ajax)
评论 #13831388 未加载
lfxabout 8 years ago
If you need tiny footprint best idea would be just to use Vanilla JS. But you can look here for some libs&#x2F;frameworks for specific parts <a href="http:&#x2F;&#x2F;microjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;microjs.com&#x2F;</a>
heycatoabout 8 years ago
I like the dom wrapper this guy came up with: <a href="https:&#x2F;&#x2F;hackernoon.com&#x2F;how-i-converted-my-react-app-to-vanillajs-and-whether-or-not-it-was-a-terrible-idea-4b14b1b2faff#.lcwbdi7ci" rel="nofollow">https:&#x2F;&#x2F;hackernoon.com&#x2F;how-i-converted-my-react-app-to-vanil...</a><p>I adapted it for myself here: <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;heycato&#x2F;domjs&#x2F;blob&#x2F;master&#x2F;dom.js" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;heycato&#x2F;domjs&#x2F;blob&#x2F;master&#x2F;dom.js</a>
评论 #13831462 未加载
kowdermeisterabout 8 years ago
Vue is really small: 18kb min+gzip is tiny compared to the competition.<p>Check also <a href="http:&#x2F;&#x2F;riotjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;riotjs.com&#x2F;</a> 9.73KB (gzip)
评论 #13831495 未加载
maherbegabout 8 years ago
How about basically no framework with svelte? <a href="https:&#x2F;&#x2F;svelte.technology&#x2F;" rel="nofollow">https:&#x2F;&#x2F;svelte.technology&#x2F;</a>
评论 #13830777 未加载
评论 #13831542 未加载
Psyperskyabout 8 years ago
My idea would be something like this.<p>Use any tiny View Library like Preact Inferno, etc. and use the Flux Architecture without any other framework, you implement the store by hand or using some immutable lib and use a simple dispatcher. That way you have a maintainable code since Flux is pretty popular and no big framework.
ppettyabout 8 years ago
One option would be to custom build jQuery and omit the parts you don&#x27;t need or like. The libraries posted all have their merits; but jQuery has so much traction. That means more folks ready to hit the ground running on what you&#x27;re building ... <a href="https:&#x2F;&#x2F;github.com&#x2F;jquery&#x2F;jquery" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jquery&#x2F;jquery</a><p>Edit Gruntfile.js to do that or try a site like: projects.jga.me&#x2F;jquery-builder&#x2F;<p>You can get sub-20Kb builds with just what you need. I did that recently to inline the core parts ...<p>One tip, if you use the builder, take a screenshot! The file generated will have a comment block with - in front of omitted modules, e.g. -ajax if you prefer plain old fetch &amp; other useful info. But the screenshot shows exactly what options you set.
doublerebelabout 8 years ago
For virtual DOM I don&#x27;t go full React, I just use Maquette with Jade templates.<p><a href="http:&#x2F;&#x2F;maquettejs.org" rel="nofollow">http:&#x2F;&#x2F;maquettejs.org</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;gulp-pug-hyperscript" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;gulp-pug-hyperscript</a><p>For a small framework, I&#x27;ve been using SpineJS for years. <a href="https:&#x2F;&#x2F;github.com&#x2F;spine&#x2F;spine&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;spine&#x2F;spine&#x2F;</a><p>Example with Maquette:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;maquette-mapper" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;maquette-mapper</a><p>Using focused, quality components has let me upgrade my stack piece by piece over the years while retaining backwards compatibility.
评论 #13831441 未加载
evilc0about 8 years ago
Have a Look at Backbone.js. <a href="http:&#x2F;&#x2F;backbonejs.org" rel="nofollow">http:&#x2F;&#x2F;backbonejs.org</a> I have choosen the lib for similiar reasons and i loved it
评论 #13831838 未加载
snickyabout 8 years ago
Try <a href="https:&#x2F;&#x2F;github.com&#x2F;wavesoft&#x2F;dot-dom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wavesoft&#x2F;dot-dom</a><p>It looks like tiny React and is just 511b gzipped.
daliwaliabout 8 years ago
Shilling my own library here: <a href="http:&#x2F;&#x2F;simulacra.js.org" rel="nofollow">http:&#x2F;&#x2F;simulacra.js.org</a><p>No template syntax to learn, one function API, 5kb gzipped.
33aabout 8 years ago
Choo! <a href="https:&#x2F;&#x2F;github.com&#x2F;yoshuawuyts&#x2F;choo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;yoshuawuyts&#x2F;choo</a>
scarface74about 8 years ago
Do you need a framework at all? I think you could get away with just plain JavaScript and include Handlebars if you want a templating engine.<p>Maybe add Jquery if you want something just above plain JavaScript.<p>Edit:<p>Another benefit of Handlebars is that if you ever do decide you need a full framework, you can use Ember and leverage your Handlebars templates.
评论 #13831485 未加载
seanwilsonabout 8 years ago
Why do you need such a tiny footprint?
评论 #13830502 未加载
评论 #13830463 未加载
kruhftabout 8 years ago
PX2: <a href="https:&#x2F;&#x2F;github.com&#x2F;burtonsamograd&#x2F;px2" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;burtonsamograd&#x2F;px2</a><p>A better designed version of Backbone with a small footprint.
mabynogyabout 8 years ago
NoJS (posted few days ago):<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13816429" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13816429</a>
kaweraabout 8 years ago
intercooler.js may fit the bill: <a href="http:&#x2F;&#x2F;intercoolerjs.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;intercoolerjs.org&#x2F;</a>
jlebrechabout 8 years ago
<a href="http:&#x2F;&#x2F;mithril.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mithril.js.org&#x2F;</a>