The PERN stack

For the last year or so, I’ve been working in a pretty standard Javascript stack – Mongo, Node, Express, React. Modeled on the so-called MEAN stack, this has the advantage of a native Javascript data store along with some reasonably mature tooling. But I wondered – why didn’t this have its own four letter acronym? Could it be that people realized something wasn’t quite right? Truth be told, I never really warmed to Mongo – what would this look like with a traditional relational database?

And so it is with great pleasure that I present the PERN stack, composed of Postgres, Express, React, and Node. The reference code has a backend API and a simple frontend React app which allows you to create an account, login, and log out. It also has an awesome acronym – hoping to get the amazing Michael Whelan to do the O’Reilly book cover.

Seriously, though, this was a fun project. There’s still plenty to do, but there were a couple of good lessons along the way. There were little things, like the fact that ES7 async/await makes all your asynchronous code so much better – if you’re still working in Bush-era Javascript idioms, it’s time to start re-evaluating some of your life choices. There were obvious things, like that the tooling exists, and that language/engine choice isn’t destiny – just because you’re working in a Javascript stack, doesn’t mean you can’t have your RDBMS too. And most importantly, that building something by yourself, from scratch, will teach you way more about why things are the way they are than working in someone else’s code base.

Still, reference code is key, and this is my personal contribution. Enjoy!

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

5 thoughts on “The PERN stack

  1. I know this article is 4 days shy of being 2 years old at this point, but a couple of days ago I built a simple app with basic CRUD and user registration/login using PERN just to see how it worked. I Googled to see if anyone else was using Postgres instead of Mongo and lo and behold, I found this.

    I was a PHP/MySQL guy for a long time and have happily used Laravel in recent years but I’ve found working with a full JavaScript stack to be a most enjoyable experience and using a RDBMS on the backend has only made it more so.

    Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s