loading...

What's the Node framework landscape like?

ben profile image Ben Halpern ・1 min read

I feel like it's been a few years since I've paid attention to this area.

Which frameworks are you working with, what is the most popular "stable/boring" framework, and what's new and interesting?

Discussion

markdown guide
 

What's the Node framework landscape like?

hellscape

 

SkullJS - A comprehensive pain in the arse javascript framework that does nothing but give you bigger node modules.
LavaJS - A library which burdens your workflow and makes you quit the web development.

SkyJS - Another brick-end framework that does literally do nothing but add to your dependency. It makes you a cool DEV.

Please make this at the top of the comment section so that people are aware of the JavaScript ecosystem. πŸ˜‚πŸ˜‚

 

I can already tell that this will be the top comment of the week... πŸ˜†

 

I recently researched Node frameworks for a project and there are a ton of options to choose from.

  • Express - Still the most widely used by a large margin. It is a barebones framework, so much of the setup for routes/views is done manually. To extend Express, you would use Express middlewares to take action on the incoming requests or outgoing response.
  • Koa - The successor to Express from the same initial development team, but has not gained as much traction as Express.
  • Sails - A framework that is based on Express, but provides some MVC conventions and ways to generate routes.
  • Hapi - This one has been rising in popularity. It provides more features out of the box than Express and there are plugins to extend it. It differs from Express because these plugins run together with Hapi to provide that functionality, as opposed to middleware that operates on requests and responses.
  • Adonis - This is more of a full-featured framework that was inspired by Laravel. It has been gaining popularity and looks pretty slick.

Those were the top 5 I considered, but there is also Meteor, Fastify, Nest, Keystone, Hasura, Vulcan, Hammer.js, Prisma, LoopBack, and others.

When in doubt, follow the saying of "Nobody ever got fired for choosing IBM" but replace that with "Express". It gets the job done and has the community support to back it up. A lot of the newer frameworks look very cool and include more features to provide a better developer experience, but it can be hard to choose and hard to predict long-term support for them.

 

AdonisJS is interesting and appeals to folks who've used Rails or Laravel (which would include myself).

The only thing that looks a bit weird is their homegrown custom "import syntax" (using a "use" keyword that seems to be taken literally from Laravel), instead of 'require' or standard ES6 'import'. But maybe (probably) their documentation explains the rationale behind that choice.

 

I heard the 'use' syntax is going to be replaced with ES6 'import' in the next version of AdonisJS v5

Interesting! I don't know what the original reasoning was behind "use", but I assume it had some advanced capabilities which are now covered by standard "import" so that they don't need their homegrown syntax anymore ('import' is now supported natively by the newest node.js versions).

V5 is being rewritten in TypeScript

That's also good news, I'm definitely starting to see the advantages of TS.

 

