# daeisbae/open-repo-wiki architecture

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

- Interactive diagram: https://gitdiagram.com/daeisbae/open-repo-wiki
- Repository: https://github.com/daeisbae/open-repo-wiki

## Overview

1. **What this repository is**
   - OpenRepoWiki is a monorepo that generates wiki-style documentation for GitHub repositories.
   - The system is split into a static frontend, a serverless API layer, and a long-running processing pipeline that analyzes code and produces summaries.

2. **Top-level architecture**
   - The main runtime boundary is AWS.
   - User traffic enters through CloudFront, which serves the frontend from S3 and forwards API calls to API Gateway.
   - The backend is mostly serverless except for the code-analysis worker, which runs in ECS Fargate.

3. **User-facing frontend**
   - `frontend/` is a React + Vite app.
   - Its main UI pieces are repo submission, progress tracking, tree browsing, breadcrumbs, and page/document viewing.
   - The frontend talks to the API through a small client layer, and requests are signed before being sent to protected endpoints.

4. **API boundary**
   - `services/api/` contains Lambda handlers for the public API.
   - There are separate handlers for repository operations, job operations, and request authorization.
   - API Gateway is the front door, and the Lambda authorizer enforces signed requests on sensitive calls.

5. **Job orchestration path**
   - A repository request becomes a job record and then a workflow execution.
   - `jobs` in the API layer trigger Step Functions, which orchestrate the processing lifecycle.
   - This creates a clear split between synchronous request handling and asynchronous repository analysis.

6. **Processing worker**
   - `services/processor/` is the ECS Fargate container that performs the heavy lifting.
   - It is organized as a staged pipeline: fetch repository tree, fetch file details, filter/collapse the tree, summarize content, then finalize results.
   - This is the subsystem that actually turns raw GitHub source into the wiki structure the UI displays.

7. **LLM integration**
   - The processor has an LLM abstraction under `services/processor/llm/`.
   - Provider implementations include DeepSeek and OpenRouter, with prompts, schemas, and code-splitting logic layered around them.
   - The LLM is used only inside the processing pipeline, not in the frontend or API routing path.

8. **External data sources**
   - GitHub is the primary source of repository content.
   - The `github/` and `shared/github/` modules encapsulate GitHub client behavior and tree filtering/collapsing logic.
   - These modules are reused across the backend so that repository traversal and pruning are consistent.

9. **State and artifact storage**
   - DynamoDB stores durable job/repository state such as progress, metadata, and generated summaries.
   - S3 stores static frontend assets and likely generated artifacts or outputs from the processing pipeline.
   - The `shared/storage/` package and the root `storage/` package both wrap these persistence concerns.

10. **Infrastructure layer**
    - `infra/terraform/` defines the AWS deployment as reusable modules: CloudFront, API Gateway, Lambda, ECS, Step Functions, DynamoDB, S3, IAM, VPC, WAF, ACM, Route53, Secrets Manager, and ECR.
    - WAF and the Lambda authorizer provide the main security boundary for the API.
    - Secrets Manager holds runtime secrets such as API keys and signing material.

11. **Shared domain model**
    - `models/` and `shared/models/` define common entities like repo, branch, job, and tree node.
    - This shared model layer keeps the frontend, API, and processor aligned on the same data shape and vocabulary.

12. **Testing and operational concerns**
    - `tests/` includes end-to-end, LocalStack-based integration, and property/concurrency tests.
    - The presence of LocalStack tests indicates the architecture is designed to be validated against AWS-like services without always hitting real cloud resources.
    - `docs/` and the service READMEs serve as the formal boundary descriptions for the architecture and API behavior.

