See also: Architecture Diagram for visual dependency graph
pnpm workspaces:
apps/
ui/ # Vite + React frontend (NO filesystem access)
runtime/ # Node.js 20 local runtime (Hono)
electron/ # Electron desktop wrapper
packages/
core/ # Canonical models and shared logic
connectors/ # Per-tool adapters (Cursor, Claude Code, etc.)
UI: Vite, React, TypeScript, TanStack Router, TanStack Query, Tailwind CSS, Monaco Editor, shadcn/ui (Radix Nova)
Runtime: Node.js 20, TypeScript, Hono, Zod, chokidar
Electron: Electron 40+, custom titlebar, IPC bridge
The UI uses code-based routing with TanStack Router (not file-based). This approach is preferred for AI agentic coding because:
- All routes are explicit and discoverable in one place
- Type-safe route references
- Easy for AI to understand and modify
- No convention magic to reason about
Routes are organized in apps/ui/src/routes/:
routes/
__root.tsx # Root route with Layout component
home.tsx # Index route (/)
agents.tsx # Agents route (/agents)
skills.tsx # Skills route (/skills)
index.ts # Barrel export for all routes
Each route file exports a route created with createRoute(). Routes are composed in App.tsx:
const routeTree = rootRoute.addChildren([indexRoute, agentsRoute, skillsRoute])
const router = createRouter({ routeTree })-
Create
routes/new-route.tsx:import { createRoute } from '@tanstack/react-router' import { rootRoute } from './__root' export const newRoute = createRoute({ getParentRoute: () => rootRoute, path: '/new-path', component: NewComponent, })
-
Export from
routes/index.ts:export { newRoute } from './new-route'
-
Add to route tree in
App.tsx:const routeTree = rootRoute.addChildren([indexRoute, agentsRoute, skillsRoute, newRoute])
See UI Components for a complete list of available components, including typography elements and base UI primitives.
SkillForge runs in two modes:
- Runtime server on :4321 (serves API + static UI in production)
- UI dev server on :4320 (Vite HMR in dev)
- CORS enabled for development
- Embedded runtime server on :4321
- UI dev server on :4320 (Vite HMR in dev)
- Custom titlebar with native macOS traffic lights / Windows controls
- IPC bridge for window operations (minimize, maximize, close)
- Packaged app embeds pre-built UI (no external servers)
The Electron app uses a hidden native titlebar (titleBarStyle: 'hidden') with a custom React component for the titlebar region.
Component: apps/ui/src/components/electron-titlebar.tsx
- Height: 36px (h-9) full-width bar at the top of the window
- macOS: Traffic lights positioned at
{ x: 12, y: 12 }in the native titlebar space; custom titlebar reserves 80px left space - Windows/Linux: Custom minimize/maximize/close buttons on the right using
titleBarOverlaywith transparent background - Drag region: The entire titlebar is draggable (
.dragCSS class with-webkit-app-region: drag) - Interactive elements: Window control buttons use
.no-dragto remain clickable
The UI's sidebar uses fixed positioning that normally spans inset-y-0 h-svh (full viewport). In Electron, CSS rules offset the sidebar:
.electron-app [data-slot='sidebar-container'] {
top: 2.25rem;
height: calc(100svh - 2.25rem);
}This prevents the sidebar from overlapping the Electron titlebar and traffic lights.
Preload script: apps/electron/src/preload.ts exposes window control methods via contextBridge:
window.electronAPI = {
isElectron: true,
platform: process.platform,
minimizeWindow: () => ipcRenderer.invoke('window:minimize'),
maximizeWindow: () => ipcRenderer.invoke('window:maximize'),
closeWindow: () => ipcRenderer.invoke('window:close'),
}Main process: apps/electron/src/main.ts handles IPC calls to manipulate the BrowserWindow.
- Source:
apps/ui/public/anvil.svg(512x512 indigo anvil icon) - Converted to:
apps/electron/icon.png(runtime icon) - electron-builder: Converts PNG to platform formats (.icns for macOS, .ico for Windows)
The ElectronAPI interface is defined in apps/ui/src/lib/electron.ts and imported where needed:
import type { ElectronWindow } from '@/lib/electron'
const isElectron =
typeof window !== 'undefined' && !!(window as ElectronWindow).electronAPI?.isElectron-
Canonical model is sacred — All tool configurations normalize to one internal schema. No tool-specific logic in the UI.
-
UI is runtime-agnostic — Works identically in web and Electron modes. No environment-specific features except the Electron titlebar.
-
UI has no filesystem access — All file operations go through the runtime's localhost HTTP/JSON API.
-
Import/export flow:
- Import: tool format → canonical model (may be lossy, show warnings)
- Export: canonical model → tool format