# pr1ncegupta/blogcrafter-by-lyzrai architecture

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

- Interactive diagram: https://gitdiagram.com/pr1ncegupta/blogcrafter-by-lyzrai
- Repository: https://github.com/pr1ncegupta/blogcrafter-by-lyzrai

## Overview

##### Project type and purpose
- BlogCrafter is a single-page web application (SPA) built with React, TypeScript, Vite, and Tailwind CSS.
- Its primary purpose is to orchestrate four specialized AI agents—Planner, Writer, Auditor, Optimizer—via the Lyzr AI API to generate, audit, and optimize blog content.
- There is no custom backend; all “business logic” lives in the front-end, which calls out to external AI services.

##### File structure
- Top level: configuration files (package.json, tsconfig, tailwind.config.js, vite.config.ts).
- /src: application code
- App.tsx, main.tsx, index.css: entry point and global styles
- /components: UI components (pages, cards, modals, utility components)
- /contexts: React Context providers (ThemeContext, WorkflowContext)
- /utils: helper modules for API calls (agents.ts) and downloads (downloadHelpers.ts)
- /types: shared TypeScript types
- No /backend folder; suggests front-end–only architecture.

##### Additional README insights
- Describes workflows (full end-to-end, planning only, etc.).
- Environment variables configure base API URL, API key, and each agent’s ID.
- Tech stack is front-end centric, with Lyzr AI as external “backend.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Application"
        subgraph "Presentation Layer"
            Dashboard["Dashboard Page"]:::ui
            ChatInterface["Chat Interface"]:::ui
            AgentWorkspace["Agent Workspace"]:::ui
            TemplatesPage["Templates Page"]:::ui
            HelpPage["Help Page"]:::ui
            WorkflowSelector["Workflow Selector"]:::ui
            Header["Header (Navigation)"]:::ui
            PlannerCard["Planner Card"]:::ui
            WriterCard["Writer Card"]:::ui
            AuditorCard["Auditor Card"]:::ui
            OptimizerCard["Optimizer Card"]:::ui
            RunAllCard["Run All Card"]:::ui
            OutputCard["Output Card"]:::ui
            AgentCardWrapper["Agent Card Wrapper"]:::ui
            NextStepModal["Next Step Modal"]:::ui
            Button["Button"]:::ui
            GenericCard["Card (generic)"]:::ui
        end
        subgraph "State Management"
            ThemeContext["Theme Context"]:::state
            WorkflowContext["Workflow Context"]:::state
        end
        subgraph "Business Logic / API Layer"
            AgentsTS["Agent API Helpers"]:::util
            DownloadHelpers["Download Utilities"]:::util
            EnvConfig["Env Config"]:::config
        end
    end

    subgraph "External Services"
        LyzrAI["Lyzr AI API"]:::external
    end

    subgraph "Dev & Deployment"
        Vite["Vite Dev Server / Bundler"]:::tool
        Tailwind["Tailwind CSS Processor"]:::tool
    end

    User["User"]:::externalUser

    %% Interactions
    User -->|"uses SPA"| Dashboard
    User --> ChatInterface
    User --> AgentWorkspace
    WorkflowSelector -->|"calls agents"| AgentsTS
    AgentsTS -->|"HTTP Request"| LyzrAI
    LyzrAI -->|"Response"| AgentsTS
    AgentsTS -->|"update state"| WorkflowContext
    WorkflowContext -->|"state update"| Dashboard
    OutputCard -->|"uses"| DownloadHelpers
    DownloadHelpers -->|"download artifact"| User

    %% Dev & Deployment flows
    Vite -->|"bundles App"| Dashboard
    Tailwind -->|"process styles"| GenericCard

    %% Click events
    click Dashboard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/Dashboard.tsx"
    click ChatInterface "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/ChatInterface.tsx"
    click AgentWorkspace "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/AgentWorkspace.tsx"
    click TemplatesPage "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/TemplatesPage.tsx"
    click HelpPage "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/HelpPage.tsx"
    click WorkflowSelector "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/WorkflowSelector.tsx"
    click Header "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/Header.tsx"
    click PlannerCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/PlannerCard.tsx"
    click WriterCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/WriterCard.tsx"
    click AuditorCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/AuditorCard.tsx"
    click OptimizerCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/OptimizerCard.tsx"
    click RunAllCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/RunAllCard.tsx"
    click OutputCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/OutputCard.tsx"
    click AgentCardWrapper "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/cards/AgentCardWrapper.tsx"
    click NextStepModal "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/modals/NextStepModal.tsx"
    click Button "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/ui/Button.tsx"
    click GenericCard "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/components/ui/Card.tsx"
    click ThemeContext "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/contexts/ThemeContext.tsx"
    click WorkflowContext "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/contexts/WorkflowContext.tsx"
    click AgentsTS "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/utils/agents.ts"
    click DownloadHelpers "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/utils/downloadHelpers.ts"
    click EnvConfig "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/vite-env.d.ts"
    click Vite "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/vite.config.ts"
    click Tailwind "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/tailwind.config.js"
    click User "https://github.com/pr1ncegupta/blogcrafter-by-lyzrai/blob/main/src/main.tsx"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#03396C;
    classDef state fill:#E0FFD8,stroke:#228B22,color:#006400;
    classDef util fill:#FFE4B5,stroke:#FF8C00,color:#8B4513;
    classDef external fill:#F3E5F5,stroke:#8A2BE2,color:#4B0082,stroke-dasharray: 5 5;
    classDef tool fill:#E0E0E0,stroke:#606060,color:#404040;
    classDef config fill:#FFF5BA,stroke:#FFD700,color:#B8860B;
    classDef externalUser fill:#FFFFFF,stroke:#000000,color:#000000;
    class Dashboard,ChatInterface,AgentWorkspace,TemplatesPage,HelpPage,WorkflowSelector,Header,PlannerCard,WriterCard,AuditorCard,OptimizerCard,RunAllCard,OutputCard,AgentCardWrapper,NextStepModal,Button,GenericCard ui;
    class ThemeContext,WorkflowContext state;
    class AgentsTS,DownloadHelpers util;
    class LyzrAI external;
    class Vite,Tailwind tool;
    class EnvConfig config;
    class User externalUser;
```