Main entry points: [`shared/storage/dynamodb.py`](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/storage/dynamodb.py) (Storage Wrappers), [`services/processor/main.py`](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/main.py) (Processor), [`services/api/lambda_handler.py`](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/lambda_handler.py) (Lambda Entry), [`shared/github/client.py`](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/github/client.py) (GitHub Core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
end

subgraph group_api["API Layer"]
  node_authorizer{{"Authorizer<br/>lambda auth<br/>[authorizer.py]"}}
  node_repo_handlers["Repo API<br/>lambda handlers<br/>[repos.py]"]
  node_job_handlers["Job API<br/>lambda handlers<br/>[jobs.py]"]
  node_lambda_entry["Lambda Entry<br/>lambda router<br/>[lambda_handler.py]"]
end

subgraph group_processor["Processor"]
  node_ecs_worker["Processor<br/>fargate task<br/>[main.py]"]
  node_fetch_tree["Fetch Tree<br/>pipeline stage<br/>[fetch_tree.py]"]
  node_fetch_details["Fetch Details<br/>pipeline stage<br/>[fetch_details.py]"]
  node_filter_tree["Filter Tree<br/>pipeline stage<br/>[filter_tree.py]"]
  node_summarize["Summarize<br/>pipeline stage<br/>[summarize.py]"]
  node_finalize["Finalize<br/>pipeline stage<br/>[finalize.py]"]
  node_llm_runtime{{"LLM Layer<br/>llm abstraction<br/>[factory.py]"}}
  node_deepseek(("DeepSeek<br/>llm provider<br/>[deepseek.py]"))
  node_openrouter(("OpenRouter<br/>llm provider<br/>[openrouter.py]"))
end

subgraph group_shared["Shared Core"]
  node_github_shared{{"GitHub Core<br/>github client<br/>[client.py]"}}
  node_models["Domain Models<br/>shared schema<br/>[job.py]"]
  node_storage_shared[("Storage Wrappers<br/>persistence<br/>[dynamodb.py]")]
end

subgraph group_infra["Infrastructure"]
  node_cloudfront(("CloudFront<br/>edge gateway<br/>[main.tf]"))
  node_s3_static[("Static S3<br/>object storage<br/>[main.tf]")]
  node_apigw(("API Gateway<br/>[main.tf]"))
  node_sfn(("Step Functions<br/>workflow<br/>[main.tf]"))
  node_dynamodb[("DynamoDB<br/>state store<br/>[main.tf]")]
  node_secrets[("Secrets<br/>secret store<br/>[main.tf]")]
  node_vpc(("VPC<br/>network<br/>[main.tf]"))
  node_waf(("WAF<br/>security<br/>[main.tf]"))
end

subgraph group_tests["Tests"]
  node_localstack_tests["LocalStack<br/>integration tests"]
end

node_cloudfront -->|"serves UI"| node_s3_static
node_cloudfront -->|"routes API"| node_apigw
node_waf -->|"protects"| node_apigw
node_apigw -->|"invokes"| node_lambda_entry
node_lambda_entry -->|"auth"| node_authorizer
node_lambda_entry -->|"repo ops"| node_repo_handlers
node_lambda_entry -->|"job ops"| node_job_handlers
node_job_handlers -->|"start workflow"| node_sfn
node_sfn -->|"run analysis"| node_ecs_worker
node_ecs_worker -->|"stage"| node_fetch_tree
node_fetch_tree -->|"stage"| node_fetch_details
node_fetch_details -->|"stage"| node_filter_tree
node_filter_tree -->|"stage"| node_summarize
node_summarize -->|"uses"| node_llm_runtime
node_llm_runtime -->|"provider"| node_deepseek
node_llm_runtime -->|"provider"| node_openrouter
node_summarize -->|"stage"| node_finalize
node_github_shared -->|"source"| node_fetch_tree
node_github_shared -->|"source"| node_fetch_details
node_github_shared -->|"collapse"| node_filter_tree
node_models -->|"shapes"| node_repo_handlers
node_models -->|"shapes"| node_ecs_worker
node_storage_shared -->|"writes"| node_dynamodb
node_storage_shared -->|"reads/writes"| node_s3_static
node_repo_handlers -->|"state"| node_storage_shared
node_job_handlers -->|"state"| node_storage_shared
node_ecs_worker -->|"persist"| node_storage_shared
node_secrets -->|"signing"| node_authorizer
node_vpc -->|"network"| node_ecs_worker
node_localstack_tests -->|"validates"| node_sfn
node_localstack_tests -->|"validates"| node_storage_shared

click node_cloudfront "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/cloudfront/main.tf"
click node_s3_static "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/s3/main.tf"
click node_apigw "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/apigw/main.tf"
click node_authorizer "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/authorizer.py"
click node_repo_handlers "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/repos.py"
click node_job_handlers "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/jobs.py"
click node_lambda_entry "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/lambda_handler.py"
click node_sfn "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/sfn/main.tf"
click node_ecs_worker "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/main.py"
click node_fetch_tree "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/fetch_tree.py"
click node_fetch_details "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/fetch_details.py"
click node_filter_tree "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/filter_tree.py"
click node_summarize "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/summarize.py"
click node_finalize "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/finalize.py"
click node_llm_runtime "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/factory.py"
click node_deepseek "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/providers/deepseek.py"
click node_openrouter "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/providers/openrouter.py"
click node_github_shared "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/github/client.py"
click node_models "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/models/job.py"
click node_storage_shared "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/storage/dynamodb.py"
click node_dynamodb "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/dynamodb/main.tf"
click node_secrets "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/secrets/main.tf"
click node_vpc "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/vpc/main.tf"
click node_waf "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/waf/main.tf"
click node_localstack_tests "https://github.com/daeisbae/open-repo-wiki/blob/aws-main/tests/localstack/test_localstack_integration.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_authorizer,node_repo_handlers,node_job_handlers,node_lambda_entry toneAmber
class node_ecs_worker,node_fetch_tree,node_fetch_details,node_filter_tree,node_summarize,node_finalize,node_llm_runtime,node_deepseek,node_openrouter toneMint
class node_github_shared,node_models,node_storage_shared toneRose
class node_cloudfront,node_s3_static,node_apigw,node_sfn,node_dynamodb,node_secrets,node_vpc,node_waf toneIndigo
class node_localstack_tests toneTeal
```

## Components

### API Layer

Serverless request handling and authorization.

- [Authorizer](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/authorizer.py): lambda auth · Verifies signed requests for protected API calls. · `services/api/handlers/authorizer.py`
- [Repo API](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/repos.py): lambda handlers · Handles repository submission and repository-level operations. · `services/api/handlers/repos.py`
- [Job API](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/handlers/jobs.py): lambda handlers · Creates and tracks jobs, and triggers workflow execution. · `services/api/handlers/jobs.py`
- [Lambda Entry](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/api/lambda_handler.py): lambda router · Dispatches incoming API Gateway requests to the right handler. · `services/api/lambda_handler.py`

### Processor

ECS-based analysis pipeline that builds wiki content.

- [Processor](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/main.py): fargate task · Long-running worker that runs the analysis pipeline. · `services/processor/main.py`
- [Fetch Tree](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/fetch_tree.py): pipeline stage · Loads repository structure from GitHub. · `services/processor/stages/fetch_tree.py`
- [Fetch Details](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/fetch_details.py): pipeline stage · Collects file-level content and metadata for analysis. · `services/processor/stages/fetch_details.py`
- [Filter Tree](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/filter_tree.py): pipeline stage · Prunes and collapses the repository tree for readability. · `services/processor/stages/filter_tree.py`
- [Summarize](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/summarize.py): pipeline stage · Uses LLMs to generate wiki-style summaries. · `services/processor/stages/summarize.py`
- [Finalize](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/stages/finalize.py): pipeline stage · Persists generated outputs and completes the job. · `services/processor/stages/finalize.py`
- [LLM Layer](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/factory.py): llm abstraction · Provider-agnostic interface for code splitting and summarization. · `services/processor/llm/factory.py`
- [DeepSeek](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/providers/deepseek.py): llm provider · One supported model backend for summarization. · `services/processor/llm/providers/deepseek.py`
- [OpenRouter](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/services/processor/llm/providers/openrouter.py): llm provider · Alternate model backend for summarization. · `services/processor/llm/providers/openrouter.py`

### Shared Core

Common models, GitHub helpers, and persistence wrappers.

- [GitHub Core](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/github/client.py): github client · Shared client, traversal, filtering, and collapse logic. · `shared/github/client.py`
- [Domain Models](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/models/job.py): shared schema · Common repo, branch, job, and tree node entities. · `shared/models/job.py`
- [Storage Wrappers](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/shared/storage/dynamodb.py): persistence · Shared DynamoDB and S3 access wrappers. · `shared/storage/dynamodb.py`

### Infrastructure

Terraform modules and deployment plumbing.

- [CloudFront](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/cloudfront/main.tf): edge gateway · Front door for users; serves static content and forwards API traffic. · `infra/terraform/modules/cloudfront/main.tf`
- [Static S3](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/s3/main.tf): object storage · Hosts frontend assets and may store generated artifacts. · `infra/terraform/modules/s3/main.tf`
- [API Gateway](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/apigw/main.tf): api gateway · Public HTTP entry point for repository and job operations. · `infra/terraform/modules/apigw/main.tf`
- [Step Functions](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/sfn/main.tf): workflow · Orchestrates asynchronous repository analysis lifecycle. · `infra/terraform/modules/sfn/main.tf`
- [DynamoDB](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/dynamodb/main.tf): state store · Durable job, progress, metadata, and summary state. · `infra/terraform/modules/dynamodb/main.tf`
- [Secrets](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/secrets/main.tf): secret store · Holds API keys and signing material. · `infra/terraform/modules/secrets/main.tf`
- [VPC](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/vpc/main.tf): network · Private networking boundary for backend workloads. · `infra/terraform/modules/vpc/main.tf`
- [WAF](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/infra/terraform/modules/waf/main.tf): security · Protects the public API edge with request filtering. · `infra/terraform/modules/waf/main.tf`

### Tests

End-to-end and AWS-emulation validation.

- [LocalStack](https://github.com/daeisbae/open-repo-wiki/blob/aws-main/tests/localstack/test_localstack_integration.py): integration tests · AWS-emulation tests for infrastructure-backed flows. · `tests/localstack/test_localstack_integration.py`

## Connections

- CloudFront → Static S3: serves UI · CloudFront delivers static frontend assets from S3.
- CloudFront → API Gateway: routes API · API requests are forwarded from the edge to API Gateway.
- WAF → API Gateway: protects · WAF filters inbound traffic before the public API.
- API Gateway → Lambda Entry: invokes · Gateway sends requests into the Lambda entry router.
- Lambda Entry → Authorizer: auth · Protected requests are validated by the Lambda authorizer.
- Lambda Entry → Repo API: repo ops · Repository operations are routed to repo handlers.
- Lambda Entry → Job API: job ops · Job and workflow operations are routed to job handlers.
- Job API → Step Functions: start workflow · A job record can trigger Step Functions orchestration.
- Step Functions → Processor: run analysis · Workflow execution drives the processor task.
- Processor → Fetch Tree: stage · Pipeline begins by loading repository structure.
- Fetch Tree → Fetch Details: stage · Tree discovery feeds file detail collection.
- Fetch Details → Filter Tree: stage · Collected data is reduced into a usable tree.
- Filter Tree → Summarize: stage · Filtered repository structure is summarized.
- Summarize → LLM Layer: uses · Summarization runs through the LLM abstraction.
- LLM Layer → DeepSeek: provider · One backend implementation is DeepSeek.
- LLM Layer → OpenRouter: provider · Another backend implementation is OpenRouter.
- Summarize → Finalize: stage · Generated content is finalized and persisted.
- GitHub Core → Fetch Tree: source · GitHub traversal helpers support tree fetching.
- GitHub Core → Fetch Details: source · GitHub client logic supports detail retrieval.
- GitHub Core → Filter Tree: collapse · Shared filtering/collapsing logic is reused in pruning.
- Domain Models → Repo API: shapes · API handlers use shared repository and job schemas.
- Domain Models → Processor: shapes · Processor stages exchange shared domain objects.
- Storage Wrappers → DynamoDB: writes · Shared wrappers persist durable state in DynamoDB.
- Storage Wrappers → Static S3: reads/writes · Shared wrappers access S3 for assets or artifacts.
- Repo API → Storage Wrappers: state · Repository operations read and write durable state.
- Job API → Storage Wrappers: state · Job operations read and update progress and metadata.
- Processor → Storage Wrappers: persist · Processor stores outputs and status through shared storage.
- Secrets → Authorizer: signing · Signing material is consumed by request authorization.
- VPC → Processor: network · Processor runs inside the backend network boundary.
- LocalStack → Step Functions: validates · Integration tests exercise cloud-like orchestration paths.
- LocalStack → Storage Wrappers: validates · Tests cover persistence behavior against AWS-like services.
