# neosubhamoy/neodlp architecture

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

- Interactive diagram: https://gitdiagram.com/neosubhamoy/neodlp
- Repository: https://github.com/neosubhamoy/neodlp
- Video tour (about a minute): https://gitdiagram.com/neosubhamoy/neodlp/video

## Overview

##### Project Type and Purpose
- NeoDLP is a cross-platform desktop application (Windows, Linux, macOS) built with Tauri (Rust) for the native side and React + TypeScript for the UI.
- It provides a modern GUI wrapper around the command-line downloader yt-dlp, uses FFmpeg for post-processing, and offers browser integration via “msghost.”

##### High-Level File-Structure Analysis
- Top-level:
- `src-tauri/` – Rust backend, Tauri configuration, native resources (binaries, autostart, installer scripts).
- `src/` – React + TypeScript frontend (UI components, pages, hooks, services for data access).
- `public/` & `index.html` – Static assets for the web-view.
- Configuration files: `tauri.conf.json`, `vite.config.ts`, `package.json`, `Cargo.toml`.
- Key sub-directories:
- `src-tauri/binaries` – Bundled yt-dlp executables per OS/arch.
- `src-tauri/resources` – Bundled FFmpeg binaries and browser-extension manifests.
- `src/components` & `src/pages` – UI layers following component-based design.
- `src/services` – Abstractions over local storage (SQLite via Tauri side) and app state mutations/queries.
- `src/providers` – React Context providers (app context, theme, state management).

##### README Insights
- Confirms Tauri + Rust + React + TypeScript stack.
- External dependencies: yt-dlp (download engine) and FFmpeg (post-processing).
- Build / release pipelines for multiple platforms (GitHub Actions, Winget, AUR).

##### Main Components
a. User Interface (Renderer Process)
- React/TypeScript web-view (components, pages, UI state).
- Context Providers and Hooks enabling UI logic.
b. Tauri Backend (Main Process)
- Rust code (`src-tauri/src/lib.rs` & `main.rs`): IPC handlers, command invocations.
- Build scripts (`build.rs`) and migration code (`migrations.rs`).
c. External Binaries
- yt-dlp executables (bundled per platform).
- FFmpeg executables (bundled per platform).
d. Local Data Store
- SQLite database or key-value store accessed through Tauri commands (`services/database.ts`).
e. Auto-Updater / Installer
- Tauri autoupdate mechanism configured in `tauri.conf.json`.
- Platform installers (NSIS, WiX, shell scripts).
f. Browser Integration (“msghost”)
- Native extension manifests under `resources/msghost-manifest`.
- Handles remote control of the UI from supported browsers.

##### Relationships and Data Flows
- UI → Tauri IPC: front-end sends commands (download request, settings updates) via Tauri’s invoke API.
- Tauri → External Binaries: Rust side spawns yt-dlp/FFmpeg processes, streams progress back via events.
- Tauri → Local DB: writes metadata (download history, settings) to SQLite.
- Local DB → UI: queries history and settings for rendering.
- Auto-Updater: Tauri main process checks for updates, prompts UI.
- Browser → Native App: “msghost” extension sends events → Tauri backend → UI updates.

