# yashchandnani07/code-ignite architecture

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

- Interactive diagram: https://gitdiagram.com/yashchandnani07/code-ignite
- Repository: https://github.com/yashchandnani07/code-ignite

## Overview

1. **Overall shape**
   - Code Ignite is a **React + TypeScript Vite SPA** with a small set of **serverless API endpoints** under `api/`.
   - The browser app is the main product surface; the backend code appears to exist primarily as a **thin proxy/orchestration layer** for AI, speech-to-text, validation, and deployment tasks.

2. **Primary user experience shell**
   - `src/App.tsx` is the top-level coordinator for the product.
   - The UI is split between a **landing/onboarding flow** (`LandingPage`, `ApiKeyPopup`, `FirebaseSetup`) and the **interactive app workspace** where generation, editing, previewing, and deployment happen.

3. **Core generation workspace**
   - The central working area is composed of:
     - `ChatInterface` for prompting and conversational iteration
     - `CodeEditor` for editing generated source
     - `FileTree` for navigating multi-file projects
     - `Preview` for running/inspecting the generated app
     - `DiffViewer` for reviewing AI-proposed changes
   - This is the main “AI coder” loop: prompt → generate/update files → review diff → apply changes → preview.

4. **AI orchestration layer**
   - AI-specific logic lives in `src/services/ai.ts`, `src/services/aiValidate.ts`, `src/services/fetchModels.ts`, and supporting files under `src/services/ai/`.
   - The app is designed to work with **multiple model providers** and to support **multi-file code generation**, not just single-response text completion.
   - `parseMultiFile.ts` and prompt/system-prompt files suggest the AI output is parsed into structured file updates before being surfaced to the editor and diff UI.

5. **Serverless boundary and external calls**
   - The `api/` folder contains the backend entry points:
     - `proxy.js` likely forwards AI-related requests to external model APIs
     - `ai-validate.js` likely checks generated output or runtime errors
     - `stt.js` handles speech-to-text
     - `deploy.js` handles deployment publishing
   - Architecturally, these endpoints act as a **trust boundary** so the client can call external services without exposing sensitive credentials or implementation details directly in the browser.

6. **Voice and multimodal input**
   - Voice is a first-class input path through `src/components/ui/InlineVoiceRecorder.tsx`, `VoiceChat.tsx`, and `api/stt.js`.
   - The README also describes image/PDF-driven generation, implying the app accepts richer context inputs and passes them into the AI pipeline as supporting artifacts.

7. **Deployment path**
   - Deployment is handled through `src/services/deploy.ts` and `api/deploy.js`, with a dedicated `DeployModal`.
   - The README emphasizes Netlify-style one-click publishing and GitHub Gist sharing, so deployment is part of the app’s core workflow rather than an afterthought.
   - This means the system has a distinct **build/publish branch** separate from the local preview branch.

8. **Preview/runtime rendering**
   - `buildPreviewDocument.ts`, `Preview`, and `dev-server-plugin.ts` indicate the generated app is rendered in an isolated preview environment rather than only as static code text.
   - The preview subsystem is important because it closes the loop between AI generation and live runtime verification.

9. **State, settings, and persistence**
   - `useApiSettings`, `useLocalStorage`, `useAppNavigation`, and `useChat` show that application state is mostly client-managed.
   - Local storage is used for persistent configuration such as API keys, model preferences, and user settings.
   - `SettingsModal`, `Toast`, and `ApiKeyPopup` support user configuration and feedback without requiring a traditional account system.

10. **Firebase-specific integration path**
   - `FirebaseSetup` and the README’s “Bring Your Own Database” feature indicate a specialized flow for generating apps that connect to Firebase Realtime Database and Anonymous Auth.
   - This is a notable architectural extension because the generated apps are not always static frontends; they can include **client-side database wiring** and user-scoped data access patterns.

11. **Generated app asset pipeline**
   - `fileProcessor`, `download`, `storage`, and utility layers suggest the app manages generated code as a structured file bundle.
   - The system must transform model output into files, store them transiently for editing/preview, and optionally package or export them for deployment.

12. **UI framework and design system**
   - The app uses **Tailwind CSS**, **Framer Motion**, **Monaco Editor**, and custom UI primitives under `src/components/ui`.
   - These choices matter architecturally because the product is built as a highly interactive editor/visualizer rather than a simple chat app.

