# wrtnlabs/autoview architecture

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

- Interactive diagram: https://gitdiagram.com/wrtnlabs/autoview
- Repository: https://github.com/wrtnlabs/autoview

## Overview

##### Project type and purpose
- This is a PNPM-powered monorepo hosting an **open-source developer tool** plus companion libraries and website.
- Core purpose: “Autoview” automatically generates React viewer components from TypeScript or OpenAPI schemas using an LLM + typia validation + a code‐generation pipeline.

##### File structure
- Top-level “deploy”, “build”, CI workflows (.github), and a “packages” folder.
- “packages” contains:
- **agent**: orchestrates schema ingestion, LLM calls, and codegen
- **compiler** & **compiler-bundle/browser-test**: internal code-generation engine, bundlers, and test harnesses
- **interface**: TypeScript interfaces & metadata services for schema descriptions
- **ui**: runtime React/Tailwind/shadcn/ui library plus a component renderer
- “research” and “test” folders contain data‐driven experiments and automated test suites.
- “website” is a Next.js app for docs and demos.

##### Key insights from README
- **LLM Function Calling** + **typia** schema analysis
- Generates **TypeScript/TSX** code for React viewer components
- Depends on **OpenAI** (or other LLM vendors) for code composition
- Output is consumed by **@autoview/ui**’s `renderComponent`

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Layer
    Developer["Developer"]:::dev
    CLI["CLI / Scripts"]:::dev
    click CLI "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/scripts/new-agent.ts"
    Developer -->|invokes| CLI

    %% AutoView Agent
    subgraph "AutoView Agent"
      direction TB
      AVAgent["AgentCore"]:::dev
      click AVAgent "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/agents/AutoViewAgent.ts"
      AgentBase["AgentBase"]:::dev
      click AgentBase "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/core/AgentBase.ts"
      LLMProxy["LLM Adapter"]:::dev
      click LLMProxy "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/core/LlmProxy.ts"
      SchemaAdapter["Schema Ingestion"]:::int
      click SchemaAdapter "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/agents/convert-schema.ts"
      CodegenPass["Codegen Pass"]:::dev
      click CodegenPass "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/passes/codegen/Agent.ts"
      RandomPass["Randomgen Pass"]:::dev
      click RandomPass "https://github.com/wrtnlabs/autoview/blob/main/packages/agent/src/passes/randomgen/Agent.ts"
    end

    CLI -->|runs| AVAgent
    AVAgent -->|uses| SchemaAdapter
    AVAgent -->|calls| LLMProxy
    SchemaAdapter -->|provides schema| LLMProxy

    %% Third-Party Service
    LLMVendor["OpenAI (LLM Vendor)"]:::third
    LLMProxy -->|"JSON-Schema + prompts"| LLMVendor
    LLMVendor -->|"TS/TSX code"| AVAgent

    %% Interface Metadata
    subgraph "Interface Metadata"
      direction TB
      IMService1["IAutoViewCompilerService"]:::int
      click IMService1 "https://github.com/wrtnlabs/autoview/blob/main/packages/interface/src/services/IAutoViewCompilerService.ts"
      IMService2["IAutoViewTransformerService"]:::int
      click IMService2 "https://github.com/wrtnlabs/autoview/blob/main/packages/interface/src/services/IAutoViewTransformerService.ts"
      IMComponents["Components"]:::int
      click IMComponents "https://github.com/wrtnlabs/autoview/tree/main/packages/interface/src/components"
    end

    AVAgent -->|metadata| IMService1
    AVAgent -->|metadata| IMService2

    %% Compiler Engine
    subgraph "Compiler Engine"
      direction TB
      AVC["AutoViewCompiler"]:::int
      click AVC "https://github.com/wrtnlabs/autoview/blob/main/packages/compiler/src/AutoViewCompiler.ts"
      AVCService["AutoViewCompilerService"]:::int
      click AVCService "https://github.com/wrtnlabs/autoview/blob/main/packages/compiler/src/AutoViewCompilerService.ts"
      Programmers["Programmers Plugins"]:::int
      click Programmers "https://github.com/wrtnlabs/autoview/tree/main/packages/compiler/src/programmers"
    end

    AVAgent -->|TSX code| AVC
    IMService1 -->|provides types| AVC
    AVC -->|transforms| AVCService
    AVCService -->|runs passes| Programmers
    Programmers -->|"refined code"| AVC

    %% Compiler Bundler & Tests
    subgraph "Bundle & Test"
      direction TB
      Bundler["Compiler Bundler"]:::int
      click Bundler "https://github.com/wrtnlabs/autoview/blob/main/packages/compiler-bundle/src/index.ts"
      click Bundler "https://github.com/wrtnlabs/autoview/blob/main/packages/compiler-bundle/build/rspack.js"
      BrowserTest["Browser Test Harness"]:::int
      click BrowserTest "https://github.com/wrtnlabs/autoview/tree/main/packages/compiler-browser-test/src"
    end

    AVCService -->|bundles| Bundler
    Bundler -->|verifies| BrowserTest

    %% UI Renderer
    subgraph "UI Renderer Library"
      direction TB
      UIRenderer["Renderer"]:::dev
      click UIRenderer "https://github.com/wrtnlabs/autoview/blob/main/packages/ui/src/renderer/index.tsx"
      UIComponents["Components"]:::dev
      click UIComponents "https://github.com/wrtnlabs/autoview/tree/main/packages/ui/src/components"
    end

    AVCService -->|"Generated code"| UIRenderer
    UIRenderer -->|renderComponent| UIComponents

    %% Packaging & Publishing
    subgraph "Packaging & Publishing"
      direction TB
      BuildScript["build.js"]:::dev
      click BuildScript "https://github.com/wrtnlabs/autoview/blob/main/deploy/build.js"
      PublishScript["publish.js"]:::dev
      click PublishScript "https://github.com/wrtnlabs/autoview/blob/main/deploy/publish.js"
      CI1["build.yml"]:::dev
      click CI1 "https://github.com/wrtnlabs/autoview/blob/main/.github/workflows/build.yml"
      CI2["release.yml"]:::dev
      click CI2 "https://github.com/wrtnlabs/autoview/blob/main/.github/workflows/release.yml"
    end

    Bundler -->|outputs| BuildScript
    BuildScript --> PublishScript
    CI1 --> BuildScript
    CI2 --> PublishScript

    %% npm Registry
    NPM["npm Registry"]:::third
    PublishScript -->|publishes| NPM

    %% Website
    subgraph "Website (Docs & Demos)"
      direction TB
      NextApp["Next.js App"]:::doc
      click NextApp "https://github.com/wrtnlabs/autoview/tree/main/website/app"
      MDX["MDX Content"]:::doc
      click MDX "https://github.com/wrtnlabs/autoview/tree/main/website/content"
    end

    NPM -->|fetches| NextApp
    NextApp -->|renders| MDX

    %% Styles
    classDef dev fill:#cce5ff,stroke:#004085,color:#004085
    classDef third fill:#d4edda,stroke:#155724,color:#155724
    classDef int fill:#fff3cd,stroke:#856404,color:#856404
    classDef doc fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
