How udemy3/chatgpt works
Main components
• Front-end (Renderer)
• Built with React/TypeScript, Vite-bundled, lives in /src + /src/components + /src/view
• Renders UI, captures user input, displays chat history, file-export dialogs, settings screens
• Back-end (Tauri/Rust)
• CLI core in src-tauri/src (modules: gpt.rs, fs_extra.rs, cmd.rs, script.rs, etc.)
• Manages IPC commands (tauri::invoke), orchestrates ChatGPT API calls, file I/O, templating, menus, windows
• IPC Bridge
• Tauri’s built-in channel that sends JSON RPC–style calls between the WebView and Rust code
• External Services
• OpenAI ChatGPT REST API (network)
• Optional sync sources for slash commands (local files, external repos)
• Local Persistence
• Exports (PNG, PDF, Markdown) via fs_extra.rs
• User settings, prompts config (.json under user data dir)
• Packaging & Distribution
• Build pipeline: Vite build → embed assets into Tauri bundle → Rust compile → OS-specific installers (.msi, .dmg, .deb, AppImage)
• CI/CD: GitHub Actions workflows (.github/workflows/release.yml) generating release artifacts, Homebrew casks (casks/chatgpt.rb)
Relationships & data flows
• User interacts with UI -> React event handlers -> tauri.invoke("...") -> Rust command handlers in corresponding .rs modules
• Rust handlers call ChatGPT API or perform FS operations -> return results via IPC -> React updates state & re-renders
• File exports: UI triggers ‘export’ -> Rust streams file to user’s disk
• Settings sync: UI fetches/saves config in Rust, which reads/writes user data paths
• Build chain: source code → front-end build → Rust build → packagers → installers
Architectural patterns
• Layered architecture: Presentation Layer (React), Application Layer (Tauri/Rust commands), Infrastructure Layer (network, file system)
• MV* in UI: React components + custom hooks (useChatPrompt, useData, etc.) manage state & effect side-effects
• Single binary host with embedded WebView
• Event-driven IPC
Key technologies & frameworks
• Tauri (Rust + WebView2 / WebKit)
• React + TypeScript + Vite
• Rust (edition 2021, Cargo)
• Node.js scripts (under /scripts) for build-time tasks (manifest generation, export helpers)
• CI/CD (GitHub Actions), Homebrew Cask, winget, AppImage
• Component blocks with labels (UI, IPC layer, Rust modules, ChatGPT API, File System, CI/CD)
• Notes on where hooks and scripts live (optional sub-components)