##### Architectural Patterns and Design Principles
- Clear separation of concerns: UI layer (React) vs. native layer (Rust).
- Componentized UI (atomic design via custom/shadcn UI components).
- IPC-based bridge (request/response + event streaming).
- Bundling of cross-platform binaries and resources.
- Use of context providers for global state.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Renderer Process
    subgraph "Renderer Process (React UI)"
        direction TB
        ReactUI["Renderer: React UI"]:::renderer
        Components["UI Components"]:::renderer
        Services["UI Services"]:::renderer
        Providers["Context Providers & Hooks"]:::renderer
    end

    %% Main Process
    subgraph "Main Process (Tauri Backend)"
        direction TB
        TauriMain["Main: Tauri IPC Handler"]:::main
        RustLib["Rust Library (lib.rs)"]:::main
        BuildScripts["Build Scripts (build.rs)"]:::main
        Migrations["Migrations (migrations.rs)"]:::main
    end

    %% External Tools
    subgraph "External Tools"
        direction TB
        YTDLP["yt-dlp Executable"]:::external
        FFmpeg["FFmpeg Executable"]:::external
    end

    %% Data Store
    subgraph "Local Data Store"
        direction TB
        SQLiteDB["SQLite Database"]:::datastore
    end

    %% Updater & Installer
    subgraph "Updater & Installer"
        direction TB
        AutoUpdater["Tauri Auto-Updater"]:::infra
        Installers["Platform Installers"]:::infra
    end

    %% Browser Integration
    subgraph "Browser Integration (msghost)"
        direction TB
        BrowserExt["msghost Extension"]:::infra
    end

    %% Connections
    ReactUI -->|"invoke commands"| TauriMain
    Components -->|uses| ReactUI
    Services -->|queries| ReactUI
    Providers -->|provides state| ReactUI

    TauriMain -->|"spawn"| YTDLP
    TauriMain -->|"spawn"| FFmpeg
    YTDLP -->|"progress events"| TauriMain
    FFmpeg -->|"output events"| TauriMain

    TauriMain -->|"read/write"| SQLiteDB
    SQLiteDB -->|"query results"| ReactUI

    AutoUpdater -->|"check updates"| TauriMain
    TauriMain -->|"update available"| ReactUI

    BrowserExt -->|"events"| TauriMain
    TauriMain -->|"UI updates"| ReactUI

    %% Click Events - Renderer
    click ReactUI "https://github.com/neosubhamoy/neodlp/blob/main/src/App.tsx"
    click ReactUI "https://github.com/neosubhamoy/neodlp/blob/main/src/main.tsx"
    click ReactUI "https://github.com/neosubhamoy/neodlp/blob/main/src/index.css"
    click Components "https://github.com/neosubhamoy/neodlp/tree/main/src/components/"
    click Components "https://github.com/neosubhamoy/neodlp/tree/main/src/pages/"
    click Providers "https://github.com/neosubhamoy/neodlp/tree/main/src/providers/"
    click Providers "https://github.com/neosubhamoy/neodlp/tree/main/src/hooks/"
    click Providers "https://github.com/neosubhamoy/neodlp/tree/main/src/helpers/"
    click Services "https://github.com/neosubhamoy/neodlp/blob/main/src/services/database.ts"
    click Services "https://github.com/neosubhamoy/neodlp/blob/main/src/services/queries.ts"
    click Services "https://github.com/neosubhamoy/neodlp/blob/main/src/services/mutations.ts"
    click Services "https://github.com/neosubhamoy/neodlp/blob/main/src/services/store.ts"

    %% Click Events - Main
    click TauriMain "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/src/main.rs"
    click RustLib "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/src/lib.rs"
    click BuildScripts "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/build.rs"
    click Migrations "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/src/migrations.rs"
    click AutoUpdater "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/tauri.conf.json"

    %% Click Events - External Tools
    click YTDLP "https://github.com/neosubhamoy/neodlp/tree/main/src-tauri/binaries/"
    click FFmpeg "https://github.com/neosubhamoy/neodlp/tree/main/src-tauri/resources/binaries/"

    %% Click Events - Data Store
    click SQLiteDB "https://github.com/neosubhamoy/neodlp/blob/main/src/services/database.ts"

    %% Click Events - Updater & Installer
    click Installers "https://github.com/neosubhamoy/neodlp/blob/main/src-tauri/installer/windows/nsis/hooks.nsi"

    %% Click Events - Browser Integration
    click BrowserExt "https://github.com/neosubhamoy/neodlp/tree/main/src-tauri/resources/msghost-manifest/"

    %% Styles
    classDef renderer fill:#E0F7FA,stroke:#006064
    classDef main fill:#E8F5E9,stroke:#1B5E20
    classDef external fill:#FFF3E0,stroke:#E65100
    classDef datastore fill:#F5F5F5,stroke:#9E9E9E
    classDef infra fill:#F3E5F5,stroke:#6A1B9A
```
