Components

Modular functionality used by building blocks and applications

Dapr uses a modular design where functionality is delivered as a component. Each component has an interface definition. All of the components are interchangeable so that you can swap out one component with the same interface for another.

You can contribute implementations and extend Dapr’s component interfaces capabilities via:

A building block can use any combination of components. For example, the actors and the state management building blocks both use state components.

As another example, the pub/sub building block uses pub/sub components.

You can get a list of current components available in the hosting environment using the dapr components CLI command.

Component specification

Each component has a specification (or spec) that it conforms to. Components are configured at design-time with a YAML file which is stored in either:

  • A components/local folder within your solution, or
  • Globally in the .dapr folder created when invoking dapr init.

These YAML files adhere to the generic Dapr component schema, but each is specific to the component specification.

It is important to understand that the component spec values, particularly the spec metadata, can change between components of the same component type, for example between different state stores, and that some design-time spec values can be overridden at runtime when making requests to a component’s API. As a result, it is strongly recommended to review a component’s specs, paying particular attention to the sample payloads for requests to set the metadata used to interact with the component.

The diagram below shows some examples of the components for each component type

Building blocks and some of the components that implement themAn application with a Dapr sidecar at the top feeds a horizontal line, and from that line an arrow drops to each of fifteen building blocks. The stable blocks come first: state management, publish and subscribe, bindings, secrets, actors, configuration, workflows, jobs and middleware. The alpha blocks follow on the right: distributed lock, cryptography, conversation, binary store, search and vector. Under each block are the marks of some of the components it can be configured with. State management shows AWS DynamoDB, Azure Cosmos DB, Google Firebase and Redis. Publish and subscribe shows AWS SQS, Azure Service Bus, Redis and RabbitMQ. Bindings shows AWS S3, Azure Storage, Google Cloud Storage and Apache Kafka. Secrets shows AWS Secrets Manager, Azure Key Vault, Kubernetes secrets and HashiCorp Vault. Actors shows AWS DynamoDB, Azure Cosmos DB, Redis and PostgreSQL. Configuration shows Redis, Azure App Configuration and PostgreSQL. Workflows has no components of its own: it is served by the Dapr runtime. Jobs shows the Dapr mark for the same reason. Middleware shows OAuth2, OpenID Connect, Open Policy Agent and WebAssembly. Distributed lock shows Redis. Cryptography shows Azure Key Vault, Kubernetes secrets, JSON Web Key Sets and local files. Conversation shows Anthropic, AWS Bedrock, Mistral and OpenAI. Binary store shows AWS S3, Azure Storage and Google Cloud Storage. Search and vector each show Meilisearch. These are examples, not the full list.AppStatemanagementAWSDynamoDBAzureCosmos DBGCP FirebaseRedisPublish &subscribeAWS SQSAzureService BusRedisRabbitMQBindingsAWS S3Azure StorageGCPCloud StorageKafkaSecretsAWS SecretsManagerAzureKey VaultKubernetesSecretsHashiCorpVaultActorsAWSDynamoDBAzureCosmos DBRedisPostgresConfigurationRedisAzure AppConfigurationPostgresMiddlewareOAuth2OpenIDConnectOPAWasmDistributedlockalphaRedisCryptographyalphaAzureKey VaultKubernetesSecretsJSON WebKey SetsLocal filesConversationalphaAnthropicAWS BedrockMistralOpenAIBinary StorealphaAWS S3AzureBlob StorageGCPCloud StorageSearchalphaMeilisearchVectoralphaMeilisearchSome of the components for each building block API. See the component reference for the full list.

Built-in and pluggable components

Dapr has built-in components that are included as part of the runtime. These are public components that are developed and donated by the community and are available to use in every release.

Dapr also allows for users to create their own private components called pluggable components. These are components that are self-hosted (process or container), do not need to be written in Go, exist outside the Dapr runtime, and are able to “plug” into Dapr to utilize the building block APIs.

Where possible, donating built-in components to the Dapr project and community is encouraged.

However, pluggable components are ideal for scenarios where you want to create your own private components that are not included into the Dapr project. For example:

  • Your component may be specific to your company or pose IP concerns, so it cannot be included in the Dapr component repo.
  • You want decouple your component updates from the Dapr release cycle.

For more information read Pluggable components overview

Hot Reloading

Since Dapr v1.18, components are “hot reloaded” at runtime by default. To opt out, disable the HotReload feature in the Dapr application configuration. This means that you can update component configuration without restarting the Dapr runtime. Component reloading occurs when a component resource is created, updated, or deleted, either in the Kubernetes API or in self-hosted mode when a file is changed in the resources directory. When a component is updated, the component is first closed, and then reinitialized using the new configuration. The component is unavailable for a short period of time during reload and reinitialization.

Hot reloading also extends to Configuration, Resiliency, and HTTPEndpoint resources. Changes to these resource types trigger a graceful restart of the Dapr sidecar (via SIGHUP) to apply the new configuration. SIGHUP is not supported on Windows. See Updating resources for more details.

Available component types

The following are the component types provided by Dapr:

Name resolution

Name resolution components are used with the service invocation building block to integrate with the hosting environment and provide service-to-service discovery. For example, the Kubernetes name resolution component integrates with the Kubernetes DNS service, self-hosted uses mDNS and clusters of VMs can use the Consul name resolution component.

Pub/sub brokers

Pub/sub broker components are message brokers that can pass messages to/from services as part of the publish & subscribe building block.

State stores

State store components are data stores (databases, files, memory) that store key-value pairs as part of the state management building block.

Bindings

External resources can connect to Dapr in order to trigger a method on an application or be called from an application as part of the bindings building block.

Secret stores

A secret is any piece of private information that you want to guard against unwanted access. Secrets stores are used to store secrets that can be retrieved and used in applications.

Configuration stores

Configuration stores are used to save application data, which can then be read by application instances on startup or notified of when changes occur. This allows for dynamic configuration.

Locks

Lock components are used as a distributed lock to provide mutually exclusive access to a resource such as a queue or database.

Cryptography

Cryptography components are used to perform cryptographic operations, including encrypting and decrypting messages, without exposing keys to your application.

Conversation

Dapr provides developers a way to abstract interactions with large language models (LLMs) with built-in security and reliability features. Use conversation components to send prompts to different LLMs, along with the conversation context.

Search components are used to index, retrieve, and query documents in full-text search engines.

Vector

Vector components are used to store pre-embedded vectors and run similarity queries against vector databases.

Middleware

Dapr allows custom middleware to be plugged into the HTTP request processing pipeline. Middleware can perform additional actions on an HTTP request (such as authentication, encryption, and message transformation) before the request is routed to the user code, or the response is returned to the client. The middleware components are used with the service invocation building block.