Architecture, Cloud Native, Dapr Series, Platform Engineering

Part 2 – Running Dapr Locally: Setup, Run, and Debug Your First Service

In Part 1, we explored what Dapr is and why it exists. Now it’s time to make it real. Before you can use state management, pub/sub, or any other building block, you need a smooth local development workflow, one that feels natural, fast, and familiar.

Dapr is often associated with Kubernetes and cloud deployments, but most development happens on a laptop. If Dapr doesn’t fit cleanly into your inner loop, it won’t be adopted at all. This post focuses on exactly that: running and debugging Dapr locally, using the same workflow you’d expect for any other service.

What “Running Dapr Locally” Actually Means

Running Dapr locally does not mean:

  • Running Kubernetes
  • Deploying to the cloud
  • Learning a new development model

It means:

  • Running your application as a normal process
  • Running Dapr as a sidecar alongside it
  • Using local infrastructure (or containers) for dependencies

Dapr was designed for fast, iterative development and that’s what we’ll focus on here.

Installing Dapr Locally

Dapr consists of two main parts:

  • The Dapr CLI
  • The Dapr runtime

Once the CLI is installed, initialising Dapr locally is a one‑time step:

dapr init

This sets up:

  • The Dapr runtime
  • A local Redis instance (used by default for state and pub/sub)
  • The placement service (used only for actors)

You don’t need to understand all of these yet. The important part is: Dapr now has everything it needs to run locally.

Note: In local mode, Dapr loads components at startup and does not hot‑reload them. In Kubernetes, components can be updated dynamically.

Your First Local Dapr App

At its simplest, running an app with Dapr looks like this:

.NET example

dapr run \
  --app-id myapp \
  --app-port 8080 \
  --dapr-http-port 3500 \
  -- dotnet run

Or for Go:

Go example

dapr run \
  --app-id myapp \
  --app-port 8080 \
  --dapr-http-port 3500 \
  -- go run main.go

What’s happening here:

  • Your application runs exactly as it normally would
  • Dapr starts a sidecar process alongside it
  • Dapr listens on port 3500
  • Your app listens on its own port (e.g. 8080)

From your application’s point of view, nothing special is happening and that’s the point.

Understanding the Local Architecture

Locally, the architecture looks like this:

Your App (8080)
      ↓
Dapr Sidecar (3500)
      ↓
Local Infrastructure (Redis, etc.)

Your application:

  • Receives HTTP requests as usual
  • Calls Dapr via HTTP or gRPC when it needs state, pub/sub, or bindings

Dapr:

  • Handles communication with infrastructure
  • Manages retries, timeouts, and serialisation
  • Emits logs and metrics independently

This separation is key to understanding how Dapr fits into your workflow.

Adding Components Locally

Dapr integrations are configured using components, which are simple YAML files.

Locally, components are usually placed in a components/ directory:

components/
└── statestore.yaml

When you run Dapr, you point it at this directory:

dapr run \
  --app-id myapp \
  --app-port 8080 \
  --components-path ./components \
  -- dotnet run

This mirrors how Dapr is configured in production, the same components, the same structure, just running locally.

Note: If you don’t specify a components path, Dapr uses the default directory at ~/.dapr/components.

Debugging with Dapr

This is where Dapr fits surprisingly well into normal development workflows.

Debugging the application

Your application runs as a normal process:

  • Attach a debugger
  • Set breakpoints
  • Step through code
  • Inspect variables

Nothing about Dapr changes this.

Debugging Dapr itself

Dapr runs as a separate process, with its own logs.

Useful commands include:

dapr list
dapr logs --app-id myapp

This separation makes it easier to answer an important question:

“Is this a bug in my application, or a configuration/infrastructure issue?”

Common Local Pitfalls

A few things that commonly trip people up:

Port conflicts

Dapr needs its own HTTP and gRPC ports.

Forgetting to restart Dapr

Component changes require restarting the sidecar.

Confusing app logs with Dapr logs

They are separate processes, check both.

Missing components path

If Dapr can’t find your components, integrations won’t work.

Once you understand these, local development becomes predictable and fast

Why This Matters for the Rest of the Series

Everything else in this series builds on this local setup:

  • State management
  • Pub/Sub
  • Bindings and storage
  • End‑to‑end workflows

The same dapr run workflow applies everywhere. Once you’re comfortable running and debugging Dapr locally, the rest of the building blocks feel much less intimidating.

What’s Next

Now that we can run and debug Dapr locally, we can start using it for real work.

In the next post, we’ll look at State Management with Dapr, using Redis and Postgres, all running locally, using the setup described here.

Architecture, Cloud Native, Dapr Series, Platform Engineering

Part 1 – What is Dapr, and Why Would You Use It?

Distributed systems are powerful, but they come with a familiar cost: every service ends up carrying a surprising amount of infrastructure code. Database clients, message broker SDKs, storage SDKs, retry logic, connection handling, secrets, configuration, observability, the list grows quickly.

Most teams don’t notice this at first. It feels normal.
But over time, the weight becomes obvious:

  • Every service looks different
  • Every SDK behaves differently
  • Every language has its own patterns
  • Every infrastructure change requires code changes
  • Local development becomes fragile
  • Testing becomes harder
  • Onboarding slows down

This is the problem space where Dapr lives.

What Dapr Is

Dapr (the Distributed Application Runtime) is a runtime that provides a set of building blocks for common distributed system capabilities:

  • State management
  • Pub/Sub
  • Bindings to external systems
  • Secrets
  • Service invocation
  • Observability

Each building block exposes a consistent API, regardless of the underlying infrastructure.

Your service talks to Dapr.
Dapr talks to Redis, Kafka, S3, Postgres, Service Bus, and more.

