Using Dependency Injection to follow SOLID principles

In this article we will touch the SOLID theory a little, what is DI, and how it can help us. Then, we will jump into examples. The main point of this writing is to show how to write more testable and supportable software using DI and SOLID.

So, What is SOLID?

SOLID is a set of principles that were present by Robert Martin in his books:

  • Open Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion principle

All these principles help to write better software. But today we only focus on the first and the last ones.

Dependency Inversion Principle (DIP)

This principle says…

Save your time, use gRPC in you next frontend app

Photo by Tim Gouw on Unsplash

If you lose a bunch of time every time, adjusting your client app to the backend REST API, this article is here to save you.

What is wrong?

One of the big problems with REST API is a specification. If you develop a frontend app in React/Angular/Vue, most of the time you use an API. And most of the time, this API is written by another developer.

The specification for this API must be elaborated in advance, in order to develop client-side and server-side in parallel. Elaborated specification is hard to modify. …

Most likely, if you are reading this, you can’t grasp, why would someone ever use Vim as a primary code editor? And if someone really does use it, there must be a good reason. I was in your shoes once. When I found out that someone really preferred Vim as their code editor over an IDE, a lot of questions started bothering me.


I knew about Vim’s existence since college, but I could not imagine that it could be something suitable for coding. I thought of Vim as a last resort — as a tool for minor changing text somewhere…

You must have heard about gRPC and its advantages. Here, I will show you how to build a modern API with Nest.js and gRPC in typescript.

Why gRPC is cool

Why use gRPC? It has a ton of advantages like performance, code generation, streaming, etc. But, for me, the main one is a strict specification. GRPC forces you to write .proto files that describe your API. This feature let me and my team retain a lot of time. Proto-files are specifications that can be written before the development start, and it may be a single source of truth for API implementors.


In the first…

What will we be building?

In this article, we will build two simple Node.js apps, that will communicate via RabbitMQ. First app, let’s call it sender, will provide an API to send something to the second app. Second app, let’s call it receiver, will be receiving messages from the sender app and printing them to the console.


In this article, we will use RabbitMQ to build communication between these apps. RabbitMQ is a message broker written in Erlang and using multiple protocols to communicate with a user (we will use AMQP).

Communication strategy is deadly simple. First app, aka sender, will check if a queue…

What will we be building?

In this article, we will try to build a simple Golang API for authorization and authentication. We will use JWT to store a user to reduce database calls and Echo framework to build routing. PostreSQL and pgx will be used to handle the database part.


So, let’s start with designing the service API. We need an authentication route, which compare given login and password with ones in the database. If login and password match we will generate a JWT token for a user and store it in the cookies.
To authorize a user, we have to register one. …

Sergey Suslov

Fullstack engineer at Velvetech.

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