blitz.js - a new React framework

blitz.js - a bolt statement

Hi there, Tom here writing! The current (Fall 2020) React ecosystem is as vast and rich as never before. Many APIs offer React-specialized accessors via hooks, lots of “old” JS-libraries have implemented special flavors for simple and quick usage in React projects, the community is thriving - kurzgesagt, using the framework or developing a library for it has never been easier and has never had more potential to reach such a large audience of users.

It may be exactly these reasons that a new project using your favourite framework of choice has arisen, and it itself is nothing less than a framework: blitz.js. Blitz, “The Fullstack React Framework”, as it’s written boldly on the Github-page, aims high: statically optimized, zero setup for wiring endpoint calls to React components, built-in auth + ORM-based integration of DBs, starting with SQL (ORM refers to Object Relational Mapping, meaning that you can write DB-queries in a object-oriented fashion, aka not writing raw SQL-queries).

Let’s take a look at it! One last reminder: blitz.js is currently in an early alpha state, so keep that in mind when judging and using the framework. Ok, now for real, let’s go!

blitz show features

Blitz is being built on Next.js, one of the hottest new frameworks for creating statical React-web apps, which means there’s already a very strong foundation. Equivalent to Next.js, blitz.js uses file-system based routing. Akin to other libraries such as Nest.js, Blitz provides a special CLI-package for generating various parts of your web application, e.g. blitz generate all project to bootstrap a new project.

This comes in handy when creating new database-models. An example looks like this, which is directly from the tutorial: blitz generate all question text hasMany:choices. Detailed examples are linked at the end of this blog post.

As of writing, blitz.js enables React Concurrent Mode by default, which I don’t particularly like to use in a production environment, as it’s still not stable - but Blitz itself is, as said, in alpha so that shouldn’t be a problem here. One other goal of the Blitz dev community is to also make the framework available for building React Native apps, which in my opinion shouldn’t be a goal at all. Efforts at unifying React + React Native tend to make coding harder, as the targets are still vastly different. I think Blitz should aim at being the best framework for building web apps, which is a hard enough task already.

Outlook

I’m very eager to see the upcoming progress at this project. It combines all the advantages of Next.js with a very sophisticated and powerful tooling set, e.g. a CLI for creating pages, object models, etc. with built-in authorization. I think there’s a possibility that Next.js itself may adopt some of the features primed in blitz.js, which will be interesting to watch. Monolithic frameworks are very hard to build and maintain, but Blitz aims high and looks just as motivated.

- Tom


expressFlow is now Lean-Forge