Hmm I think sails is not relevant anymore :(

 

Right, that should definitely be AdonisJS now, Sails is probably a thing of the past

 

The idea of sails.js was promising I think the biggest problem with sails.js was that it came out when node was still infant.

 

I work at Prisma and we're currently working on a modern Node.js backend framework that'll make it easy to spin up an entire backend. A few core characteristics of the framework are:

  • Declarative and type safe
  • Minimum boilerplate
  • Extensible via plugins (e.g. for auth, logging, ...)
  • Database included
  • Code-first GraphQL
  • Zero-config and awesome developer experience

You can check out the framework on GitHub or watch this short demo video! The temporary name for the framework is graphql-santa πŸŽ…

The stack is based on the following tools:

  • Database: PostgreSQL (alternatively you can use MySQL or SQLite)
  • Data access (ORM) & Database migrations: Prisma 2
  • Code-first GraphQL schema construction: GraphQL Nexus
  • GraphQL server: Apollo Server

To get started and set up your first project, you can simply run:

npx graphql-santa

We're very eager on getting feedback for this framework, I'd love to hear some opinions and thoughts on this approach!

 

If you're looking for a fullstack framework, also definitely check out the Hammerframework.

It's built by GitHub's co-founder Tom Preston-Werner and has similar design as goals graphql-santa, but also includes the frontend. This is the stack they're using:

  • Babel
  • React
  • GraphQL
  • Prisma Photon
  • JSX
  • Styled Components
  • React Router
  • Apollo
  • Prisma Lift
  • Storybook
 

I am using Prisma v2 + Nexus + Nexus-Prisma for a month, and have a very pleasant experience with it. DX is top-notch and every flow is connected together.

For example,

First, Prisma2 schema gives you a nice abstraction over the DB, so later on you can migrate your data source easily. And its GraphQL-like syntax means you can pick it up in notime.

Then you play with your database schema, adding this, changing that, with prisma2 dev running, every change will be temp saved and you can review them in the Studio GUI, and after you feel good about it, you use prisma2 lift save and up the changes to the database.

Then go to your GraphQL schema, expose the fields to the schema, wow, just type, t.yourModel.blahblah, all properties from the DB are there with auto-completion.

later on, in the resolver, with normal CRUD, a beautiful t.crud.createOneUser or t.curd.upsertOneUser are there, makes it super easer to up and running, no boilerplate, and you can add control at every step because it is basically just giving you the conveniences without taking the control out of you.

With Typescript, you don't even need to look at the doc as everything is just there in the type information, and the API is intuitive, so I don't think you need to learn, after using it for a few times, you can infer the API by yourself, and found that it is just there... even you forget, with a single dot or hover your mouse over, auto-completion will tell you everything.

If you use REST but GraphQL, you can still benefit from every advantage that I just mentioned.

And then you can see, that it pretty much creates a productive closure for back-end development, and you go through the flow with confidence as everything is backed by typing if you are using Typescript.

Looking forward for graphql-santa for how much further it could take us.

I am always searching for a less-code but without sacrificing control solution to my back-end. And I am glad that I found the Prisma2 stack.

 

I stopped asking this question so frequently and jumped into building apps to try things (frameworks/languages) out.

I'm currently testing to make a GraphQL app with graphql-yoga and express along with objection as an ORM and knex to run migrations. I'm liking it so far, if you want to take a look: github.com/francocorreasosa/dataze...

 

Objection js has a plugin objection-graphql. Have you tried that ? And since you we're sure about using graphql and TS did you consider Typegraphql+Typeorm / Nest js + Typeorm ?

 

I considered using that plugin, but wanted to learn how it works manually first. Probably would use some of that for a production app.

 

I'd like to add another Express. Together with Apollo Server, TypeORM and TypeGraphQL I have the right amount of batteries without too much boilerplate. I use this combination at work and for a very recent side project and I got even happier with it over time.

 

At work:

Our own server framework which is based on express. Frontend are mostly react Client side rendered.

Personal:

Express + next.js in combination with typeorm and postgresql. I call it the boring stack for me but it is really efficient to work with it. Ahh yeah typescript πŸ‘πŸ‘πŸ‘

 

Personally I’m using express and apollo-server for almost all my Node projects. Frameworks seem to come and go in the Node community so I try to stay away from most. Express has been around for awhile so it has my trust and Apollo-server let’s me build GraphQL APIs without being opinionated.

 

It seems to me like the crowd that made a lot of buzz surrounding Express a few years ago have since moved to backends written in Go. I don't have any data to back this up, and I'm also not a JS guy, so this could be way off, but it seems like it's pretty common for me to find JS-heavy frontends coupled to Go backends these days, instead of Node backends.

 

FeathersJS deserves a mention. Interesting concept based on "hooks" and "services" which promotes functional/FP and thinking in "services" and pipelines. But having read the other comment it seems good old Express still rules and is the 'safe choice'.

 

Hey pals, beside node's powerful capabilities, frameworks add more power to existing features.
There are alot of framework available but i would recommend Adonis on the top of others.
I have created a repository structure that is useful for creating APIs as well as admin panel fully compatible with mysql and mongodb.
It has ready made CRUD operations.
Here is the link.
github.com/waqaradil/AdonisRepo

 

Express, Gatsby, and Next.js are all pretty popular, and all used for different reasons.

 

Rails like: Nest Js, Foal TS, Adonis
Popular: Express, Fastify
Micro: Polka, Koa

ORM: Objection Js, Sequelize, Typeorm

Other Mentions: Typegraphql

 

NestJs is the definitely more mature and more fun to work it, worth checking it out.

 
 
 

I'm quite surprised no one has mentioned serverless framework?

 

I don't have a boss who pushes me to use some specific framework so my choice is Koa.

Koa supports async routes, it is lightweight and is written in modern JavaScript, compared to Express.

I like Koa and I wish people stop using Express and move to it, or at least to Fastify

 

And koas typescript support is much better than what express has

 

yeah it is a huge bonus also, especially to DX (VS Code autocomplete)

 

I hate to say this, but Express is still stable and reliable. I feel it’s the framework I have used the longest without any major upgrades.

Micro, Polka, Hapi, Koa have been around, but the adoption is so small.

A few years ago it was bad practice to write the backend in TypeScript. Now it seems that is changing. I have seen dev servers run webpack or rollup before starting now. So bundling seems to be making its way to the backend as well.

SSR has gained a lot of popularity and is making a comeback after years of thick client only. Because of Next and Nuxt makes this so much more accessible, you are starting to see this more.

You are also seeing some of these frameworks handle what would typically be Express routes by having specific conventions for endpoints. Next has done both serverless and api conventions.

Deploying is also changing, with more technology pushing JAMStack, which is breaking down some of the old reliable Express servers into multiple Lambda functions.

 

Haven't seen a mention of Feathers yet, which is the framework I chose about 2 years ago for my side project IronMic.

It was quick to learn and work with, is built on top of Express, supports realtime features, and is still receiving maintenance and new features.

My main gripe with Feathers was lack of built-in features similar to other frameworks like Rails and Laravel, but it seems like that has been improved in the most recent version with the addition of JWT-based authentication. There are still more that I would like to see added such as queue management.

At the time, the best two options were Feathers or Sails, and I don't regret choosing Feathers. Today, the landscape has grown with solid options like Adonis, Nest, and Foal TS.

For me, Feathers is the boring framework, but only because I am familiar with the code, features, and community. Looking forward to trying out Adonis and Foal TS the most, but there is no guarantee that they are better. Definitely wish there was a goto option besides Express!

 

FoalTS seems good to be a nice find

 

Micro-frameworks rule the land. As far as I know Express is still the king, although the problems of using a micro-framework when you wanted an opinionated framework are starting to show. People aren't happy with Express anymore.

Opinionated framework are starting to make noice on social media (the twitters), I see the names NestJS and AdonisJS pop every now and then.

 

I still feel that micro-frameworks are the way to go with Node. Express may not be the most exciting choice but it's reliable, has a good community and the ecosystem is well developed. Frameworks like Nest and Adonis come batteries included but they have much boilerplate in my opinion. If I'm going to be using an opinionated MVC framework I might as well go with a tool in a different language which I know is a staple - Rails, Laravel or something else in those lines.

 

Mostly working with Express at work, but it's old and poorly maintained. I have been exploring Fastify and Nest recently, they look very promising!

 
 

Fastify looks like an Express clone. I think Nest is moving the ball forward in terms of features and their documentation is complete.

 

Nest uses a syntax like Angular; all TS, empowered by decorators for lots of things, controllers, services, dependency injection. It uses abstractions on top of express, so express can be swapped out for fastify, and plugins can form more easily