# rudra496/stealthhumanizer architecture

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

- Interactive diagram: https://gitdiagram.com/rudra496/stealthhumanizer
- Repository: https://github.com/rudra496/stealthhumanizer

## Overview

StealthHumanizer is a web app and API for rewriting AI-generated text, checking its AI-likeness, and refining or exporting the result. The main workflow runs from the writing UI through the humanization API, which selects a provider or hosted model, rewrites text, and returns detection and fidelity assessments. Separate branches provide detection, grammar, batch work, file upload, and sentence refinement. The README documents additional provider and style options; the graph focuses on runtime paths supported by the sampled source and tree.

Main entry points: [`app/api/humanize/route.ts`](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize/route.ts) (Humanize endpoint), [`components/Humanizer.tsx`](https://github.com/rudra496/stealthhumanizer/blob/master/components/Humanizer.tsx) (Humanizer UI), [`lib/server/rudra-free.ts`](https://github.com/rudra496/stealthhumanizer/blob/master/lib/server/rudra-free.ts) (Hosted model client), [`app/page.tsx`](https://github.com/rudra496/stealthhumanizer/blob/master/app/page.tsx) (Web app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_web["Web app<br/>[page.tsx]"]
  node_humanizer_ui["Humanizer UI<br/>[Humanizer.tsx]"]
  node_detector_ui["Detector UI<br/>[Detector.tsx]"]
  node_batch_ui["Batch UI<br/>[BatchHumanizer.tsx]"]
  node_voice_ui["Voice profiles"]
end

subgraph group_api["API workflows"]
  node_humanize_api["Humanize endpoint<br/>[route.ts]"]
  node_detect_api["Detect endpoint<br/>[route.ts]"]
  node_batch_api["Batch endpoint<br/>[route.ts]"]
  node_grammar_api["Grammar endpoint<br/>[route.ts]"]
  node_upload_api["Upload endpoint<br/>[route.ts]"]
  node_refine_api["Refine endpoint<br/>[route.ts]"]
  node_job_api["Job shuttle<br/>[route.ts]"]
  node_v1_api["v1 endpoint<br/>[route.ts]"]
end

subgraph group_processing["Text processing"]
  node_rewriter["Rewrite engine<br/>[humanizer.ts]"]
  node_prompts["Style prompts<br/>[prompts.ts]"]
  node_postprocess["Output cleanup<br/>[postprocess.ts]"]
  node_detector["AI scoring<br/>[detector.ts]"]
  node_fidelity["Fidelity checks"]
end

subgraph group_integrations["Models and state"]
  node_providers["Provider runtime"]
  node_rudra["Hosted model client<br/>[rudra-free.ts]"]
  node_history[("Browser history<br/>[storage.ts]")]
  node_voice_storage[("Voice profile storage<br/>[storage.ts]")]
end

node_user(("Writer"))
node_provider_service{{"AI providers"}}
node_rudra_service{{"Rudra model server"}}
node_job_server{{"Job model server"}}

node_user -->|"uses"| node_web
node_web -->|"renders"| node_humanizer_ui
node_web -->|"renders"| node_detector_ui
node_web -->|"renders"| node_batch_ui
node_web -->|"renders"| node_voice_ui
node_humanizer_ui -->|"submits text"| node_humanize_api
node_humanize_api -->|"builds prompts"| node_prompts
node_humanize_api -->|"generates rewrite"| node_providers
node_humanize_api -->|"uses hosted model"| node_rudra
node_providers -->|"calls model"| node_provider_service
node_rudra -->|"calls service"| node_rudra_service
node_humanize_api -->|"cleans output"| node_postprocess
node_humanize_api -->|"scores result"| node_detector
node_humanize_api -->|"checks meaning"| node_fidelity
node_humanize_api -.->|"saves history"| node_history
node_detector_ui -->|"submits text"| node_detect_api
node_detect_api -->|"scores text"| node_detector
node_detect_api -->|"requests hosted score"| node_rudra
node_detect_api -.->|"checks GPTZero"| node_provider_service
node_batch_ui -->|"submits texts"| node_batch_api
node_batch_api -->|"builds prompt"| node_prompts
node_batch_api -->|"rewrites items"| node_providers
node_batch_api -->|"cleans output"| node_postprocess
node_batch_api -->|"scores output"| node_detector
node_humanizer_ui -.->|"checks grammar"| node_grammar_api
node_grammar_api -->|"requests correction"| node_providers
node_grammar_api -->|"uses hosted correction"| node_rudra
node_humanizer_ui -.->|"uploads file"| node_upload_api
node_humanizer_ui -.->|"refines sentences"| node_refine_api
node_refine_api -->|"rewrites sentences"| node_providers
node_refine_api -->|"scores input"| node_detector
node_humanizer_ui -.->|"starts long job"| node_job_api
node_job_api -->|"forwards job"| node_rudra
node_rudra -.->|"shuttles requests"| node_job_server
node_humanizer_ui -.->|"calls API"| node_v1_api
node_voice_ui -->|"saves profiles"| node_voice_storage

click node_web "https://github.com/rudra496/stealthhumanizer/blob/master/app/page.tsx"
click node_humanizer_ui "https://github.com/rudra496/stealthhumanizer/blob/master/components/Humanizer.tsx"
click node_detector_ui "https://github.com/rudra496/stealthhumanizer/blob/master/components/Detector.tsx"
click node_batch_ui "https://github.com/rudra496/stealthhumanizer/blob/master/components/BatchHumanizer.tsx"
click node_voice_ui "https://github.com/rudra496/stealthhumanizer/blob/master/components/VoicePrintSetup.tsx"
click node_humanize_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize/route.ts"
click node_detect_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/detect/route.ts"
click node_batch_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize-batch/route.ts"
click node_grammar_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/grammar/route.ts"
click node_upload_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/upload/route.ts"
click node_refine_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/rehumanize/route.ts"
click node_job_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize-job/route.ts"
click node_v1_api "https://github.com/rudra496/stealthhumanizer/blob/master/app/api/v1/humanize/route.ts"
click node_rewriter "https://github.com/rudra496/stealthhumanizer/blob/master/lib/humanizer.ts"
click node_prompts "https://github.com/rudra496/stealthhumanizer/blob/master/lib/prompts.ts"
click node_postprocess "https://github.com/rudra496/stealthhumanizer/blob/master/lib/postprocess.ts"
click node_detector "https://github.com/rudra496/stealthhumanizer/blob/master/lib/detector.ts"
click node_fidelity "https://github.com/rudra496/stealthhumanizer/blob/master/lib/semantic-fidelity.ts"
click node_providers "https://github.com/rudra496/stealthhumanizer/blob/master/lib/server/providers-runtime.ts"
click node_rudra "https://github.com/rudra496/stealthhumanizer/blob/master/lib/server/rudra-free.ts"
click node_history "https://github.com/rudra496/stealthhumanizer/blob/master/lib/storage.ts"
click node_voice_storage "https://github.com/rudra496/stealthhumanizer/blob/master/lib/voiceprint/storage.ts"

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_web,node_humanizer_ui,node_detector_ui,node_batch_ui,node_voice_ui toneBlue
class node_humanize_api,node_detect_api,node_batch_api,node_grammar_api,node_upload_api,node_refine_api,node_job_api,node_v1_api toneAmber
class node_rewriter,node_prompts,node_postprocess,node_detector,node_fidelity,node_rudra_service,node_job_server toneMint
class node_providers,node_rudra,node_history,node_voice_storage toneRose
class node_user,node_provider_service toneIndigo
```

## Components

### User interfaces

- [Web app](https://github.com/rudra496/stealthhumanizer/blob/master/app/page.tsx): `app/page.tsx`
- [Humanizer UI](https://github.com/rudra496/stealthhumanizer/blob/master/components/Humanizer.tsx): `components/Humanizer.tsx`
- [Detector UI](https://github.com/rudra496/stealthhumanizer/blob/master/components/Detector.tsx): `components/Detector.tsx`
- [Batch UI](https://github.com/rudra496/stealthhumanizer/blob/master/components/BatchHumanizer.tsx): `components/BatchHumanizer.tsx`
- [Voice profiles](https://github.com/rudra496/stealthhumanizer/blob/master/components/VoicePrintSetup.tsx): `components/VoicePrintSetup.tsx`

### API workflows

- [Humanize endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize/route.ts): `app/api/humanize/route.ts`
- [Detect endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/detect/route.ts): `app/api/detect/route.ts`
- [Batch endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize-batch/route.ts): `app/api/humanize-batch/route.ts`
- [Grammar endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/grammar/route.ts): `app/api/grammar/route.ts`
- [Upload endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/upload/route.ts): `app/api/upload/route.ts`
- [Refine endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/rehumanize/route.ts): `app/api/rehumanize/route.ts`
- [Job shuttle](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/humanize-job/route.ts): `app/api/humanize-job/route.ts`
- [v1 endpoint](https://github.com/rudra496/stealthhumanizer/blob/master/app/api/v1/humanize/route.ts): `app/api/v1/humanize/route.ts`

### Text processing

- [Rewrite engine](https://github.com/rudra496/stealthhumanizer/blob/master/lib/humanizer.ts): `lib/humanizer.ts`
- [Style prompts](https://github.com/rudra496/stealthhumanizer/blob/master/lib/prompts.ts): `lib/prompts.ts`
- [Output cleanup](https://github.com/rudra496/stealthhumanizer/blob/master/lib/postprocess.ts): `lib/postprocess.ts`
- [AI scoring](https://github.com/rudra496/stealthhumanizer/blob/master/lib/detector.ts): `lib/detector.ts`
- [Fidelity checks](https://github.com/rudra496/stealthhumanizer/blob/master/lib/semantic-fidelity.ts): `lib/semantic-fidelity.ts`

### Models and state

- [Provider runtime](https://github.com/rudra496/stealthhumanizer/blob/master/lib/server/providers-runtime.ts): `lib/server/providers-runtime.ts`
- [Hosted model client](https://github.com/rudra496/stealthhumanizer/blob/master/lib/server/rudra-free.ts): `lib/server/rudra-free.ts`
- [Browser history](https://github.com/rudra496/stealthhumanizer/blob/master/lib/storage.ts): `lib/storage.ts`
- [Voice profile storage](https://github.com/rudra496/stealthhumanizer/blob/master/lib/voiceprint/storage.ts): `lib/voiceprint/storage.ts`

### Other components

- **Writer**
- **AI providers**
- **Rudra model server**
- **Job model server**

## Connections

- Writer → Web app: uses
- Web app → Humanizer UI: renders
- Web app → Detector UI: renders
- Web app → Batch UI: renders
- Web app → Voice profiles: renders
- Humanizer UI → Humanize endpoint: submits text
- Humanize endpoint → Style prompts: builds prompts
- Humanize endpoint → Provider runtime: generates rewrite
- Humanize endpoint → Hosted model client: uses hosted model
- Provider runtime → AI providers: calls model
- Hosted model client → Rudra model server: calls service
- Humanize endpoint → Output cleanup: cleans output
- Humanize endpoint → AI scoring: scores result
- Humanize endpoint → Fidelity checks: checks meaning
- Humanize endpoint → Browser history: saves history
- Detector UI → Detect endpoint: submits text
- Detect endpoint → AI scoring: scores text
- Detect endpoint → Hosted model client: requests hosted score
- Detect endpoint → AI providers: checks GPTZero
- Batch UI → Batch endpoint: submits texts
- Batch endpoint → Style prompts: builds prompt
- Batch endpoint → Provider runtime: rewrites items
- Batch endpoint → Output cleanup: cleans output
- Batch endpoint → AI scoring: scores output
- Humanizer UI → Grammar endpoint: checks grammar
- Grammar endpoint → Provider runtime: requests correction
- Grammar endpoint → Hosted model client: uses hosted correction
- Humanizer UI → Upload endpoint: uploads file
- Humanizer UI → Refine endpoint: refines sentences
- Refine endpoint → Provider runtime: rewrites sentences
- Refine endpoint → AI scoring: scores input
- Humanizer UI → Job shuttle: starts long job
- Job shuttle → Hosted model client: forwards job
- Hosted model client → Job model server: shuttles requests
- Humanizer UI → v1 endpoint: calls API
- Voice profiles → Voice profile storage: saves profiles
