Dapr: The Microservices SDK You Did Not Know You Needed
Dapr (Distributed Application Runtime) provides building blocks for microservices: service invocation, state management, pub/sub, bindings, secrets, and more. Language-agnostic — works with Go, Python, Java, .NET, Node.js.
The Problem Dapr Solves
Building microservices means dealing with: service discovery, retries, pub/sub messaging, state stores, secrets, distributed tracing. Each requires a different SDK, different config, different expertise. Dapr provides one consistent API for all of them.
The Free API
Dapr runs as a sidecar and exposes HTTP/gRPC APIs:
# Service-to-service invocation
curl http://localhost:3500/v1.0/invoke/order-service/method/orders
# State management
curl -X POST http://localhost:3500/v1.0/state/statestore \
-H "Content-Type: application/json" \
-d "[{\"key\": \"order-1\", \"value\": {\"item\": \"laptop\", \"qty\": 1}}]"
# Get state
curl http://localhost:3500/v1.0/state/statestore/order-1
# Publish event
curl -X POST http://localhost:3500/v1.0/publish/pubsub/orders \
-H "Content-Type: application/json" \
-d "{\"orderId\": 123, \"item\": \"laptop\"}"
# Get secret
curl http://localhost:3500/v1.0/secrets/my-secret-store/db-password
# Output binding (send to external system)
curl -X POST http://localhost:3500/v1.0/bindings/email \
-d "{\"operation\": \"create\", \"data\": {\"to\": \"user@example.com\"}}"
Building Blocks
| Block | What It Does | Backends |
|---|---|---|
| Service invocation | Call other services | mTLS, retries built-in |
| State management | Key/value store | Redis, PostgreSQL, CosmosDB |
| Pub/Sub | Event-driven messaging | Kafka, RabbitMQ, Redis |
| Bindings | External system triggers | AWS S3, Azure Blob, Cron |
| Secrets | Secret management | Vault, AWS SM, K8s Secrets |
| Actors | Virtual actor model | Built-in |
Real-World Use Case
A logistics company had 30 microservices, each with different messaging libraries. Migration to Dapr: one HTTP API for all communication. Swapped RabbitMQ for Kafka with zero code changes — just updated the Dapr component YAML.
Quick Start
# Install Dapr CLI
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | bash
dapr init
# Run app with Dapr sidecar
dapr run --app-id myapp --app-port 3000 -- node app.js
Resources
Need automated data for your microservices? Check out my tools on Apify or email spinov001@gmail.com for custom solutions.
Top comments (0)