How to get started with dapr?

Building a distributed application with dapr

Ismael Sánchez Chaves
3 min readMay 16, 2022
A computer on a table, with a couple of books. How to start with Dapr? by Ismael Sánchez Chaves
Photo by Emile Perron on Unsplash

The main idea of this series of posts will be to build distributed applications using dapr as a tool to build microservices. To do so, we will use several technologies and products to have a complete distributed system. But, before we start, what is dapr?

Dapr, “Distributed Application Runtime”, is a portable runtime that will help us build microservices. When people started talking about microservices and their virtues, the associated complexity was ignored. For example, auto-discovery of services, working with message brokers, recovery of state in case of failure… Dapr appears so that we can focus on building applications and, to a certain extent, avoid the complexities of these systems.

As of today, the dapr SDK supports quite a few languages, but it only requires that the chosen frameworks can make HTTP calls work with dapr. But, before we dive into the benefits and features of dapr, we need to know how to get started.

We are going to focus on working with .NET 6 and C#. We are going to use WSL2 with Ubuntu and Visual Studio Code. We will also need to have docker installed.

The first thing we have to do is to install dapr CLI, for this, we execute the following instruction.

wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
Photo by Author

To check that everything has been installed, run the following command:

dapr
Photo by Author

One of the ways to run dapr is, through one of its hosting modes called self-hosted. To use this mode we need to run the following command.

dapr init
Photo by Author

This dapr command has mounted three containers (in docker):

Photo by Author

Also, if we review everything that dapr init has mounted, it has placed files in a system folder, in my case, /home/ismael/.dapr. The configuration of the components in these folders that we will see in future posts.

If you have followed all the steps, you are ready to run your first dapr application.

--

--

Ismael Sánchez Chaves

I always do my best to give back to the community by sharing my knowledge. If you want to know more about me, just ask.