# prodreams/revu architecture

> Architecture diagram of the GitHub repository prodreams/revu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prodreams/revu
- Repository: https://github.com/prodreams/revu

## Overview

ReVu is a self-hosted webhook service that turns Git pull-request events into AI code reviews, then publishes the result back to the pull request. The main path validates and normalizes provider events, fetches the diff, chooses whole-PR comment or annotated inline review, and sends the review through a configured Git provider. Provider adapters and a shared HTTP gateway support Git hosting and AI integrations. README capabilities include GitHub, Gitea, Bitbucket, OpenAI-compatible services, GigaChat, and YandexGPT. Some adapter dispatch details are unsampled, so those links are shown only where documented or indexed.

Main entry points: [`src/revu/presentation/webhooks/di.py`](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/di.py) (Provider selection), [`src/revu/presentation/webhooks/routes.py`](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/routes.py) (Webhook routes), [`src/revu/application/services/webhook_service.py`](https://github.com/prodreams/revu/blob/main/src/revu/application/services/webhook_service.py) (Review orchestration), [`src/revu/infrastructure/http_client/http_client_gateway.py`](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/http_client/http_client_gateway.py) (HTTP gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_webhook["Webhook intake"]
  node_app["FastAPI app<br/>[app.py]"]
  node_routes["Webhook routes<br/>[routes.py]"]
  node_validation["Webhook validation<br/>[validators.py]"]
  node_schemas["Webhook schemas<br/>[github_schemas.py]"]
  node_mapping["Event mapping<br/>[mappers.py]"]
end

subgraph group_review["Review workflow"]
  node_service["Review orchestration<br/>[webhook_service.py]"]
  node_diff_format["Inline diff annotation<br/>[webhook_service.py]"]
  node_review_data["Review response DTO<br/>[ai_provider_dto.py]"]
  node_ai_contract["AI provider contract"]
  node_git_contract["Git provider contract"]
  node_prompts["Review prompts<br/>[default_prompts.py]"]
end

subgraph group_adapters["Provider adapters"]
  node_di["Provider selection<br/>[di.py]"]
  node_ai_base["AI prompt base<br/>[base.py]"]
  node_ai_openai["OpenAI adapters<br/>[openai_port.py]"]
  node_ai_compatible["Compatible AI"]
  node_ai_giga["GigaChat adapter<br/>[gigachat_port.py]"]
  node_ai_yandex["YandexGPT adapter<br/>[yandexgpt_port.py]"]
  node_git_github["GitHub adapter<br/>[github_port.py]"]
  node_git_gitea["Gitea adapter<br/>[gitea_port.py]"]
  node_git_bitbucket["Bitbucket adapter<br/>[bitbucket_port.py]"]
end

subgraph group_transport["HTTP transport"]
  node_http["HTTP gateway"]
end

node_git_actor(("Git provider"))
node_ai_service(("AI service"))

node_git_actor -->|"sends webhook"| node_routes
node_app -->|"mounts router"| node_routes
node_routes -->|"validates event"| node_validation
node_validation -->|"parses payload"| node_schemas
node_routes -->|"maps event"| node_mapping
node_mapping -->|"reads payload"| node_schemas
node_routes -->|"resolves service"| node_di
node_di -->|"creates service"| node_service
node_routes -->|"schedules processing"| node_service
node_service -->|"fetches diff"| node_git_contract
node_service -->|"requests review"| node_ai_contract
node_service -->|"publishes review"| node_git_contract
node_service -->|"annotates diff"| node_diff_format
node_ai_base -->|"formats prompts"| node_prompts
node_ai_base -->|"selects response model"| node_review_data
node_di -->|"selects provider"| node_ai_openai
node_di -->|"selects provider"| node_ai_compatible
node_di -->|"selects provider"| node_ai_giga
node_di -->|"selects provider"| node_ai_yandex
node_di -->|"selects provider"| node_git_github
node_di -->|"selects provider"| node_git_gitea
node_di -->|"selects provider"| node_git_bitbucket
node_git_github -->|"sends requests"| node_http
node_git_gitea -->|"sends requests"| node_http
node_git_bitbucket -->|"sends requests"| node_http
node_ai_openai -->|"uses gateway"| node_http
node_ai_compatible -->|"uses gateway"| node_http
node_ai_openai -.->|"calls API"| node_ai_service
node_ai_compatible -.->|"calls API"| node_ai_service
node_ai_giga -.->|"calls API"| node_ai_service
node_ai_yandex -.->|"calls API"| node_ai_service
node_git_github -.->|"reads and writes PR"| node_git_actor
node_git_gitea -.->|"reads and writes PR"| node_git_actor
node_git_bitbucket -.->|"reads and writes PR"| node_git_actor

click node_app "https://github.com/prodreams/revu/blob/main/src/revu/application/app.py"
click node_routes "https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/routes.py"
click node_validation "https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/validators.py"
click node_schemas "https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/schemas/github_schemas.py"
click node_mapping "https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/mappers.py"
click node_di "https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/di.py"
click node_service "https://github.com/prodreams/revu/blob/main/src/revu/application/services/webhook_service.py"
click node_diff_format "https://github.com/prodreams/revu/blob/main/src/revu/application/services/webhook_service.py"
click node_review_data "https://github.com/prodreams/revu/blob/main/src/revu/domain/entities/dto/ai_provider_dto.py"
click node_ai_contract "https://github.com/prodreams/revu/blob/main/src/revu/domain/protocols/ai_provider_protocol.py"
click node_git_contract "https://github.com/prodreams/revu/blob/main/src/revu/domain/protocols/git_provider_protocol.py"
click node_prompts "https://github.com/prodreams/revu/blob/main/src/revu/application/entities/default_prompts.py"
click node_ai_base "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/base.py"
click node_ai_openai "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/openai/openai_port.py"
click node_ai_compatible "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/openai_compatible/openai_compatible_port.py"
click node_ai_giga "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/gigachat/gigachat_port.py"
click node_ai_yandex "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/yandexgpt/yandexgpt_port.py"
click node_git_github "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/github/github_port.py"
click node_git_gitea "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/gitea/gitea_port.py"
click node_git_bitbucket "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/bitbucket/bitbucket_port.py"
click node_http "https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/http_client/http_client_gateway.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_app,node_routes,node_validation,node_schemas,node_mapping toneBlue
class node_service,node_diff_format,node_review_data,node_ai_contract,node_git_contract,node_prompts toneAmber
class node_di,node_ai_base,node_ai_openai,node_ai_compatible,node_ai_giga,node_ai_yandex,node_git_github,node_git_gitea,node_git_bitbucket toneMint
class node_http toneRose
class node_git_actor,node_ai_service toneIndigo
```

## Components

### Webhook intake

- [FastAPI app](https://github.com/prodreams/revu/blob/main/src/revu/application/app.py): `src/revu/application/app.py`
- [Webhook routes](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/routes.py): `src/revu/presentation/webhooks/routes.py`
- [Webhook validation](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/validators.py): `src/revu/presentation/webhooks/validators.py`
- [Webhook schemas](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/schemas/github_schemas.py): `src/revu/presentation/webhooks/schemas/github_schemas.py`
- [Event mapping](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/mappers.py): `src/revu/presentation/webhooks/mappers.py`

### Review workflow

- [Review orchestration](https://github.com/prodreams/revu/blob/main/src/revu/application/services/webhook_service.py): `src/revu/application/services/webhook_service.py`
- [Inline diff annotation](https://github.com/prodreams/revu/blob/main/src/revu/application/services/webhook_service.py): `src/revu/application/services/webhook_service.py`
- [Review response DTO](https://github.com/prodreams/revu/blob/main/src/revu/domain/entities/dto/ai_provider_dto.py): `src/revu/domain/entities/dto/ai_provider_dto.py`
- [AI provider contract](https://github.com/prodreams/revu/blob/main/src/revu/domain/protocols/ai_provider_protocol.py): `src/revu/domain/protocols/ai_provider_protocol.py`
- [Git provider contract](https://github.com/prodreams/revu/blob/main/src/revu/domain/protocols/git_provider_protocol.py): `src/revu/domain/protocols/git_provider_protocol.py`
- [Review prompts](https://github.com/prodreams/revu/blob/main/src/revu/application/entities/default_prompts.py): `src/revu/application/entities/default_prompts.py`

### Provider adapters

- [Provider selection](https://github.com/prodreams/revu/blob/main/src/revu/presentation/webhooks/di.py): `src/revu/presentation/webhooks/di.py`
- [AI prompt base](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/base.py): `src/revu/infrastructure/ai_providers/base.py`
- [OpenAI adapters](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/openai/openai_port.py): `src/revu/infrastructure/ai_providers/openai/openai_port.py`
- [Compatible AI](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/openai_compatible/openai_compatible_port.py): `src/revu/infrastructure/ai_providers/openai_compatible/openai_compatible_port.py`
- [GigaChat adapter](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/gigachat/gigachat_port.py): `src/revu/infrastructure/ai_providers/gigachat/gigachat_port.py`
- [YandexGPT adapter](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/ai_providers/yandexgpt/yandexgpt_port.py): `src/revu/infrastructure/ai_providers/yandexgpt/yandexgpt_port.py`
- [GitHub adapter](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/github/github_port.py): `src/revu/infrastructure/git_providers/github/github_port.py`
- [Gitea adapter](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/gitea/gitea_port.py): `src/revu/infrastructure/git_providers/gitea/gitea_port.py`
- [Bitbucket adapter](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/git_providers/bitbucket/bitbucket_port.py): `src/revu/infrastructure/git_providers/bitbucket/bitbucket_port.py`

### HTTP transport

- [HTTP gateway](https://github.com/prodreams/revu/blob/main/src/revu/infrastructure/http_client/http_client_gateway.py): `src/revu/infrastructure/http_client/http_client_gateway.py`

### Other components

- **Git provider**
- **AI service**

## Connections

- Git provider → Webhook routes: sends webhook (evidence: `src/revu/presentation/webhooks/routes.py`)
- FastAPI app → Webhook routes: mounts router (evidence: `src/revu/application/app.py`)
- Webhook routes → Webhook validation: validates event (evidence: `src/revu/presentation/webhooks/routes.py`)
- Webhook validation → Webhook schemas: parses payload (evidence: `src/revu/presentation/webhooks/validators.py`)
- Webhook routes → Event mapping: maps event (evidence: `src/revu/presentation/webhooks/routes.py`)
- Event mapping → Webhook schemas: reads payload (evidence: `src/revu/presentation/webhooks/mappers.py`)
- Webhook routes → Provider selection: resolves service (evidence: `src/revu/presentation/webhooks/routes.py`)
- Provider selection → Review orchestration: creates service (evidence: `src/revu/presentation/webhooks/di.py`)
- Webhook routes → Review orchestration: schedules processing (evidence: `src/revu/presentation/webhooks/routes.py`)
- Review orchestration → Git provider contract: fetches diff (evidence: `src/revu/application/services/webhook_service.py`)
- Review orchestration → AI provider contract: requests review (evidence: `src/revu/application/services/webhook_service.py`)
- Review orchestration → Git provider contract: publishes review (evidence: `src/revu/application/services/webhook_service.py`)
- Review orchestration → Inline diff annotation: annotates diff (evidence: `src/revu/application/services/webhook_service.py`)
- AI prompt base → Review prompts: formats prompts (evidence: `src/revu/infrastructure/ai_providers/base.py`)
- AI prompt base → Review response DTO: selects response model (evidence: `src/revu/infrastructure/ai_providers/base.py`)
- Provider selection → OpenAI adapters: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → Compatible AI: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → GigaChat adapter: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → YandexGPT adapter: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → GitHub adapter: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → Gitea adapter: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- Provider selection → Bitbucket adapter: selects provider (evidence: `src/revu/presentation/webhooks/di.py`)
- GitHub adapter → HTTP gateway: sends requests (evidence: `src/revu/infrastructure/git_providers/github/github_port.py`)
- Gitea adapter → HTTP gateway: sends requests (evidence: `src/revu/infrastructure/git_providers/gitea/gitea_port.py`)
- Bitbucket adapter → HTTP gateway: sends requests (evidence: `src/revu/infrastructure/git_providers/bitbucket/bitbucket_port.py`)
- OpenAI adapters → HTTP gateway: uses gateway
- Compatible AI → HTTP gateway: uses gateway
- OpenAI adapters → AI service: calls API
- Compatible AI → AI service: calls API
- GigaChat adapter → AI service: calls API
- YandexGPT adapter → AI service: calls API
- GitHub adapter → Git provider: reads and writes PR
- Gitea adapter → Git provider: reads and writes PR
- Bitbucket adapter → Git provider: reads and writes PR
