Introducing Hyperstack — The Pragmatic Node.js Web Framework for Builders

A look at our latest open-source tools for programmers

image by author

hyperstack There is a new open-source Node.js web framework for builders. It’s not re-creating the wheel, it’s just wrapping a bunch of great wheels and good parts for you to use – in a nice Rails-like package.

Good software is simple software that solves complex problems. Building simple software usually requires following some flavor of principles, design patterns, and strong opinions that help us navigate its perils. paradox of choice,

When you don’t have these principles and best practices to guide your simplicity, I’ve seen engineers kick the tires for fun with the trending microservices API framework of the year, and before you know it, They are feet deep in building a microservices architecture. Painfully Simple Web App. ,That’s how we should do it, that’s how scalable software can be built.” they thought.

For many people, it’s becoming easier to build complex software, and harder to start something simple.

Simple software solutions to simple problems

ice cream with server in it
image by author

A single app with a single relational database has been perfect for decades for building great software and is still great for starting off on the right foot for projects that are just fun to build simple software.

Ruby on Rails Absolutely capable. you build a majestic monolith which solves simple And Complicate problems until you can’t do any more.

heyonly thenWhen you’re smart about everything, when you have a ton of data and experience with all the use cases you can solve —Then You start partitioning and building microservices.

This approach worked: GitHub, Airbnb, Twitter. It all started as a monolith. Some of them are still a majestic monolith: songlab, Most of them still use Ruby on Rails.

TypeScript vs Ruby in the Rails world

typescript vs ruby
image by author

Rails is arguably the best web framework ever created, and Ruby is the programming language you’ll need to use to build a Rails app. It has most likely influenced everything you touch today in software on the web, whether you know it or not.

While you can still use Rails, you may prefer to use TypeScript and Node.JS and not Ruby.

There are a lot of reasons to prefer TypeScript and Node.js over Ruby for backend development:

  • Prior experience for individuals or teamor prior codebase you are trying to modernize
  • Code Sharing is a real thing between server and client
  • infrastructure sharing Frontend tooling (there are a lot!) is a big deal with: dev tooling, CI, code quality, leading to effectiveness of the entire team over time
  • Lastly, Ruby is a great language, but Not as popular as TypeScript anymore
Introducing Hyperstack — The Pragmatic Node.js Web Framework for Builders
Image: Wikipedia

What does it take to make Rails in the TypeScript world?

  • model– A robust ActiveRecord abstraction that magically knows how to connect and operate
  • database handling: Support for migration, seeding — and multiple databases for a better developer experience
  • controllers routing, and authentication and security best practices – to allow easy API creation as well as avoidance common safety catch
  • mailers– While you can do email through a third party SaaS, it is more productive to build, test, and experiment with email locally. For that you need support.
  • background jobs– Because using a raw queue service like SQS is not as ergonomic or test friendly as using a dedicated background job framework.
  • Work– You need to fix records, clear data, or send ad hoc emails to users. Create a custom task that is fully testable with access to your live app and invoke it just like you would using make
  • Interactive REPL– Easily access live objects and information about an app, remotely or locally
  • code generation and scaffolding– Build fast by creating models, controllers and more
  • trial as a first class citizen– Every piece of the framework lends itself to clean, easy testing
  • configuration and operation– Concerns like logging, monitoring and app control plane
  • Conventions and Opinions— Folder structure, naming, lining up, formatting, all taken off your back so you can focus on building products
  • Kiss— When faced with a choice, always choose the easy way out. For example, ActiveRecord over Data Mapper, or any other entity mapping magick. ActiveRecord lends itself to simple code.
  • ideas– An automated way to cut the boilerplate of formatting, serialized responses and error states from the app to the clients
1*8nX66WLeiBrVuDWjZaUt2w Introducing Hyperstack — The Pragmatic Node.js Web Framework for Builders

