Skip to content

Project Structure

Sandeep Vattapparambil edited this page Aug 19, 2026 · 1 revision

πŸ—‚οΈ Project Structure

src/
β”œβ”€β”€ test-setup.ts                      # Vitest global setup: jest-dom matchers + i18n/electronAPI mocks
β”œβ”€β”€ main/                              # Electron main process
β”‚   β”œβ”€β”€ index.ts                       # Entry: CLI detection, splash + main window, console bridging
β”‚   β”œβ”€β”€ cli/                            # Commander-based CLI entry (subcommands)
β”‚   β”‚   β”œβ”€β”€ cli.ts                       # Entry: legacy shim, subcommand dispatch, exit codes
β”‚   β”‚   β”œβ”€β”€ cli-options.ts               # Shared global options + CliExitError
β”‚   β”‚   β”œβ”€β”€ cli-ui.ts                    # Colors, spinners, progress bars, tables
β”‚   β”‚   β”œβ”€β”€ cli-util.ts                  # Glob expansion, output derivation, formatting
β”‚   β”‚   β”œβ”€β”€ cli-convert.ts               # convert subcommand
β”‚   β”‚   β”œβ”€β”€ cli-info.ts                  # info + capabilities subcommands
β”‚   β”‚   β”œβ”€β”€ cli-compress.ts              # compress + extract-audio subcommands
β”‚   β”‚   └── cli-batch.ts                 # batch subcommand (JobQueue + MultiBar)
β”‚   β”œβ”€β”€ capabilities.ts                # Encoder probing (ffmpeg -encoders / -hwaccels)
β”‚   β”œβ”€β”€ process-utils.ts               # Child-process helpers (spawn, suspend, resume, kill)
β”‚   β”œβ”€β”€ image-info.ts                  # EXIF extraction + RGB/luma histogram via ffmpeg
β”‚   β”œβ”€β”€ image-preview.ts               # Downscaled base64 image previews
β”‚   β”œβ”€β”€ image-file-info.ts             # Image dimensions/size probing
β”‚   β”œβ”€β”€ video-preview.ts               # Single-frame video thumbnails
β”‚   β”œβ”€β”€ updater.ts                      # GitHub Releases update checker, download, install
β”‚   β”œβ”€β”€ ffprobe-static.d.ts            # Module declaration for ffprobe-static
β”‚   β”œβ”€β”€ ipc/                           # IPC handler modules (error-wrapped)
β”‚   β”‚   β”œβ”€β”€ handlers.ts                # Central registration + error wrapper
β”‚   β”‚   β”œβ”€β”€ dialogs.ts                 # select-file / select-files / select-output
β”‚   β”‚   β”œβ”€β”€ conversion.ts              # convert / cancel / pause / resume
β”‚   β”‚   β”œβ”€β”€ queue.ts                   # queue CRUD + cancel-all
β”‚   β”‚   β”œβ”€β”€ player.ts                  # player open / seek / close / get-frame
β”‚   β”‚   β”œβ”€β”€ timeline.ts                # extract-waveform / extract-thumbnails
β”‚   β”‚   β”œβ”€β”€ image.ts                   # image info / preview / file info
β”‚   β”‚   β”œβ”€β”€ capabilities.ts            # get-capabilities
β”‚   β”‚   β”œβ”€β”€ window.ts                  # minimize / maximize / close / always-on-top
β”‚   β”‚   β”œβ”€β”€ updater.ts                 # check / download / install updates
β”‚   β”‚   β”œβ”€β”€ system.ts                  # reveal-file / set-launch-at-login
β”‚   β”‚   β”œβ”€β”€ send.ts                    # Event broadcast helpers
β”‚   β”‚   └── types.ts                   # Type-safe main->renderer sender signature
β”‚   β”œβ”€β”€ player/
β”‚   β”‚   β”œβ”€β”€ frame-decoder.ts           # Rawvideo frame + PCM audio pipe decoder
β”‚   β”‚   └── types.ts                   # Decoded frame/audio structures + config types
β”‚   β”œβ”€β”€ queue/
β”‚   β”‚   └── job-queue.ts               # Async serial batch queue with EventEmitter
β”‚   β”œβ”€β”€ timeline/
β”‚   β”‚   └── timeline-media.ts          # Waveform + thumbnail-montage extraction
β”‚   └── transcoders/
β”‚       β”œβ”€β”€ types.ts                   # ITranscoder contract + raw ffprobe JSON shapes
β”‚       β”œβ”€β”€ factory.ts                 # Transcoder factory (FFMPEG | FFTOOL | BMF)
β”‚       β”œβ”€β”€ ffmpeg-core.ts             # fluent-ffmpeg API core
β”‚       β”œβ”€β”€ fftool-core.ts             # Direct CLI invocation via child_process
β”‚       β”œβ”€β”€ bmf-core.ts                # BMF framework CLI wrapper
β”‚       β”œβ”€β”€ ffmpeg-utils.ts            # Shared command/flag builders
β”‚       β”œβ”€β”€ ffprobe-mapper.ts          # ffprobe JSON -> MediaInfo normalization
β”‚       └── hwaccel.ts                 # Hardware-acceleration filter/flag resolution
β”œβ”€β”€ preload/
β”‚   └── index.ts                       # contextBridge exposes electronAPI to renderer
β”œβ”€β”€ renderer/                          # React UI (served by Vite, root: src/renderer)
β”‚   β”œβ”€β”€ main.tsx                       # React entry: HashRouter + DirectionProvider + I18nextProvider
β”‚   β”œβ”€β”€ App.tsx                        # Root layout: TitleBar, Drawer, routes, snackbar, toasts
β”‚   β”œβ”€β”€ ColorModeContext.tsx           # Dark/light theme context
β”‚   β”œβ”€β”€ useLanguageDirection.ts        # RTL/LTR detection hook
β”‚   β”œβ”€β”€ theme.ts                       # MUI light/dark theme definitions
β”‚   β”œβ”€β”€ colors.ts                      # Shared color palette
β”‚   β”œβ”€β”€ electron-api.d.ts              # Global Window.electronAPI type declaration
β”‚   β”œβ”€β”€ components/                    # Shared UI components (37 modules)
β”‚   β”œβ”€β”€ hooks/                         # useConversion, useErrorHandler, useFormErrors, ...
β”‚   β”œβ”€β”€ i18n/                          # i18next config, RTL provider, 56 locales
β”‚   β”œβ”€β”€ pages/                         # 10 code-split page components
β”‚   β”œβ”€β”€ stores/                        # Zustand stores (12 modules)
β”‚   β”œβ”€β”€ styles/                        # Extracted MUI style constants per component (42 modules)
β”‚   └── utils/
β”‚       └── formatters.ts              # Duration/bitrate/stream formatting helpers
└── shared/                            # Code shared between processes
    β”œβ”€β”€ errors.ts                      # ErrorCode enum, AppError, formatError()
    β”œβ”€β”€ ipc-channels.ts                # All IPC channel name constants
    β”œβ”€β”€ types.ts                       # Domain interfaces (ConversionOptions, MediaInfo, ...)
    β”œβ”€β”€ constants.ts                   # Numeric/string constants
    β”œβ”€β”€ log-constants.ts               # Shared log message constants (406 exported)
    β”œβ”€β”€ logger.ts                      # Timestamped logger (main/renderer)
    └── validation.ts                  # Time/scale/bitrate/range validation helpers

