Overview

    Dapr is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless and stateful applications that run on the cloud and edge and embraces the diversity of languages and developer frameworks.

    Today we are experiencing a wave of cloud adoption. Developers are comfortable with web + database application architectures (for example classic 3-tier designs) but not with microservice application architectures which are inherently distributed. It’s hard to become a distributed systems expert, nor should you have to. Developers want to focus on business logic, while leaning on the platforms to imbue their applications with scale, resiliency, maintainability, elasticity and the other attributes of cloud-native architectures.

    This is where Dapr comes in. Dapr codifies the best practices for building microservice applications into open, independent building blocks that enable you to build portable applications with the language and framework of your choice. Each building block is completely independent and you can use one, some, or all of them in your application.

    In addition, Dapr is platform agnostic, meaning you can run your applications locally, on any Kubernetes cluster, and in other hosting environments that Dapr integrates with. This enables you to build microservice applications that can run on the cloud and edge.

    Using Dapr you can easily build microservice applications using any language and any framework, and run them anywhere.

    Microservice building blocks for cloud and edge

    Overview - 图2

    There are many considerations when architecting microservices applications. Dapr provides best practices for common capabilities when building microservice applications that developers can use in a standard way, and deploy to any environment. It does this by providing distributed system building blocks.

    Each of these building blocks is independent, meaning that you can use one, some, or all of them in your application. Today, the following building blocks are available:

    Hosting environments

    Dapr can be hosted in multiple environments, including self-hosted on a Windows/Linux/macOS machine and on Kubernetes.

    In self-hosted mode Dapr runs as a separate sidecar process which your service code can call via HTTP or gRPC. Each running service has a Dapr runtime process (or sidecar) which is configured to use state stores, pub/sub, binding components and the other building blocks.

    You can use the to run a Dapr-enabled application on your local machine. Try this out with the getting started samples.

    Architecture diagram of Dapr in self-hosted mode

    In container hosting environments such as Kubernetes, Dapr runs as a sidecar container with the application container in the same pod.

    The and services provide first-class integration to launch Dapr as a sidecar container in the same pod as the service container and provide notifications of Dapr component updates provisioned in the cluster.

    The service is a certificate authority that enables mutual TLS between Dapr sidecar instances for secure data encryption. For more information on the service, read the

    Deploying and running a Dapr-enabled application into your Kubernetes cluster is as simple as adding a few annotations to the deployment schemes. Visit the Dapr on Kubernetes docs

    Dapr offers a variety of SDKs and frameworks to make it easy to begin developing with Dapr in your preferred language.

    To make using Dapr more natural for different languages, it also includes for:

    • C++
    • Go
    • Java
    • Python
    • Rust
    • .NET
    • PHP

    These SDKs expose the functionality of the Dapr building blocks through a typed language API, rather than calling the http/gRPC API. This enables you to write a combination of stateless and stateful functions and actors all in the language of your choice. And because these SDKs share the Dapr runtime, you get cross-language actor and function support.

    Dapr can be used from any developer framework. Here are some that have been integrated with Dapr:

    Web

    LanguageFrameworksDescription
    ASP.NETBrings stateful routing controllers that respond to pub/sub events from other services. Can also take advantage of .
    Java
    Python
    Javascript
    PHPYou can serve with Apache, Nginx, or Caddyserver.

    Integrations and extensions

    Visit the integrations page to learn about some of the first-class support Dapr has for various frameworks and external products, including:

    • Azure Functions runtime
    • Azure Logic Apps runtime
    • Azure API Management
    • Visual Studio Code

    Designed for operations

    Dapr is designed for operations and security. The Dapr sidecars, runtime, components, and configuration can all be managed and deployed easily and securly to match your organization’s needs.

    The , installed via the Dapr CLI, provides a web-based UI enabling you to see information, view logs and more for the Dapr sidecars.

    The monitoring tools support provides deeper visibility into the Dapr system services and side-cars and the of Dapr provide insights into your application such as tracing and metrics.