• dsego 4 hours ago

    Afaik, Koa is old, was supposed to be the next express, but somehow it never gained enough traction. That's my understanding. From a technical standpoint, Koa was all about composing middleware and using JS generators. I don't think that's relevant anymore. If you are interested in something more modern, look at Bun or Deno frameworks like ElysiaJS or Hono.

    • lolinder 3 hours ago

      You know, I've pushed back against the idea that the JavaScript ecosystem is absurd in its churn. I've argued that it's largely stabilized. But then I read comments like this, and they almost change my mind.

      > Koa is old

      9 years since 1.0, so sure, that's "old" by some definition. That said, I've been hoping we can get past that definition now that JS-the-language stopped iterating as quickly.

      > but somehow it never gained enough traction. ... look at Bun or Deno frameworks like ElysiaJS or Hono.

      Elysia has 45k downloads a week and Hono has 460k, but it's Koa at 2.5m downloads a week that never gained enough traction?

      Koa never managed to unseat Express because the average Node developer is sick of framework churn and wants to just build stuff. The even-newer frameworks aren't somehow more likely to do so than Koa was.

      > From a technical standpoint, Koa was all about composing middleware and using JS generators. I don't think that's relevant anymore.

      Can you elaborate? What's the new, 'relevant' technical foundation for an HTTP server library?

      • dsego an hour ago

        That was more a response to the "next generation" verbiage used, when it's more of a venerable or established library, so not relevant in the term of hot new thing. Usually when posting a next gen web framework the expectation is that it brings something new, for Koa that was improvements over express, and I feel like that's not next generation anymore, since we've had many changes to the JS ecosystem since then, new runtimes like Bun and Deno, the rise of typescript, promises everywhere, hybrid server/client frameworks, etc.

        • nine_k 3 hours ago

          Are generators still relevant as a performance / concurrently tool, in presence of async support? Or what's the point of Koa's alleged heavy use of generators?

          • lolinder 3 hours ago

            Async generators are a feature built into the language because generators and async/await solve orthogonal problems.

            That said, I also honestly don't know what specifically we're talking about here—I've used Koa on a few small projects and never used a generator for it. I landed on it because it has first-class support for async. Maybe there are generators used under the hood?

            I didn't bother questioning the generators in the first post not because I knew what they were referring to but because the main thrust to my question remains either way: what's the new technical foundation that Koa is supposedly lacking, and why must every JS framework use the latest hotness?

            Koa supports async and otherwise feels very much like express. That has been plenty good for me.

            Edit: Google turns up no references to generators whatsoever on the koajs.com pages, so I'm not at all sure what OP was talking about. But again—I'm less concerned about whether they got the details of the implementation correct than I am about the idea that JS frameworks need to be swapped out constantly to stay relevant.

            https://www.google.com/search?q=site%3Akoajs.com+generators

            • dsego 24 minutes ago

              I can't find the blog post now, but I remember reading about how Koa's event loop was built around JS generators and that was big thing then, that's why I mention it. I haven't used Koa so maybe I'm misunderstanding something.

              I did find this video that covers an early version of Koa. https://youtu.be/RVxx2T7SPw8

              > An introduction to the Koa web framework for Node.js and some of the technologies behind it. Covers ES6 generators, promises and TJ Hollowaychuk's Co library.

              • nine_k an hour ago

                Thanks!

                WRT frameworks, I think that good frameworks have a staying power: see Spring Boot, Django, Rails, and, well, Express.

                When a language evolves as quickly as JS/TS has been past 10 years, fundamentally better ways to do things spring up relatively often. They may be adopted by existing frameworks, or give rise to completely new, legacy-free ones. Sadly, the "legacy-free" tag very often comes with the "nor battle-tested, here be dragons" tag.

          • Aspos 3 hours ago

            Just a few first instalments used generators, yes, but all the subsequent releases do not, ever since await was introduced in JS.

            Koa is awesome.

          • briscoooe 4 hours ago

            I'm not sure "next generation framework" and "requires Node v12 for ES2015 and async function support" belong on the same landing page

            • dsego 4 hours ago

              Old and abandoned (?), I don't think the poster realized this is not a new new framework. I mean, it was new years ago, before JS async was a thing even.

              Here is a post from 2013 explaining how Koa eliminates callbacks with yields.

              https://blog.stevensanderson.com/2013/12/21/experiments-with...

              • edweis 3 hours ago

                It is still maintained (last commit 2 months ago) and yields are deprecated in favor of promises now.

                They am even removing generators in v3

              • kylecazar 4 hours ago

                Yeah, to be fair while this link was submitted now, the project's site is from like 2014.

              • edweis 3 hours ago

                We are using Koa in production, and the library is still being maintained.

                IMH, the upside is that it's a light abstraction of the node's HTTP request. All extensions are provided in different packages (unlike express).

                The downside is that you need to set up the basics (like routers[0]) that are out-of-the-box.

                [0] https://www.npmjs.com/package/koa-router

                • fbn79 3 hours ago

                  Same like you. I like it because is less a framework, and more like a library. Light alternative compared to Express. You can use it as base and choose the library you prefer for other functionality (routing,body-parsing,... )

                  • quibono 3 hours ago

                    If you were to start over would you still go for Koa, or something else instead?

                    • edweis 3 hours ago

                      I did start several small projects and always used koa without reconsidering it.

                  • gnabgib 3 days ago

                    Submitted first in 2013 (281 points, 121 comments) https://news.ycombinator.com/item?id=6933358

                    • quibono 4 hours ago

                      How mature is the ecosystem built around this? Is this a production-ready framework or more of a beta/WIP thing?

                      • pjmlp 4 hours ago

                        Personally unless it is required by customers, it is going to be either Angular or a React metaframework, preferably Spring/ASP.NET if I can do with as little JS as possible.

                        So every new "next generation" that pops up really needs to be an incredible next generation to matter.

                        • edweis 3 hours ago

                          Koa is a backend API library and is independent of your SPA front end tech.

                          • pjmlp 2 hours ago

                            Doesn't change anything from what I pointed out.

                        • error404x an hour ago

                          I used Koa a few years ago. It's good, but meh it’s not really the 'Next generation web framework for Node.js.' I still use Express and sometimes Fastify these days.

                          • aaronrobinson 3 hours ago

                            I inherited a Strapi application and discovered it was built upon Koa and was equally surprised and hopeful I wouldn’t be exposed to it.

                            • T3RMINATED 3 hours ago

                              [dead]