# wqx1999/pepforge architecture

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

- Interactive diagram: https://gitdiagram.com/wqx1999/pepforge
- Repository: https://github.com/wqx1999/pepforge

## Overview

PepForge is a HELM-native peptide-generation platform with a web GUI and CLI. Its principal workflow accepts a generation request, runs layout, content, and connection generation, then validates and optionally scores candidates before returning results. The repository also documents constrained generation, AMP and ADMET prediction, and custom predictor plugins. The graph combines README-described capabilities with relationships visible in the supplied source excerpts and SOURCE INDEX; unsampled route and integration details are not inferred.

Main entry points: [`Scripts/Inference/pipeline.py`](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/pipeline.py) (Inference pipeline), [`App/backend/routes`](https://github.com/wqx1999/pepforge/tree/main/App/backend/routes) (API routes), [`Scripts/Generation_Model/Utils/generation_pipeline_runner.py`](https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Utils/generation_pipeline_runner.py) (Generation pipeline runner), [`App/frontend/src/App.tsx`](https://github.com/wqx1999/pepforge/blob/main/App/frontend/src/App.tsx) (GUI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_frontend["GUI application<br/>[App.tsx]"]
  node_gui_hooks["Generation and prediction hooks"]
  node_api_client["API client<br/>[client.ts]"]
end

subgraph group_api["Application API"]
  node_app_server["FastAPI application<br/>[main.py]"]
  node_routes["API routes"]
  node_task_manager["Background task manager<br/>[task_manager.py]"]
  node_generation_service["Generation service"]
  node_batch_service["Batch prediction service"]
  node_monomer_service["Monomer library service<br/>[monomer_service.py]"]
end

subgraph group_inference["Inference orchestration"]
  node_cli["Inference CLI<br/>[Inference.py]"]
  node_pipeline["Inference pipeline<br/>[pipeline.py]"]
  node_model_loader["Model loader<br/>[model_loader.py]"]
  node_postprocess["Candidate postprocessing<br/>[postprocess.py]"]
  node_output["Results output<br/>[output.py]"]
end

subgraph group_generation["Hierarchical generation"]
  node_layout["Layout generation<br/>[infer_layout.py]"]
  node_content["Content generation<br/>[infer_content.py]"]
  node_connections["Connection generation"]
  node_generation_runner["Generation pipeline runner"]
end

subgraph group_prediction["Prediction"]
  node_amp["AMP ensemble<br/>[ensemble.py]"]
  node_peptiverse["PeptiVerse ADMET<br/>[predictor.py]"]
  node_external_predictor["External predictor plugin<br/>[adapter.py]"]
end

node_user(("User"))

node_user -->|"submits request"| node_frontend
node_frontend -->|"uses hooks"| node_gui_hooks
node_gui_hooks -->|"calls API"| node_api_client
node_api_client -->|"sends requests"| node_app_server
node_app_server -->|"registers routes"| node_routes
node_routes -.->|"dispatches generation"| node_generation_service
node_routes -.->|"dispatches batches"| node_batch_service
node_routes -.->|"serves library"| node_monomer_service
node_generation_service -->|"runs pipeline"| node_pipeline
node_batch_service -->|"uses inference"| node_pipeline
node_cli -->|"runs inference"| node_pipeline
node_pipeline -->|"loads models"| node_model_loader
node_pipeline -->|"generates layout"| node_layout
node_pipeline -->|"generates content"| node_content
node_pipeline -->|"predicts connections"| node_connections
node_pipeline -->|"postprocesses candidates"| node_postprocess
node_pipeline -.->|"scores AMP"| node_amp
node_pipeline -.->|"scores ADMET"| node_peptiverse
node_pipeline -.->|"supports plugins"| node_external_predictor
node_pipeline -->|"writes results"| node_output
node_generation_runner -->|"invokes stage"| node_layout
node_generation_runner -->|"invokes stage"| node_content
node_generation_runner -->|"invokes stage"| node_connections

click node_frontend "https://github.com/wqx1999/pepforge/blob/main/App/frontend/src/App.tsx"
click node_gui_hooks "https://github.com/wqx1999/pepforge/tree/main/App/frontend/src/hooks"
click node_api_client "https://github.com/wqx1999/pepforge/blob/main/App/frontend/src/api/client.ts"
click node_app_server "https://github.com/wqx1999/pepforge/blob/main/App/main.py"
click node_routes "https://github.com/wqx1999/pepforge/tree/main/App/backend/routes"
click node_task_manager "https://github.com/wqx1999/pepforge/blob/main/App/backend/tasks/task_manager.py"
click node_generation_service "https://github.com/wqx1999/pepforge/blob/main/App/backend/services/generation_service.py"
click node_batch_service "https://github.com/wqx1999/pepforge/blob/main/App/backend/services/batch_predict_service.py"
click node_monomer_service "https://github.com/wqx1999/pepforge/blob/main/App/backend/services/monomer_service.py"
click node_cli "https://github.com/wqx1999/pepforge/blob/main/Pipelines/Inference.py"
click node_pipeline "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/pipeline.py"
click node_model_loader "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/model_loader.py"
click node_postprocess "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/postprocess.py"
click node_output "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/output.py"
click node_layout "https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_layout.py"
click node_content "https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_content.py"
click node_connections "https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_connections.py"
click node_generation_runner "https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Utils/generation_pipeline_runner.py"
click node_amp "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/ensemble.py"
click node_peptiverse "https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/PeptiVerse/predictor.py"
click node_external_predictor "https://github.com/wqx1999/pepforge/blob/main/Configs/Inference/External_predictor_template/adapter.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_frontend,node_gui_hooks,node_api_client,node_user toneBlue
class node_app_server,node_routes,node_task_manager,node_generation_service,node_batch_service,node_monomer_service toneAmber
class node_cli,node_pipeline,node_model_loader,node_postprocess,node_output toneMint
class node_layout,node_content,node_connections,node_generation_runner toneRose
class node_amp,node_peptiverse,node_external_predictor toneIndigo
```

## Components

### Web interface

- [GUI application](https://github.com/wqx1999/pepforge/blob/main/App/frontend/src/App.tsx): `App/frontend/src/App.tsx`
- [Generation and prediction hooks](https://github.com/wqx1999/pepforge/tree/main/App/frontend/src/hooks): `App/frontend/src/hooks`
- [API client](https://github.com/wqx1999/pepforge/blob/main/App/frontend/src/api/client.ts): `App/frontend/src/api/client.ts`

### Application API

- [FastAPI application](https://github.com/wqx1999/pepforge/blob/main/App/main.py): `App/main.py`
- [API routes](https://github.com/wqx1999/pepforge/tree/main/App/backend/routes): `App/backend/routes`
- [Background task manager](https://github.com/wqx1999/pepforge/blob/main/App/backend/tasks/task_manager.py): `App/backend/tasks/task_manager.py`
- [Generation service](https://github.com/wqx1999/pepforge/blob/main/App/backend/services/generation_service.py): `App/backend/services/generation_service.py`
- [Batch prediction service](https://github.com/wqx1999/pepforge/blob/main/App/backend/services/batch_predict_service.py): `App/backend/services/batch_predict_service.py`
- [Monomer library service](https://github.com/wqx1999/pepforge/blob/main/App/backend/services/monomer_service.py): `App/backend/services/monomer_service.py`

### Inference orchestration

- [Inference CLI](https://github.com/wqx1999/pepforge/blob/main/Pipelines/Inference.py): `Pipelines/Inference.py`
- [Inference pipeline](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/pipeline.py): `Scripts/Inference/pipeline.py`
- [Model loader](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/model_loader.py): `Scripts/Inference/model_loader.py`
- [Candidate postprocessing](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/postprocess.py): `Scripts/Inference/postprocess.py`
- [Results output](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/output.py): `Scripts/Inference/output.py`

### Hierarchical generation

- [Layout generation](https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_layout.py): `Scripts/Generation_Model/Inference/infer_layout.py`
- [Content generation](https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_content.py): `Scripts/Generation_Model/Inference/infer_content.py`
- [Connection generation](https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Inference/infer_connections.py): `Scripts/Generation_Model/Inference/infer_connections.py`
- [Generation pipeline runner](https://github.com/wqx1999/pepforge/blob/main/Scripts/Generation_Model/Utils/generation_pipeline_runner.py): `Scripts/Generation_Model/Utils/generation_pipeline_runner.py`

### Prediction

- [AMP ensemble](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/ensemble.py): `Scripts/Inference/ensemble.py`
- [PeptiVerse ADMET](https://github.com/wqx1999/pepforge/blob/main/Scripts/Inference/PeptiVerse/predictor.py): `Scripts/Inference/PeptiVerse/predictor.py`
- [External predictor plugin](https://github.com/wqx1999/pepforge/blob/main/Configs/Inference/External_predictor_template/adapter.py): `Configs/Inference/External_predictor_template/adapter.py`

### Other components

- **User**

## Connections

- User → GUI application: submits request
- GUI application → Generation and prediction hooks: uses hooks (evidence: `App/frontend/src/App.tsx`)
- Generation and prediction hooks → API client: calls API (evidence: `App/frontend/src/hooks/useGeneration.ts`)
- API client → FastAPI application: sends requests (evidence: `App/frontend/src/api/client.ts`)
- FastAPI application → API routes: registers routes (evidence: `App/main.py`)
- API routes → Generation service: dispatches generation
- API routes → Batch prediction service: dispatches batches
- API routes → Monomer library service: serves library
- Generation service → Inference pipeline: runs pipeline (evidence: `App/backend/services/generation_service.py`)
- Batch prediction service → Inference pipeline: uses inference (evidence: `App/backend/services/batch_predict_service.py`)
- Inference CLI → Inference pipeline: runs inference (evidence: `Pipelines/Inference.py`)
- Inference pipeline → Model loader: loads models (evidence: `Scripts/Inference/pipeline.py`)
- Inference pipeline → Layout generation: generates layout (evidence: `Scripts/Inference/pipeline.py`)
- Inference pipeline → Content generation: generates content (evidence: `Scripts/Inference/pipeline.py`)
- Inference pipeline → Connection generation: predicts connections (evidence: `Scripts/Inference/pipeline.py`)
- Inference pipeline → Candidate postprocessing: postprocesses candidates (evidence: `Scripts/Inference/postprocess.py`)
- Inference pipeline → AMP ensemble: scores AMP
- Inference pipeline → PeptiVerse ADMET: scores ADMET
- Inference pipeline → External predictor plugin: supports plugins
- Inference pipeline → Results output: writes results (evidence: `Scripts/Inference/pipeline.py`)
- Generation pipeline runner → Layout generation: invokes stage (evidence: `Scripts/Generation_Model/Utils/generation_pipeline_runner.py`)
- Generation pipeline runner → Content generation: invokes stage (evidence: `Scripts/Generation_Model/Utils/generation_pipeline_runner.py`)
- Generation pipeline runner → Connection generation: invokes stage (evidence: `Scripts/Generation_Model/Utils/generation_pipeline_runner.py`)