e2e/                                  # Playwright-based end-to-end tests
β”œβ”€β”€ vitest.e2e.config.ts              # Vitest config for e2e (node env, 60s timeout)
β”œβ”€β”€ vitest.e2e.real.config.ts         # Vitest config for real conversion tests
β”œβ”€β”€ helpers.ts                         # E2E helper utilities
β”œβ”€β”€ cli.spec.ts                        # CLI binary e2e tests
β”œβ”€β”€ fixtures/
β”‚   └── app.ts                         # Electron app launch/teardown helpers
β”œβ”€β”€ mocks/
β”‚   β”œβ”€β”€ control.ts                     # Typed helpers for driving mock electronAPI
β”‚   β”œβ”€β”€ main-store.js                  # In-memory state backing the mock preload
β”‚   └── preload.js                     # Mock preload (replaces real preload in test mode)
└── specs/                             # 11 E2E spec files
    β”œβ”€β”€ shell.spec.ts
    β”œβ”€β”€ convert.spec.ts
    β”œβ”€β”€ batch.spec.ts
    β”œβ”€β”€ audio-extract.spec.ts
    β”œβ”€β”€ image-compress.spec.ts
    β”œβ”€β”€ media-info.spec.ts
    β”œβ”€β”€ settings.spec.ts
    β”œβ”€β”€ logs.spec.ts
    β”œβ”€β”€ video-cut.spec.ts
    └── real-convert.spec.ts

Clone this wiki locally