# spicycoder/dapr-deploy architecture

> Architecture diagram of the GitHub repository spicycoder/dapr-deploy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spicycoder/dapr-deploy
- Repository: https://github.com/spicycoder/dapr-deploy

## Overview

Project Type: This is a distributed application using the DAPR (Distributed Application Runtime) framework, implementing a Publisher-Subscriber pattern with state management capabilities.

Key Components to Include:

##### Main Services
- Publisher Service (ASP.NET Core API)
- Subscriber Service (ASP.NET Core API)
- Shared Domain Model (containing Hero.cs)

##### DAPR Building Blocks
- State Store Component (Redis)
- Pub/Sub Component (Redis Streams or RabbitMQ)

##### Infrastructure
- Kubernetes Cluster
- Redis Instance (via Helm)
- Docker Container Runtime

##### Component Relationships
- Publisher → DAPR sidecar → Pub/Sub component → DAPR sidecar → Subscriber
- Publisher → DAPR sidecar → State Store component
- API endpoints (/publish, /subscribe, /states)

##### Technical Details
- Port mappings (8181 for Publisher)
- Component names ("pubsub", "statestore")
- API routes and controllers
- Docker image references

##### Additional Elements
- Configuration files (components/pubsub.yaml, components/statestore.yaml)
- Development tools (Swagger UI at port 8080)

Specific Implementation Guidelines:

##### Services Layer
- [Publisher API (8181)] ←→ [DAPR Sidecar]
- ↓
- [Subscriber API] ←→ [DAPR Sidecar]

##### DAPR Building Blocks
- [State Store Component] [Pub/Sub Component]
- ↓                     ↓
- [Redis/RabbitMQ Instance]

##### Infrastructure Layer
- [Kubernetes Cluster]
- [Redis Helm Chart]
- [DAPR Components]
- [Service Deployments]

Key Considerations:
- Separation between development and production environments
- Flexibility of switching between Redis and RabbitMQ for pub/sub
- Shared Domain model usage
- Deployment artifacts and their relationships

Remember to:
- Use consistent symbols and notation
- Version information where relevant
- Both synchronous and asynchronous communication patterns
- Scalability points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Kubernetes["Kubernetes Cluster"]
        subgraph Publisher["Publisher Service"]
            PC["PublishController"]
            SC["StatesController"]
            PD["Publisher Deployment"]
        end

        subgraph Subscriber["Subscriber Service"]
            SubC["SubscribeController"]
            SD["Subscriber Deployment"]
        end

        subgraph DaprComponents["DAPR Components"]
            PS["Pub/Sub (Redis/RabbitMQ)"]
            SS["State Store (Redis)"]
        end

        subgraph SharedDomain["Shared Domain"]
            HM["Hero Model"]
        end

        subgraph DaprSidecars["DAPR Sidecars"]
            PubSidecar["Publisher Sidecar"]
            SubSidecar["Subscriber Sidecar"]
        end
    end

    PC --> PubSidecar
    SC --> PubSidecar
    PubSidecar --> PS
    PubSidecar --> SS
    PS --> SubSidecar
    SubSidecar --> SubC
    Publisher --> SharedDomain
    Subscriber --> SharedDomain

    classDef service fill:#2374f7,stroke:#333,stroke-width:2px
    classDef controller fill:#185abc,stroke:#333,stroke-width:2px
    classDef dapr fill:#47d147,stroke:#333,stroke-width:2px
    classDef infrastructure fill:#ffd700,stroke:#333,stroke-width:2px
    classDef domain fill:#ff8c00,stroke:#333,stroke-width:2px

    class Publisher,Subscriber service
    class PC,SC,SubC controller
    class PubSidecar,SubSidecar,DaprComponents,PS,SS dapr
    class Kubernetes infrastructure
    class SharedDomain,HM domain

    click Publisher "https://github.com/spicycoder/dapr-deploy/tree/main/Publisher"
    click Subscriber "https://github.com/spicycoder/dapr-deploy/tree/main/Subscriber"
    click SharedDomain "https://github.com/spicycoder/dapr-deploy/tree/main/Domain"
    click PC "https://github.com/spicycoder/dapr-deploy/blob/main/Publisher/Controllers/PublishController.cs"
    click SC "https://github.com/spicycoder/dapr-deploy/blob/main/Publisher/Controllers/StatesController.cs"
    click SubC "https://github.com/spicycoder/dapr-deploy/blob/main/Subscriber/Controllers/SubscribeController.cs"
    click PS "https://github.com/spicycoder/dapr-deploy/blob/main/components/pubsub.yaml"
    click SS "https://github.com/spicycoder/dapr-deploy/blob/main/components/statestore.yaml"
    click PD "https://github.com/spicycoder/dapr-deploy/blob/main/deployment/publisher-deployment.yaml"
    click SD "https://github.com/spicycoder/dapr-deploy/blob/main/deployment/subscriber-deployment.yaml"
    click HM "https://github.com/spicycoder/dapr-deploy/blob/main/Domain/Model/Hero.cs"
```