13. **What to draw in an architecture diagram**
   - A good diagram would show:
     - user inputs entering the React SPA
     - a central orchestration layer in the browser
     - calls out to serverless APIs for AI, STT, validation, and deployment
     - external AI providers and optionally Firebase/Netlify/GitHub Gist as downstream services
     - a generated-file workspace feeding both the editor and preview runtime

14. **Key boundary to preserve**
   - The main architectural divide is between **interactive client-side orchestration** and **external service execution**.
   - The browser owns the workflow, state, and rendering; the serverless endpoints act as secure connectors to AI/deployment infrastructure.

Main entry points: [`src/services/ai.ts`](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai.ts) (AI services), [`src/App.tsx`](https://github.com/yashchandnani07/code-ignite/blob/main/src/App.tsx) (App shell), [`src/services/ai/parseMultiFile.ts`](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai/parseMultiFile.ts) (File parser), [`src/components/Preview.tsx`](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/Preview.tsx) (Preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_app["App shell<br/>spa coordinator<br/>[App.tsx]"]
  node_landing["Landing<br/>onboarding UI<br/>[LandingPage.tsx]"]
  node_api_key["API key<br/>setup modal<br/>[ApiKeyPopup.tsx]"]
  node_firebase_setup["Firebase setup<br/>integration UI<br/>[FirebaseSetup.tsx]"]
  node_workspace["Workspace<br/>editor shell"]
  node_chat["Chat<br/>prompt loop<br/>[ChatInterface.tsx]"]
  node_editor["Editor<br/>[CodeEditor.tsx]"]
  node_files["File tree<br/>project nav<br/>[FileTree.tsx]"]
  node_diff["Diff view<br/>review UI<br/>[DiffViewer.tsx]"]
  node_preview["Preview<br/>runtime view<br/>[Preview.tsx]"]
  node_deploy_modal["Deploy modal<br/>publish UI<br/>[DeployModal.tsx]"]
  node_voice["Voice input<br/>multimodal input"]
  node_settings["Settings<br/>state + prefs<br/>[useApiSettings.ts]"]
  node_ai_service["AI services<br/>orchestration<br/>[ai.ts]"]
  node_file_parse["File parser<br/>multi-file transform<br/>[parseMultiFile.ts]"]
  node_preview_doc["Preview doc<br/>build step"]
  node_deploy_service["Deploy service<br/>publish orchestration<br/>[deploy.ts]"]
end

subgraph group_api["Serverless API"]
  node_proxy_api["Proxy API<br/>serverless proxy<br/>[proxy.js]"]
  node_validate_api["Validate API<br/>serverless check<br/>[ai-validate.js]"]
  node_stt_api["STT API<br/>speech endpoint<br/>[stt.js]"]
  node_deploy_api["Deploy API<br/>serverless publish<br/>[deploy.js]"]
end

subgraph group_external["External services"]
  node_models[("Model providers<br/>external AI")]
  node_firebase[("Firebase<br/>external backend")]
  node_hosting[("Hosting targets<br/>external publish")]
end

node_app -->|"onboard"| node_landing
node_app -->|"open"| node_workspace
node_app -->|"configure"| node_api_key
node_app -->|"integrate"| node_firebase_setup
node_workspace -->|"prompt"| node_chat
node_workspace -->|"edit"| node_editor
node_workspace -->|"navigate"| node_files
node_workspace -->|"review"| node_diff
node_workspace -->|"run"| node_preview
node_workspace -->|"publish"| node_deploy_modal
node_workspace -->|"speak"| node_voice
node_workspace -->|"prefs"| node_settings
node_chat -->|"generate"| node_ai_service
node_voice -->|"transcribe"| node_stt_api
node_ai_service -->|"call"| node_proxy_api
node_ai_service -->|"structure"| node_file_parse
node_ai_service -->|"validate"| node_validate_api
node_ai_service -.->|"use"| node_models
node_file_parse -->|"update"| node_files
node_file_parse -->|"apply"| node_editor
node_file_parse -->|"compare"| node_diff
node_preview -->|"build"| node_preview_doc
node_preview -->|"inspect"| node_workspace
node_deploy_modal -->|"publish"| node_deploy_service
node_deploy_service -->|"call"| node_deploy_api
node_deploy_service -.->|"send"| node_hosting
node_firebase_setup -.->|"wire"| node_firebase
node_settings -->|"configure"| node_proxy_api
node_validate_api -.->|"check"| node_models

click node_app "https://github.com/yashchandnani07/code-ignite/blob/main/src/App.tsx"
click node_landing "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/LandingPage.tsx"
click node_api_key "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ApiKeyPopup.tsx"
click node_firebase_setup "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/FirebaseSetup.tsx"
click node_chat "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ChatInterface.tsx"
click node_editor "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/CodeEditor.tsx"
click node_files "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/FileTree.tsx"
click node_diff "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/DiffViewer.tsx"
click node_preview "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/Preview.tsx"
click node_deploy_modal "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/DeployModal.tsx"
click node_voice "https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ui/InlineVoiceRecorder.tsx"
click node_settings "https://github.com/yashchandnani07/code-ignite/blob/main/src/hooks/useApiSettings.ts"
click node_ai_service "https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai.ts"
click node_file_parse "https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai/parseMultiFile.ts"
click node_preview_doc "https://github.com/yashchandnani07/code-ignite/blob/main/src/services/buildPreviewDocument.ts"
click node_deploy_service "https://github.com/yashchandnani07/code-ignite/blob/main/src/services/deploy.ts"
click node_proxy_api "https://github.com/yashchandnani07/code-ignite/blob/main/api/proxy.js"
click node_validate_api "https://github.com/yashchandnani07/code-ignite/blob/main/api/ai-validate.js"
click node_stt_api "https://github.com/yashchandnani07/code-ignite/blob/main/api/stt.js"
click node_deploy_api "https://github.com/yashchandnani07/code-ignite/blob/main/api/deploy.js"

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_landing,node_api_key,node_firebase_setup,node_workspace,node_chat,node_editor,node_files,node_diff,node_preview,node_deploy_modal,node_voice,node_settings,node_ai_service,node_file_parse,node_preview_doc,node_deploy_service toneBlue
class node_proxy_api,node_validate_api,node_stt_api,node_deploy_api toneAmber
class node_models,node_firebase,node_hosting toneMint
```

## Components

### Client app

React + TypeScript SPA that owns the workflow, editor state, and preview loop

- [App shell](https://github.com/yashchandnani07/code-ignite/blob/main/src/App.tsx): spa coordinator · Top-level React coordinator for onboarding, workspace, and product flow · `src/App.tsx`
- [Landing](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/LandingPage.tsx): onboarding UI · Entry and onboarding experience for new users · `src/components/LandingPage.tsx`
- [API key](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ApiKeyPopup.tsx): setup modal · Collects provider credentials and initial app configuration · `src/components/ApiKeyPopup.tsx`
- [Firebase setup](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/FirebaseSetup.tsx): integration UI · Guided setup for Firebase-backed generated apps · `src/components/FirebaseSetup.tsx`
- **Workspace**: editor shell · Main generation and iteration surface that ties together chat, files, preview, and deploy
- [Chat](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ChatInterface.tsx): prompt loop · Conversational interface for prompting and iterating on code generation · `src/components/ChatInterface.tsx`
- [Editor](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/CodeEditor.tsx): code editor · Monaco-backed source editing surface for generated files · `src/components/CodeEditor.tsx`
- [File tree](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/FileTree.tsx): project nav · Multi-file project navigation and selection · `src/components/FileTree.tsx`
- [Diff view](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/DiffViewer.tsx): review UI · Shows AI-proposed changes before they are applied · `src/components/DiffViewer.tsx`
- [Preview](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/Preview.tsx): runtime view · Isolated preview for generated apps and runtime verification · `src/components/Preview.tsx`
- [Deploy modal](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/DeployModal.tsx): publish UI · One-click publishing and sharing workflow · `src/components/DeployModal.tsx`
- [Voice input](https://github.com/yashchandnani07/code-ignite/blob/main/src/components/ui/InlineVoiceRecorder.tsx): multimodal input · Inline voice capture and voice chat entry points · `src/components/ui/InlineVoiceRecorder.tsx`
- [Settings](https://github.com/yashchandnani07/code-ignite/blob/main/src/hooks/useApiSettings.ts): state + prefs · Client-side configuration and persistence for keys, models, and preferences · `src/hooks/useApiSettings.ts`
- [AI services](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai.ts): orchestration · Model selection, prompting, validation, and multi-file generation logic · `src/services/ai.ts`
- [File parser](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/ai/parseMultiFile.ts): multi-file transform · Parses structured AI output into file updates for the workspace · `src/services/ai/parseMultiFile.ts`
- [Preview doc](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/buildPreviewDocument.ts): build step · Builds the HTML document and preview scaffold for execution · `src/services/buildPreviewDocument.ts`
- [Deploy service](https://github.com/yashchandnani07/code-ignite/blob/main/src/services/deploy.ts): publish orchestration · Coordinates packaging and publishing from the client side · `src/services/deploy.ts`

### Serverless API

Thin trust boundary for AI, speech, validation, and deployment calls

- [Proxy API](https://github.com/yashchandnani07/code-ignite/blob/main/api/proxy.js): serverless proxy · Backend entry point that forwards AI-related requests to providers · `api/proxy.js`
- [Validate API](https://github.com/yashchandnani07/code-ignite/blob/main/api/ai-validate.js): serverless check · Backend validation for generated output or runtime errors · `api/ai-validate.js`
- [STT API](https://github.com/yashchandnani07/code-ignite/blob/main/api/stt.js): speech endpoint · Speech-to-text entry point for voice-driven input · `api/stt.js`
- [Deploy API](https://github.com/yashchandnani07/code-ignite/blob/main/api/deploy.js): serverless publish · Backend endpoint used for publishing and share/deploy flows · `api/deploy.js`

### External services

Downstream providers and hosting targets used by the app

- **Model providers**: external AI · External LLM providers used for code generation and chat
- **Firebase**: external backend · Realtime database and anonymous auth integration target for generated apps
- **Hosting targets**: external publish · Deployment destinations such as Netlify-style publish flows and GitHub Gist sharing

## Connections

- App shell → Landing: onboard · Routes new users into the landing and setup flow
- App shell → Workspace: open · Main product surface is the generation workspace
- App shell → API key: configure · Prompts for provider credentials and app setup
- App shell → Firebase setup: integrate · Specialized setup for Firebase-backed generated apps
- Workspace → Chat: prompt · User iterates through the conversational coding loop
- Workspace → Editor: edit · Workspace exposes direct source editing
- Workspace → File tree: navigate · Workspace organizes multi-file projects
- Workspace → Diff view: review · Workspace surfaces AI diffs before applying changes
- Workspace → Preview: run · Workspace verifies code in an isolated preview
- Workspace → Deploy modal: publish · Workspace branches into deployment and sharing
- Workspace → Voice input: speak · Workspace accepts voice as an input mode
- Workspace → Settings: prefs · Workspace relies on client-managed settings and persistence
- Chat → AI services: generate · Prompts flow into AI orchestration
- Voice input → STT API: transcribe · Voice capture is converted to text through the STT endpoint
- AI services → Proxy API: call · AI orchestration delegates provider access through the proxy boundary
- AI services → File parser: structure · Model output is parsed into structured file updates
- AI services → Validate API: validate · Generated output can be checked through the validation endpoint
- AI services → Model providers: use · Proxy routes requests to external model providers
- File parser → File tree: update · Parsed file changes feed the project tree
- File parser → Editor: apply · Structured output becomes editable source files
- File parser → Diff view: compare · File-level changes are shown in the diff viewer
- Preview → Preview doc: build · Preview renders through a generated document scaffold
- Preview → Workspace: inspect · Live runtime feedback feeds back into the workspace loop
- Deploy modal → Deploy service: publish · Deploy UI triggers client-side deployment orchestration
- Deploy service → Deploy API: call · Deployment flows through the serverless publish endpoint
- Deploy service → Hosting targets: send · Publishing targets external hosting and sharing surfaces
- Firebase setup → Firebase: wire · Generated apps can be connected to Firebase services
- Settings → Proxy API: configure · Stored provider settings influence AI request routing
- Validate API → Model providers: check · Validation may involve provider-backed AI checks