Here are some trials and tribulations if you were trying to assemble such a thing from scratch, specifically for Javascript and Node.js. Surely some of this sounds familiar:

  • Build it with ExpressU Need to remember about async failures, Yes, koa And others are great, but Express works for most API use cases, is also simple and widely adopted, and is what people usually expect to find in a general-purpose API project.
  • Choosing and Wiring the LoggerTakes request scoping, process scoping and much more handling can be a mess, you have to thread the needle through global and local states in a contrived world.
  • Building background job infrastructure from scratch will set you up for failure, There’s a lot to know here for building this from scratch or even just choosing the right queuing system and building the right abstraction and infrastructure on top of it.
  • For testing, you have to create an Express app, remember to clean up the database, set up a schema, load the data, and start your tests. These are all basic frameworks that you have to build and do trial and error until it works well for you.

And that’s just the tip of the iceberg. luckily, i’ve made hyperstack So you don’t need to build it yourself.

A HyperStack App in 5 Minutes

image by author

hyperstack There is a TypeScript web framework, the answer star of which is Rails. It closely follows Rails where it benefits the developer experience, but deviates from the fundamentals where it takes advantage of the practicalities of building Node.js apps in TypeScript.

Let’s create our first app:

$ pnpm create hyperstack
$ cd my-hyper-app
$ pnpm install
$ bin/hyperstack start

And we’re done!

hyperstack running in terminal
image by author

Hyperstack has created the database, migrated it, set up your working development environment, transpiled the JavaScript, and served up a fancy API for you with secure headers, static service, email previews, and background workers in the process. but configured with the configuration to be a fully scalable queue-based background job processor.

CTRL-C end the process and add your blog article:

$ bin/hyperstack g scaffold article title:string body:text
Loaded templates: gen/dist/templates
added: src/test/requests/articles/sanity.spec.ts
added: src/app/controllers/articles.ts
added: src/config/db/migrate/1337_article.js
added: src/test/models/article.spec.ts
added: src/app/models/article.ts
inject: src/app/controllers/index.ts
inject: src/app/controllers/index.ts
inject: src/app/models/index.ts
✔ shell: running eslint
shell: yarn eslint --fix src/app/models/*.ts src/app/controllers/*.ts src/test/models/*.spec.ts src/test/requests/articles/*.spec.ts src/config/db/migrate/*.js

You got a controller, models, migrations and automatically written tests for free.

Run your app again and start making requests:

$ bin/hyperstack start

i am using XH but you can use http which is similar, or whatever you like:


$ xh -j -b localhost:5150/articles

"articles": []

It’s empty, so let’s create an article:

$ xh -j -b localhost:5150/articles title="hello hyperstack" body="EVH rocks"

"title": "hello hyperstack",
"body": "EVH rocks"

Take a look at the list again:

$ xh -j -b localhost:5150/articles

"articles": [

"title": "hello hyperstack",
"body": "EVH rocks"


And we’re done!

feel free to explore further in the docs, You can play with HyperStack Root and HyperStack Portal for interactive REPLs, and much more.

Terminal window showing Hyperstack Portal output
image by author

Remember: complexity always finds its way

We struggle with complexity and avoid simplicity – Norman Vincent Peale

You can always choose to learn, and build a complete framework from scratch. You can also take the time to build a scalable architecture from scratch.

But sometimes, you just want to build a product, or have some fun, without subscribing to weeks of setup, infrastructure, and configuration as an initial step.

To make products quickly, just use hyperstack,

how to join

Rocky the Puppy Building Server
image by author

you can start on Websiteor jump in github repo To read through the source code. We are also accepting PR if you have to improve or report problem.

stat?event=post Introducing Hyperstack — The Pragmatic Node.js Web Framework for Builders

Introducing HyperStack – A Practical Node.js Web Framework for Builders was originally published in Better Programming on Medium, where people are continuing the conversation by highlighting and responding to this story.

Leave a Reply