Documentation

Architecture

OmniSync is a three-layer desktop app: an Electron shell that spawns a local Next.js server, a React dashboard, and auth-guarded API routes that talk to git and the filesystem.

Layer model

Electron shell (main.js)
    └── spawns Next.js on localhost:47821
            └── React dashboard (src/app/)
                    └── API routes (src/app/api/)
                            └── lib helpers (src/lib/)
                                    └── filesystem + git + child processes
LayerKey filesResponsibility
Shellmain.js, preload.jsWindow, API token cookie, encryption secret, directory picker IPC
UIsrc/app/page.tsx, src/components/views/Dashboard tabs: workspace, git sync, diagnostics, timeline, settings
APIsrc/app/api/workspace/*, src/middleware.tsAuth-guarded routes for git, files, runner, launch, diagnostics
Coresrc/lib/git.ts, profiles.ts, pathSafety.ts, platformLaunch.tsGit ops, encrypted profiles, safe paths, cross-platform IDE launch

Default port

The local Next.js server listens on 47821 (NEXT_PUBLIC_OMNISYNC_PORT).

Security model

Electron generates a per-session API token and encryption secret. Middleware requires a matching HttpOnly cookie on all /api/* routes from localhost only. GitHub tokens are persisted server-side only (AES-256-GCM with a per-install salt) and are not returned to the browser after OAuth/device auth.

For the user-facing trust boundary, see Security.

Git sync data flow

UI → POST /api/workspace/git → src/lib/git.ts → system git binary
    → JSON response → dashboard state via useGitSync hook

Stack

  • Electron
  • Next.js 16 + React 19 + TypeScript
  • Tailwind CSS 4
  • Vitest + Playwright
  • electron-builder for packaging