# harshchhabra2612-glitch/ai_content_transformation architecture

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

- Interactive diagram: https://gitdiagram.com/harshchhabra2612-glitch/ai_content_transformation
- Repository: https://github.com/harshchhabra2612-glitch/ai_content_transformation

## Overview

ERA is a secure, document-grounded AI transformation platform. Users authenticate, upload a document, choose a transformation, generate and review an output, then edit or save it. The backend also documents isolated retrieval, optional visual extraction, media generation, and security controls. The README describes the processing stages; source-index references and excerpts support several implementation links, but unsampled modules are not treated as inspected.

Main entry points: [`backend/backend/main.py`](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/main.py) (FastAPI endpoints), [`src/pages/WorkspacePreview.tsx`](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/pages/WorkspacePreview.tsx) (Workspace preview), [`backend/backend/transformation_engine.py`](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/transformation_engine.py) (Transformation engine), [`src/services/api.ts`](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/api.ts) (Frontend API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_app["Application routes<br/>[App.tsx]"]
  node_workspace["Workspace preview"]
  node_previews["Output previews<br/>[previews.tsx]"]
  node_frontendapi["Frontend API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and workspace"]
  node_appstate["Workspace state<br/>[AppContext.tsx]"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_firebase["Firebase services<br/>[firebase.ts]"]
  node_firestore[("File and output records")]
end

subgraph group_processing["Document processing"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_parser["Document parser<br/>[document_parser.py]"]
  node_ocr["Visual extraction<br/>[ocr_engine.py]"]
  node_vector[("Vector retrieval<br/>[vector_store.py]")]
  node_intelligence["Document intelligence"]
end

subgraph group_generation["AI and media generation"]
  node_transform["Transformation engine"]
  node_prompts["Transformation prompts"]
  node_presentation["Presentation generation"]
  node_media["Image and video generation<br/>[gemini_media.py]"]
  node_gateway["AI gateway<br/>[ai_gateway.py]"]
end

subgraph group_security["Security and governance"]
  node_guardrails["AI safety checks<br/>[ai_guardrails.py]"]
  node_filevalidation["File validation<br/>[file_validator.py]"]
  node_users["Backend user services<br/>[users.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_workspace
node_workspace -->|"requests transformations"| node_frontendapi
node_workspace -->|"renders output"| node_previews
node_workspace -->|"uses workspace state"| node_appstate
node_appstate -->|"calls"| node_frontendapi
node_appstate -->|"saves output"| node_firestore
node_user -->|"signs in"| node_auth
node_auth -->|"authenticates with"| node_firebase
node_auth -->|"syncs profile"| node_frontendapi
node_frontendapi -->|"calls API"| node_backend
node_backend -->|"validates files"| node_filevalidation
node_backend -->|"parses documents"| node_parser
node_parser -.->|"uses when required"| node_ocr
node_backend -->|"indexes and retrieves"| node_vector
node_backend -.->|"delegates document work"| node_intelligence
node_backend -->|"generates transformations"| node_transform
node_transform -->|"checks input and output"| node_guardrails
node_transform -->|"builds prompt"| node_prompts
node_transform -->|"requests generation"| node_gateway
node_backend -->|"routes presentation work"| node_presentation
node_presentation -->|"requests generation"| node_gateway
node_backend -->|"routes media generation"| node_media
node_backend -->|"uses user services"| node_users

click node_app "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/App.tsx"
click node_workspace "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/pages/WorkspacePreview.tsx"
click node_previews "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/components/previews.tsx"
click node_appstate "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/context/AppContext.tsx"
click node_auth "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/context/AuthContext.tsx"
click node_firebase "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/firebase.ts"
click node_firestore "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/firestoreService.ts"
click node_frontendapi "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/api.ts"
click node_backend "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/main.py"
click node_parser "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/document_parser.py"
click node_ocr "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/ocr/ocr_engine.py"
click node_vector "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/vector_store.py"
click node_intelligence "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/agents/document_intelligence.py"
click node_transform "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/transformation_engine.py"
click node_prompts "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/transformation_prompts.py"
click node_presentation "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/presentation_engine.py"
click node_media "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/gemini_media.py"
click node_gateway "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/ai_gateway.py"
click node_guardrails "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/ai_guardrails.py"
click node_filevalidation "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/file_validator.py"
click node_users "https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/users.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_workspace,node_previews,node_frontendapi,node_user toneBlue
class node_appstate,node_auth,node_firebase,node_firestore toneAmber
class node_backend,node_parser,node_ocr,node_vector,node_intelligence toneMint
class node_transform,node_prompts,node_presentation,node_media,node_gateway toneRose
class node_guardrails,node_filevalidation,node_users toneIndigo
```

## Components

### User experience

- [Application routes](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/App.tsx): `src/App.tsx`
- [Workspace preview](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/pages/WorkspacePreview.tsx): `src/pages/WorkspacePreview.tsx`
- [Output previews](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/components/previews.tsx): `src/components/previews.tsx`
- [Frontend API client](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/api.ts): `src/services/api.ts`

### Identity and workspace

- [Workspace state](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Authentication state](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Firebase services](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- [File and output records](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/src/services/firestoreService.ts): `src/services/firestoreService.ts`

### Document processing

- [FastAPI endpoints](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/main.py): `backend/backend/main.py`
- [Document parser](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/document_parser.py): `backend/backend/document_parser.py`
- [Visual extraction](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/ocr/ocr_engine.py): `backend/backend/ocr/ocr_engine.py`
- [Vector retrieval](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/vector_store.py): `backend/backend/vector_store.py`
- [Document intelligence](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/agents/document_intelligence.py): `backend/services/agents/document_intelligence.py`

### AI and media generation

- [Transformation engine](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/transformation_engine.py): `backend/backend/transformation_engine.py`
- [Transformation prompts](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/transformation_prompts.py): `backend/backend/transformation_prompts.py`
- [Presentation generation](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/presentation_engine.py): `backend/backend/presentation_engine.py`
- [Image and video generation](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/gemini_media.py): `backend/services/gemini_media.py`
- [AI gateway](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/services/ai_gateway.py): `backend/services/ai_gateway.py`

### Security and governance

- [AI safety checks](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/ai_guardrails.py): `backend/backend/security/ai_guardrails.py`
- [File validation](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/file_validator.py): `backend/backend/security/file_validator.py`
- [Backend user services](https://github.com/harshchhabra2612-glitch/ai_content_transformation/blob/main/backend/backend/security/users.py): `backend/backend/security/users.py`

### Other components

- **User**

## Connections

- User → Application routes: uses (evidence: `src/App.tsx`)
- Application routes → Workspace preview: routes to (evidence: `src/App.tsx`)
- Workspace preview → Frontend API client: requests transformations (evidence: `src/pages/WorkspacePreview.tsx`)
- Workspace preview → Output previews: renders output (evidence: `src/pages/WorkspacePreview.tsx`)
- Workspace preview → Workspace state: uses workspace state (evidence: `src/pages/WorkspacePreview.tsx`)
- Workspace state → Frontend API client: calls (evidence: `src/context/AppContext.tsx`)
- Workspace state → File and output records: saves output (evidence: `src/context/AppContext.tsx`)
- User → Authentication state: signs in (evidence: `src/context/AuthContext.tsx`)
- Authentication state → Firebase services: authenticates with (evidence: `src/context/AuthContext.tsx`)
- Authentication state → Frontend API client: syncs profile (evidence: `src/context/AuthContext.tsx`)
- Frontend API client → FastAPI endpoints: calls API (evidence: `README.md`)
- FastAPI endpoints → File validation: validates files (evidence: `backend/backend/main.py`)
- FastAPI endpoints → Document parser: parses documents (evidence: `backend/backend/main.py`)
- Document parser → Visual extraction: uses when required (evidence: `README.md`)
- FastAPI endpoints → Vector retrieval: indexes and retrieves (evidence: `backend/backend/main.py`)
- FastAPI endpoints → Document intelligence: delegates document work (evidence: `backend/backend/main.py`)
- FastAPI endpoints → Transformation engine: generates transformations (evidence: `backend/backend/main.py`)
- Transformation engine → AI safety checks: checks input and output (evidence: `backend/backend/transformation_engine.py`)
- Transformation engine → Transformation prompts: builds prompt (evidence: `backend/backend/transformation_engine.py`)
- Transformation engine → AI gateway: requests generation (evidence: `backend/backend/transformation_engine.py`)
- FastAPI endpoints → Presentation generation: routes presentation work (evidence: `backend/backend/main.py`)
- Presentation generation → AI gateway: requests generation (evidence: `backend/backend/presentation_engine.py`)
- FastAPI endpoints → Image and video generation: routes media generation (evidence: `backend/backend/main.py`)
- FastAPI endpoints → Backend user services: uses user services (evidence: `backend/backend/main.py`)
