Building blocks

Modular best practices accessible over standard HTTP or gRPC APIs

A building block is an HTTP or gRPC API that can be called from your code and uses one or more Dapr components. Dapr consists of a set of API building blocks, with extensibility to add new building blocks. Dapr’s building blocks:

  • Address common challenges in building resilient, microservices applications
  • Codify best practices and patterns

The diagram below shows how building blocks expose a public API that is called from your code, using components to implement the building blocks’ capability.

A building block, its API and its componentsYour code, drawn as a hexagon on the left, calls a building block over HTTP or gRPC. The arrow ends on a filled circle on the edge of the building block, which is the public API the block exposes. The building block is a card with two component boxes inside it, because a building block uses one or more Dapr components to implement its capability. Two more cards are stacked behind it: this is one building block of a set.Building blockComponentComponentYour codeAPIHTTP or gRPC
Download SVG

Dapr provides the following building blocks:

The Dapr building block APIsFifteen cards, five across and three down, one for each Dapr building block API. Workflows automate and orchestrate tasks within your application. Publish and subscribe provides secure, scalable messaging between services. Service invocation performs direct, secure, service to service method calls. State management creates long running, stateless and stateful services. Actors encapsulate code and data in reusable actor objects. Jobs schedules tasks to run at specified intervals or times. Configuration accesses application configuration and is notified of updates. Secrets securely accesses secrets from your application. Bindings provides input and output bindings to external resources, including databases and queues. Six more are in alpha: cryptography performs operations for encrypting and decrypting data, distributed lock gives mutually exclusive access to shared resources, conversation converses between different large language models, binary store stores, retrieves and deletes binary files, search indexes and queries JSON documents, and vector stores vectors and runs similarity queries.WorkflowsAutomate and orchestratetasks within yourapplicationPublish & subscribeSecure, scalable messagingbetween servicesService invocationPerform direct, secureservice-to-servicemethod callsState managementCreate long running,stateless and statefulservicesActorsEncapsulate code and datain reusable actor objectsJobsScheduled tasks to runat specified intervalsor timesConfigurationAccess applicationconfiguration and benotified of updatesSecretsSecurely access secretsfrom your applicationBindingsInput and output bindingsto external resources,including databasesand queuesCryptographyPerform operations forencrypting anddecrypting dataalphaDistributed lockMutually exclusive accessto shared resourcesalphaConversationConverse between differentlarge language modelsalphaBinary StoreStore, retrieve and deletebinary files usingpluggable componentsalphaSearchIndex, retrieve and queryJSON documents infull-text search enginesalphaVectorStore vectors and runsimilarity queries againstvector databasesalpha
Download SVG
Building BlockEndpointDescription
Workflows/v1.0/workflowDapr’s durable execution engine. The Workflow API enables you to define long-running, persistent processes or data flows that span multiple microservices, guaranteeing each step runs to completion despite crashes, restarts, and outages. Workflow histories can be cryptographically signed and verified, making execution tamper-evident and auditable. The Workflow API can be combined with other Dapr API building blocks. For example, a workflow can call another service with service invocation or retrieve secrets, providing flexibility and portability.
Service-to-service invocation/v1.0/invokeService invocation enables applications to communicate with each other through well-known endpoints in the form of http or gRPC messages. Dapr provides an endpoint that acts as a combination of a reverse proxy with built-in service discovery, while leveraging built-in distributed tracing and error handling.
Publish and subscribe/v1.0/publish /v1.0/subscribePub/Sub is a loosely coupled messaging pattern where senders (or publishers) publish messages to a topic, to which subscribers subscribe. Dapr supports the pub/sub pattern between applications.
State management/v1.0/stateApplication state is anything an application wants to preserve beyond a single session. Dapr provides a key/value-based state and query APIs with pluggable state stores for persistence.
Binary store/v1.0-alpha1/binarystoreThe Binary Store API enables you to store, retrieve, and delete binary files using pluggable storage components. Uploads and downloads are streamed without buffering entire files in the Dapr sidecar.
Bindings/v1.0/bindingsA binding provides a bi-directional connection to an external cloud/on-premise service or system. Dapr allows you to invoke the external service through the Dapr binding API, and it allows your application to be triggered by events sent by the connected service.
Actors/v1.0/actorsAn actor is an isolated, independent unit of compute and state with single-threaded execution. Dapr provides an actor implementation based on the virtual actor pattern which provides a single-threaded programming model and where actors are garbage collected when not in use.
Secrets/v1.0/secretsDapr provides a secrets building block API and integrates with secret stores such as public cloud stores, local stores and Kubernetes to store the secrets. Services can call the secrets API to retrieve secrets, for example to get a connection string to a database.
Configuration/v1.0/configurationThe Configuration API enables you to retrieve and subscribe to application configuration items for supported configuration stores. This enables an application to retrieve specific configuration information, for example, at start up or when configuration changes are made in the store.
Distributed lock/v1.0-alpha1/lockThe distributed lock API enables you to take a lock on a resource so that multiple instances of an application can access the resource without conflicts and provide consistency guarantees.
Cryptography/v1.0-alpha1/cryptoThe Cryptography API enables you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your application.
Jobs/v1.0/jobsThe Jobs API enables you to schedule and orchestrate jobs. Example scenarios include:
  • Schedule batch processing jobs to run every business day
  • Schedule various maintenance scripts to perform clean-ups
  • Schedule ETL jobs to run at specific times (hourly, daily) to fetch new data, process it, and update the data warehouse with the latest information.
Conversation/v1.0-alpha2/conversationThe Conversation API enables you to supply prompts to converse with different large language models (LLMs) and includes features such as prompt caching, response formatting, usage metrics, and personally identifiable information (PII) obfuscation.
Search/v1.0-alpha1/searchThe Search API enables you to index, retrieve, and query JSON documents in full-text search engines using a portable query, filter, sort, and pagination model.
Vector/v1.0-alpha1/vectorThe Vector API enables you to store pre-embedded vectors and run similarity queries with metadata filters against vector databases, for use cases like retrieval-augmented generation (RAG) and semantic search.