Dapr runs as a sidecar next to your service, exposing HTTP and gRPC endpoints your application can call.

This separation keeps your application code clean, portable, and focused on business logic.

What Dapr Is Not

Dapr is not:

  • a database
  • a message broker
  • a workflow engine
  • a service mesh
  • a replacement for Kubernetes
  • a silver bullet

It doesn’t remove the need to understand your infrastructure.
It removes the need to couple your application code to it.

Dapr can run alongside service meshes, orchestrators, and cloud‑native tooling, they solve different problems.

Why Dapr Exists (The Real Problem It Solves)

Most developers think the pain is:

“I have to write boilerplate code for Redis, Kafka, S3…”

But the real pain is deeper:

1. SDK sprawl

Every SDK has its own:

  • retry semantics
  • connection lifecycle
  • error model
  • configuration
  • authentication
  • testing story

Multiply that across languages and teams, and the system becomes inconsistent and hard to evolve.

2. Infrastructure leaking into application code

Connection strings, broker details, storage paths, all embedded in services.

3. Local development drift

Running Redis, Kafka, storage, secrets, and multiple services locally is painful and rarely matches production.

4. Polyglot inconsistency

Go, .NET, Python, Java, each has different libraries, patterns, and failure modes.

5. Infrastructure churn

Switching from Redis to Postgres, or Kafka to Service Bus or RabbitMQ, becomes a multi‑service refactor.

6. Service-to-service communication complexity

Retries, timeouts, discovery, identity, and mTLS all behave differently across languages and frameworks.

Dapr solves these problems by providing consistent, portable building blocks that sit beside your service, not inside it.

Why AI Doesn’t Replace Dapr

AI can generate code. Dapr removes the need to write certain kinds of code.
These are not the same thing.

AI tools (Copilot, ChatGPT, etc.) can help you write code faster, but they do not:

  • provide service discovery
  • implement retries, backoff, or circuit breakers
  • enforce mTLS
  • manage secrets
  • abstract cloud infrastructure
  • provide a consistent API surface across languages
  • run as a sidecar
  • handle distributed tracing
  • guarantee idempotency
  • manage state consistency
  • orchestrate pub/sub delivery
  • provide actor placement
  • run workflows
  • integrate with brokers or databases
  • provide runtime‑level resiliency

AI can describe these patterns.
AI can generate code for these patterns.
AI cannot execute these patterns at runtime.

Dapr is a runtime, not a code generator.

AI ≠ Runtime

AI can help you write:

  • a retry loop
  • a Kafka consumer
  • a Redis client
  • a workflow engine wrapper
  • a secret retrieval helper

But AI cannot:

  • run a sidecar
  • enforce mTLS between services
  • manage distributed locks
  • guarantee delivery semantics
  • provide cross‑language consistency
  • abstract infrastructure behind a stable API
  • hot‑reload components
  • manage actor placement across nodes
  • provide a unified telemetry pipeline

These require execution, not generation.

AI-generated code still needs a runtime

Even if AI writes perfect code:

  • you still need service discovery
  • you still need retries and backoff
  • you still need state consistency
  • you still need pub/sub semantics
  • you still need secrets management
  • you still need observability
  • you still need portability
  • you still need mTLS
  • you still need infrastructure abstraction

Dapr provides these at runtime, consistently, across languages and environments.

AI cannot replace that.

AI + Dapr is actually the ideal pairing

AI helps you write business logic.
Dapr handles the distributed systems plumbing.

Together, they give you:

  • less boilerplate
  • fewer SDKs
  • fewer infrastructure decisions
  • more consistent architecture
  • faster iteration
  • safer defaults

AI accelerates development.
Dapr stabilizes execution.

They solve different problems.

Why Architects Care About Dapr

Architects think in terms of:

  • consistency
  • portability
  • governance
  • cross‑cutting concerns
  • security boundaries
  • observability
  • multi‑language teams
  • future‑proofing

Dapr provides:

  • consistent APIs across languages
  • consistent cross‑cutting behavior
  • consistent local and production environments
  • consistent observability
  • consistent security (mTLS, identity)
  • consistent patterns for state, events, and external systems

It gives architects a way to standardise distributed system capabilities without forcing a specific language, framework, or service mesh.

Why This Series Exists

Dapr’s documentation explains each building block clearly.
What it doesn’t try to do is:

  • show how those pieces fit together in real systems
  • explain how Dapr helps in day‑to‑day engineering
  • address developer and architect objections
  • show how to run Dapr locally in a practical way
  • provide a polyglot example that feels real
  • explain what Dapr solves, and what it doesn’t

This series fills that gap.

It’s designed to answer three questions:

1. What is Dapr?

A runtime that provides consistent building blocks for distributed systems.

2. Why would I use it?

To reduce complexity, improve consistency, and keep infrastructure out of application code.

3. How do I get up and running?

By running Dapr locally, building a real service, and understanding how it fits into your architecture.

What This Series Covers

Over the next posts, we’ll walk through:

  • Running Dapr locally
  • State management
  • Pub/Sub
  • Bindings
  • Observability
  • Building a real service in Go and .NET
  • Deploying to Kubernetes
  • Using Dapr with .NET Aspire (bonus)

Each part includes practical examples you can run yourself.

What You’ll Be Able to Do by the End

By the end of this series, you’ll know how to:

  • Build services that don’t depend on infrastructure SDKs
  • Run a multi‑service system locally with consistent behavior
  • Store state, publish events, and integrate with external systems
  • Observe cross‑service flows with zero instrumentation
  • Deploy the same patterns to Kubernetes
  • Build polyglot services that share the same architecture
  • Understand where Dapr fits, and where it doesn’t