Backend NodeJS with NestJS


As most developers surely know, a dev's blog is a showcase of all their work. For my own there have been several iterations over the years, evolving from PHP, Angular, Gatsby, NextJS and then finally to its current iteration (although more are likely coming in the future), NestJS and React.

The vast majority of the previous stacks that I have used in the past have had their own static collection of markdown files (with the latest version of NextJS being the exception). Although the last version of my blog used NextJS and KeystoneJS I found that both had features that were lacking. Namely the lack of inline images in KeystoneJS which meant no pretty pictures for my blog combined with how difficult it was to get 3rd party authentication solutions up and running with that combination.

The solution to this in my mind was to build my own, combining the things that I had learnt over the years with my very own CMS and Frontend combo.

The plan was simple. DB + OAuth + Blog = Win. It was anything but.

For the backend of my new blog, I used NestJS (a heavily structured NodeJS API framework) and regular old React. NestJS has awesome documentation with support for a wide variety of features, from built-in passport integration to easily-done role-based permissions for each route. Once you get the hang of it NestJS is extremely tactile to use with a variety of combinations that can be used to achieve the goals that you have set for your project. Whether it be a CMS like mine or an entire E-Commerce platform.

The other essential tool in this process was Prisma. An ORM like no other (in JavaScript) that allowed me to easily work with a PostgreSQL database to store all the different types of data that I wanted without me having to create my own queries and migrations.

With help from YouTube channels such as FreeCodeCamp and a series of scattered blog posts, I was able to make my plan a reality. A blogging platform with rich text support, image support, 3rd party auth support and hopefully (when I get around to it) GraphQL support.

I hope to continue using these platforms to continue to improve the capabilities of my projects in the future as well as to build up my skill set to eventually tackle larger projects.