# changjin-cpu/image-create architecture

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

- Interactive diagram: https://gitdiagram.com/changjin-cpu/image-create
- Repository: https://github.com/changjin-cpu/image-create

## Overview

image-create is a local browser-based image-generation studio. The user configures a Provider profile, prepares a text/image-edit job, previews its request, submits generation, and views, switches, copies, or downloads saved results. Settings and uploads are handled separately from generation; OpenAI-compatible requests execute against an upstream API, while other Provider templates support configuration and previews rather than execution. The graph follows documented capabilities and sampled server/service calls; unsampled renderer API and result-handling details are represented only at the documented interface level.

Main entry points: [`src/server/studioService.ts`](https://github.com/changjin-cpu/image-create/blob/main/src/server/studioService.ts) (Studio service), [`src/renderer/src/App.tsx`](https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/App.tsx) (Studio UI), [`src/server/studioServer.ts`](https://github.com/changjin-cpu/image-create/blob/main/src/server/studioServer.ts) (API routes), [`src/renderer/src/studioApi.ts`](https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/studioApi.ts) (Studio API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Studio interface"]
  node_app["Studio UI<br/>[App.tsx]"]
  node_api_client["Studio API client<br/>[studioApi.ts]"]
  node_shared["Shared job types<br/>[providerTypes.ts]"]
  node_progress["Progress estimate"]
end

subgraph group_http["Local API"]
  node_server_entry["Local HTTP host<br/>[devServer.ts]"]
  node_api_routes["API routes<br/>[studioServer.ts]"]
  node_service["Studio service<br/>[studioService.ts]"]
end

subgraph group_providers["Provider handling"]
  node_provider_config["Provider validation<br/>[providerConfig.ts]"]
  node_provider_templates["Provider templates<br/>[providers.json]"]
  node_openai_builder["OpenAI request builder<br/>[openaiProvider.ts]"]
  node_generic_builder["Generic request builder<br/>[genericProvider.ts]"]
end

subgraph group_state["Local state"]
  node_profiles["Local API profiles"]
  node_uploads[("Temporary uploads")]
  node_file_store["Image file storage<br/>[fileStore.ts]"]
  node_outputs[("Generated outputs")]
end

node_user(("Studio user"))
node_upstream{{"Image API"}}

node_user -->|"uses"| node_app
node_app -->|"requests"| node_api_client
node_app -->|"estimates progress"| node_progress
node_api_client -->|"sends API requests"| node_server_entry
node_server_entry -->|"dispatches API"| node_api_routes
node_api_routes -->|"invokes operations"| node_service
node_service -->|"loads configuration"| node_provider_config
node_provider_config -->|"reads and validates"| node_provider_templates
node_service -->|"reads and writes"| node_profiles
node_service -->|"builds OpenAI request"| node_openai_builder
node_service -->|"builds preview request"| node_generic_builder
node_service -->|"submits OpenAI request"| node_upstream
node_upstream -->|"returns image data"| node_service
node_service -->|"saves uploads"| node_uploads
node_service -->|"saves image data"| node_file_store
node_file_store -->|"writes generated images"| node_outputs
node_service -->|"appends generation history"| node_outputs
node_api_routes -->|"reads image assets"| node_service

click node_app "https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/App.tsx"
click node_api_client "https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/studioApi.ts"
click node_shared "https://github.com/changjin-cpu/image-create/blob/main/src/shared/providerTypes.ts"
click node_progress "https://github.com/changjin-cpu/image-create/blob/main/src/shared/generationProgress.ts"
click node_server_entry "https://github.com/changjin-cpu/image-create/blob/main/src/server/devServer.ts"
click node_api_routes "https://github.com/changjin-cpu/image-create/blob/main/src/server/studioServer.ts"
click node_service "https://github.com/changjin-cpu/image-create/blob/main/src/server/studioService.ts"
click node_provider_config "https://github.com/changjin-cpu/image-create/blob/main/src/core/config/providerConfig.ts"
click node_provider_templates "https://github.com/changjin-cpu/image-create/blob/main/config/providers.json"
click node_openai_builder "https://github.com/changjin-cpu/image-create/blob/main/src/core/providers/openaiProvider.ts"
click node_generic_builder "https://github.com/changjin-cpu/image-create/blob/main/src/core/providers/genericProvider.ts"
click node_file_store "https://github.com/changjin-cpu/image-create/blob/main/src/core/storage/fileStore.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_app,node_api_client,node_shared,node_progress,node_user toneBlue
class node_server_entry,node_api_routes,node_service toneAmber
class node_provider_config,node_provider_templates,node_openai_builder,node_generic_builder,node_upstream toneMint
class node_profiles,node_uploads,node_file_store,node_outputs toneRose
```

## Components

### Studio interface

- [Studio UI](https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Studio API client](https://github.com/changjin-cpu/image-create/blob/main/src/renderer/src/studioApi.ts): `src/renderer/src/studioApi.ts`
- [Shared job types](https://github.com/changjin-cpu/image-create/blob/main/src/shared/providerTypes.ts): `src/shared/providerTypes.ts`
- [Progress estimate](https://github.com/changjin-cpu/image-create/blob/main/src/shared/generationProgress.ts): `src/shared/generationProgress.ts`

### Local API

- [Local HTTP host](https://github.com/changjin-cpu/image-create/blob/main/src/server/devServer.ts): `src/server/devServer.ts`
- [API routes](https://github.com/changjin-cpu/image-create/blob/main/src/server/studioServer.ts): `src/server/studioServer.ts`
- [Studio service](https://github.com/changjin-cpu/image-create/blob/main/src/server/studioService.ts): `src/server/studioService.ts`

### Provider handling

- [Provider validation](https://github.com/changjin-cpu/image-create/blob/main/src/core/config/providerConfig.ts): `src/core/config/providerConfig.ts`
- [Provider templates](https://github.com/changjin-cpu/image-create/blob/main/config/providers.json): `config/providers.json`
- [OpenAI request builder](https://github.com/changjin-cpu/image-create/blob/main/src/core/providers/openaiProvider.ts): `src/core/providers/openaiProvider.ts`
- [Generic request builder](https://github.com/changjin-cpu/image-create/blob/main/src/core/providers/genericProvider.ts): `src/core/providers/genericProvider.ts`

### Local state

- **Local API profiles**
- **Temporary uploads**
- [Image file storage](https://github.com/changjin-cpu/image-create/blob/main/src/core/storage/fileStore.ts): `src/core/storage/fileStore.ts`
- **Generated outputs**

### Other components

- **Studio user**
- **Image API**

## Connections

- Studio user → Studio UI: uses
- Studio UI → Studio API client: requests
- Studio UI → Progress estimate: estimates progress
- Studio API client → Local HTTP host: sends API requests
- Local HTTP host → API routes: dispatches API
- API routes → Studio service: invokes operations
- Studio service → Provider validation: loads configuration
- Provider validation → Provider templates: reads and validates
- Studio service → Local API profiles: reads and writes
- Studio service → OpenAI request builder: builds OpenAI request
- Studio service → Generic request builder: builds preview request
- Studio service → Image API: submits OpenAI request
- Image API → Studio service: returns image data
- Studio service → Temporary uploads: saves uploads
- Studio service → Image file storage: saves image data
- Image file storage → Generated outputs: writes generated images
- Studio service → Generated outputs: appends generation history
- API routes → Studio service: reads image assets
