DEV Community

Alex Spinov
Alex Spinov

Posted on

Dapr Has a Free API — Build Microservices Without Lock-In

Dapr (Distributed Application Runtime) gives your microservices portable building blocks — state, pub/sub, secrets, bindings — via simple HTTP/gRPC APIs.

What Is Dapr?

Dapr provides standardized APIs that abstract away infrastructure. Switch from Redis to DynamoDB, or RabbitMQ to Kafka, without changing code.

Building blocks:

  • Service invocation
  • State management
  • Pub/Sub messaging
  • Bindings (input/output)
  • Secrets management
  • Configuration
  • Distributed lock
  • Workflow

Quick Start

# Install Dapr CLI
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | bash

# Initialize
dapr init

# Run your app with Dapr sidecar
dapr run --app-id myapp --app-port 3000 -- node app.js
Enter fullscreen mode Exit fullscreen mode

HTTP API Examples

# Save state
curl -X POST http://localhost:3500/v1.0/state/statestore \
  -H "Content-Type: application/json" \
  -d '[{"key":"user1","value":{"name":"Alice"}}]'

# Get state
curl http://localhost:3500/v1.0/state/statestore/user1

# Publish event
curl -X POST http://localhost:3500/v1.0/publish/pubsub/orders \
  -H "Content-Type: application/json" \
  -d '{"orderId":"123","amount":99.99}'

# Service-to-service call
curl http://localhost:3500/v1.0/invoke/other-service/method/api/data

# Get secret
curl http://localhost:3500/v1.0/secrets/my-secret-store/db-password
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Microservices — standardized communication
  2. Cloud portability — run anywhere without code changes
  3. Event-driven — pub/sub across services
  4. State management — abstract away databases
  5. Kubernetes — native sidecar injection

Need web data at scale? Check out my scraping tools on Apify or email spinov001@gmail.com for custom solutions.

Top comments (0)