Working with stateful data and databases is hard, especially when your project grows overtime. To have a good development and project setup right from the beginning is essential for the success of your development project. In this Post I want to show you how I have set up most of the projects and try to highlight some thoughts behind the setup.

In this example we’ll work on a simple NodeJS API that is powered by a PostgreSQL database for data storage and setup some tooling around it to make dev’s life easier.

This is the setup:

the setup - NestJS & typeORM connected to a PostgreSQL DB in a docker container

To build the API…


using ErrorEffects with ngrx/effects to keeping your components clean.

with ngrx/effects you can nicely work with side effects in your application like fetching something from a remote origin over http etc. but how can we deal with errors cases in a nice way without putting all of the error handling code into the component.

You may want to show some nice error messages using material.angular/snack-bar to the user, indicating that something went wrong.

Especially if you have multiple effects like a list-effect and a detail-effect that fetch data from the backend you may want to deal with all of the error cases in a general way.

The fetch happy case flow:

Simon Gausmann

Fullstack Software Architect and Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store