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| Layer | Key files | Responsibility |
|---|---|---|
| Shell | main.js, preload.js | Window, API token cookie, encryption secret, directory picker IPC |
| UI | src/app/page.tsx, src/components/views/ | Dashboard tabs: workspace, git sync, diagnostics, timeline, settings |
| API | src/app/api/workspace/*, src/middleware.ts | Auth-guarded routes for git, files, runner, launch, diagnostics |
| Core | src/lib/git.ts, profiles.ts, pathSafety.ts, platformLaunch.ts | Git 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 hookStack
- Electron
- Next.js 16 + React 19 + TypeScript
- Tailwind CSS 4
- Vitest + Playwright
- electron-builder for packaging