# abzuar9658/miller-shackman-api architecture

> Architecture diagram of the GitHub repository abzuar9658/miller-shackman-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abzuar9658/miller-shackman-api
- Repository: https://github.com/abzuar9658/miller-shackman-api

## Overview

Miller Schackman API is a FastAPI backend for AI-assisted real-estate lead nurturing. The main workflow receives lead activity, supports campaign enrollment and nurture orchestration, and provides administrative review and reporting; messaging, CRM sync, and listing enrichment are additional capabilities. The graph distinguishes API, application/domain, persistence, and provider/workflow layers. Edges are limited to relationships visible in excerpts, the source index, or README; unsampled internals are represented without asserted call paths.

Main entry points: [`app/application/use_cases/start_paused_search_campaign_enrollment.py`](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/use_cases/start_paused_search_campaign_enrollment.py) (Paused-search enrollment), [`app/interfaces/workers/crm_sync_worker.py`](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/crm_sync_worker.py) (CRM sync worker), [`app/core/database.py`](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/core/database.py) (PostgreSQL session), [`app/interfaces/workers/outbound_send_dispatch_worker.py`](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/outbound_send_dispatch_worker.py) (Send dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Workers"]
  node_api["HTTP API<br/>[router.py]"]
  node_webhooks["Inbound webhooks<br/>[webhooks.py]"]
  node_crm_worker["CRM sync worker<br/>[crm_sync_worker.py]"]
  node_send_worker["Send dispatcher"]
end

subgraph group_business["Application and Domain"]
  node_enrollment["Paused-search enrollment"]
  node_lead_domain["Lead models<br/>[__init__.py]"]
  node_paused_tracks["Paused-search tracks"]
  node_contactability["Contactability policy<br/>[contactability.py]"]
  node_outbound_drafting["Outbound drafting"]
  node_crm_sync_domain["CRM sync rules<br/>[crm_sync.py]"]
  node_repo_ports["Repository ports<br/>[repositories.py]"]
  node_temporal_ports["Temporal port<br/>[temporal.py]"]
end

subgraph group_storage["Persistence"]
  node_database[("PostgreSQL session<br/>[database.py]")]
  node_enrollment_repo[("Enrollment repository")]
  node_lead_repo[("Lead repository<br/>[lead_repository.py]")]
  node_workflow_repo[("Workflow repository")]
end

subgraph group_integrations["Provider Integrations"]
  node_fub["Follow Up Boss<br/>[client.py]"]
  node_streeteasy["StreetEasy search<br/>[client.py]"]
end

subgraph group_orchestration["Workflow and Events"]
  node_temporal["Temporal workflows<br/>[lead_nurture.py]"]
  node_rabbitmq["RabbitMQ events<br/>[publisher.py]"]
end

node_admin(("Admin user"))

node_admin -.->|"uses"| node_api
node_api -->|"routes to"| node_webhooks
node_crm_worker -->|"uses rules"| node_crm_sync_domain
node_crm_worker -->|"uses repository"| node_enrollment_repo
node_enrollment -->|"uses ports"| node_repo_ports
node_enrollment -->|"uses track rules"| node_paused_tracks
node_enrollment -->|"starts workflow"| node_temporal_ports
node_enrollment_repo -->|"maps enrollment"| node_enrollment
node_lead_domain -->|"exports policy"| node_contactability
node_streeteasy -->|"uses lead models"| node_lead_domain
node_send_worker -.->|"revalidates sends"| node_contactability
node_send_worker -.->|"dispatches drafts"| node_outbound_drafting
node_temporal -.->|"implements workflow"| node_temporal_ports
node_crm_worker -->|"consumes events"| node_rabbitmq
node_webhooks -.->|"receives CRM events"| node_fub
node_database -.->|"backs repositories"| node_repo_ports
node_lead_repo -.->|"persists leads"| node_database
node_workflow_repo -.->|"persists workflows"| node_database

click node_api "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/api/router.py"
click node_webhooks "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/api/v1/webhooks.py"
click node_crm_worker "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/crm_sync_worker.py"
click node_send_worker "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/outbound_send_dispatch_worker.py"
click node_enrollment "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/use_cases/start_paused_search_campaign_enrollment.py"
click node_lead_domain "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/leads/__init__.py"
click node_paused_tracks "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/campaigns/paused_search_tracks.py"
click node_contactability "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/compliance/contactability.py"
click node_outbound_drafting "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/outbound_drafting.py"
click node_crm_sync_domain "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/crm_sync.py"
click node_repo_ports "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/ports/repositories.py"
click node_temporal_ports "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/ports/temporal.py"
click node_database "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/core/database.py"
click node_enrollment_repo "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/campaign_enrollment_repository.py"
click node_lead_repo "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/lead_repository.py"
click node_workflow_repo "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/workflow_repository.py"
click node_fub "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/crm/follow_up_boss/client.py"
click node_streeteasy "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/listing_sources/streeteasy/client.py"
click node_temporal "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/workflows/temporal/lead_nurture.py"
click node_rabbitmq "https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/events/rabbitmq/publisher.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_webhooks,node_crm_worker,node_send_worker,node_admin toneBlue
class node_enrollment,node_lead_domain,node_paused_tracks,node_contactability,node_outbound_drafting,node_crm_sync_domain,node_repo_ports,node_temporal_ports toneAmber
class node_database,node_enrollment_repo,node_lead_repo,node_workflow_repo toneMint
class node_fub,node_streeteasy toneRose
class node_temporal,node_rabbitmq toneIndigo
```

## Components

### API and Workers

- [HTTP API](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/api/router.py): `app/interfaces/api/router.py`
- [Inbound webhooks](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/api/v1/webhooks.py): `app/interfaces/api/v1/webhooks.py`
- [CRM sync worker](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/crm_sync_worker.py): `app/interfaces/workers/crm_sync_worker.py`
- [Send dispatcher](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/interfaces/workers/outbound_send_dispatch_worker.py): `app/interfaces/workers/outbound_send_dispatch_worker.py`

### Application and Domain

- [Paused-search enrollment](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/use_cases/start_paused_search_campaign_enrollment.py): `app/application/use_cases/start_paused_search_campaign_enrollment.py`
- [Lead models](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/leads/__init__.py): `app/domain/leads/__init__.py`
- [Paused-search tracks](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/campaigns/paused_search_tracks.py): `app/domain/campaigns/paused_search_tracks.py`
- [Contactability policy](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/compliance/contactability.py): `app/domain/compliance/contactability.py`
- [Outbound drafting](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/outbound_drafting.py): `app/domain/outbound_drafting.py`
- [CRM sync rules](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/domain/crm_sync.py): `app/domain/crm_sync.py`
- [Repository ports](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/ports/repositories.py): `app/application/ports/repositories.py`
- [Temporal port](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/application/ports/temporal.py): `app/application/ports/temporal.py`

### Persistence

- [PostgreSQL session](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/core/database.py): `app/core/database.py`
- [Enrollment repository](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/campaign_enrollment_repository.py): `app/infrastructure/persistence/postgres/campaign_enrollment_repository.py`
- [Lead repository](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/lead_repository.py): `app/infrastructure/persistence/postgres/lead_repository.py`
- [Workflow repository](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/persistence/postgres/workflow_repository.py): `app/infrastructure/persistence/postgres/workflow_repository.py`

### Provider Integrations

- [Follow Up Boss](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/crm/follow_up_boss/client.py): `app/infrastructure/crm/follow_up_boss/client.py`
- [StreetEasy search](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/listing_sources/streeteasy/client.py): `app/infrastructure/listing_sources/streeteasy/client.py`

### Workflow and Events

- [Temporal workflows](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/workflows/temporal/lead_nurture.py): `app/infrastructure/workflows/temporal/lead_nurture.py`
- [RabbitMQ events](https://github.com/abzuar9658/miller-shackman-api/blob/main/app/infrastructure/events/rabbitmq/publisher.py): `app/infrastructure/events/rabbitmq/publisher.py`

### Other components

- **Admin user**

## Connections

- Admin user → HTTP API: uses
- HTTP API → Inbound webhooks: routes to (evidence: `app/interfaces/api/router.py`)
- CRM sync worker → CRM sync rules: uses rules (evidence: `app/interfaces/workers/crm_sync_worker.py`)
- CRM sync worker → Enrollment repository: uses repository (evidence: `app/interfaces/workers/crm_sync_worker.py`)
- Paused-search enrollment → Repository ports: uses ports (evidence: `app/application/use_cases/start_paused_search_campaign_enrollment.py`)
- Paused-search enrollment → Paused-search tracks: uses track rules (evidence: `app/application/use_cases/start_paused_search_campaign_enrollment.py`)
- Paused-search enrollment → Temporal port: starts workflow (evidence: `app/application/use_cases/start_paused_search_campaign_enrollment.py`)
- Enrollment repository → Paused-search enrollment: maps enrollment (evidence: `app/infrastructure/persistence/postgres/campaign_enrollment_repository.py`)
- Lead models → Contactability policy: exports policy (evidence: `app/domain/leads/__init__.py`)
- StreetEasy search → Lead models: uses lead models (evidence: `app/infrastructure/listing_sources/streeteasy/client.py`)
- Send dispatcher → Contactability policy: revalidates sends
- Send dispatcher → Outbound drafting: dispatches drafts
- Temporal workflows → Temporal port: implements workflow
- CRM sync worker → RabbitMQ events: consumes events (evidence: `app/interfaces/workers/crm_sync_worker.py`)
- Inbound webhooks → Follow Up Boss: receives CRM events
- PostgreSQL session → Repository ports: backs repositories
- Lead repository → PostgreSQL session: persists leads
- Workflow repository → PostgreSQL session: persists workflows
