How themdmohsin/scaffold works
This repository combines the Scaffold project-coordination product (a React dashboard and FastAPI engine) with a substantial OpenCode application tree. Scaffold users sign in, select or create a project, then manage tasks, teammates, environment settings, decisions, contracts, and activity; the dashboard talks to the engine, which persists domain data. The engine also ingests default-branch GitHub pushes and exposes an MCP server. OpenCode’s server routes and TUI are represented as a separate runtime branch. Several backend and OpenCode links rely on the SOURCE INDEX; unsampled subsystems are kept broad where their internal wiring is not shown.
Main entry points: github_webhook.py GitHub ingestion · main.py FastAPI engine · api.ts Engine API client · session.py Database sessions
Components 27
Scaffold dashboard
- Dashboard routes
dashboard/src/App.tsx - Session and identity
dashboard/src/lib/auth.tsx - Project workspace
dashboard/src/pages/ProjectLayout.tsx - Project views
dashboard/src/pages - Engine API client
dashboard/src/lib/api.ts - Query cache
dashboard/src/lib/queryClient.ts - Realtime refresh
dashboard/src/lib/useRealtime.ts
Scaffold engine
- FastAPI engine
engine/app/main.py - Authentication routes
engine/app/routes/auth.py - Project API routes
engine/app/routes - GitHub ingestion
engine/app/routes/github_webhook.py - MCP interface
engine/app/mcp_server.py
Engine domain services
- Identity and access
engine/app/services/auth.py - Coordination services
engine/app/services/coordination.py - Reasoning and retrieval
engine/app/services/reasoning.py - Conflict detection
engine/app/services/conflict_service.py - Diff parsing
engine/app/services/diff_parser.py - Database sessions
engine/app/db/session.py - Domain records
engine/app/db/models.py
OpenCode runtime
- HTTP route assembly
opencode-plugin/opencode/packages/server/src/routes.ts - Server handlers
opencode-plugin/opencode/packages/server/src/handlers.ts - Terminal interface
opencode-plugin/opencode/packages/tui/src/app.tsx - Terminal routing
opencode-plugin/opencode/packages/tui/src/context/route.tsx
Other components
- Project user
- Supabase auth
- PostgreSQL
- GitHub
Connections 30
- Project user → Dashboard routes: uses
dashboard/src/App.tsx - Dashboard routes → Session and identity: checks session
dashboard/src/App.tsx - Dashboard routes → Project workspace: opens workspace
dashboard/src/App.tsx - Dashboard routes → Project views: routes to
dashboard/src/App.tsx - Session and identity → Supabase auth: restores session
dashboard/src/lib/auth.tsx - Session and identity → Engine API client: loads identity
dashboard/src/lib/auth.tsx - Project workspace → Engine API client: loads project data
dashboard/src/pages/ProjectLayout.tsx - Project workspace → Realtime refresh: subscribes
dashboard/src/pages/ProjectLayout.tsx - Project views → Engine API client: requests domain data
dashboard/src/pages/TasksPage.tsx - Engine API client → FastAPI engine: calls API
dashboard/src/lib/api.ts - Engine API client → Supabase auth: gets access token
dashboard/src/lib/api.ts - Realtime refresh → Query cache: invalidates queries
dashboard/src/lib/useRealtime.ts - FastAPI engine → Authentication routes: mounts routes
engine/app/main.py - FastAPI engine → Project API routes: mounts routes
engine/app/main.py - FastAPI engine → GitHub ingestion: mounts webhook
engine/app/main.py - FastAPI engine → MCP interface: mounts MCP
engine/app/main.py - Authentication routes → Identity and access: uses identity service
engine/app/routes/auth.py - Project API routes → Database sessions: uses database sessions
engine/app/routes/tasks.py - Project API routes → Identity and access: checks access
engine/app/routes/tasks.py - GitHub → GitHub ingestion: sends push events
- GitHub ingestion → Diff parsing: parses changes
engine/app/routes/github_webhook.py - GitHub ingestion → Conflict detection: checks conflicts
engine/app/routes/github_webhook.py - GitHub ingestion → Reasoning and retrieval: summarizes changes
engine/app/routes/github_webhook.py - GitHub ingestion → Database sessions: writes records
engine/app/routes/github_webhook.py - MCP interface → Coordination services: uses services
engine/app/mcp_server.py - MCP interface → Database sessions: uses database
engine/app/mcp_server.py - Database sessions → Domain records: loads records
- Database sessions → PostgreSQL: connects
engine/app/db/session.py - HTTP route assembly → Server handlers: provides handlers
opencode-plugin/opencode/packages/server/src/routes.ts - Terminal interface → Terminal routing: uses routing
opencode-plugin/opencode/packages/tui/src/app.tsx