How alex-wang101/vibeboard works
1. Monorepo shape
- The repository is split into four deployable parts: frontend/ (product app), backend/ (Express API), landing/ (marketing site), and shared/ (common types/utilities).
- The main product architecture is a frontend + backend + Supabase + GitHub system; the landing site is mostly separate.
2. Frontend boundary
- frontend/ is a Next.js app that owns the user experience: authentication, project management, and the interactive architecture canvas.
- It uses React/React Flow for visualization, Zustand for canvas state, and a large set of UI primitives from shadcn-style components.
- Key UI areas are app/projects/* for project flows and components/canvas/* for the graph editor.
3. Authentication and session flow
- GitHub OAuth is handled in the frontend via NextAuth (app/api/auth/[...nextauth]/route.ts).
- The README indicates that after sign-in, the user is upserted into Supabase and their GitHub access token is stored encrypted; the raw token is never exposed to the browser.
- The frontend relies on session cookies and an API proxy rather than directly calling the backend with sensitive credentials.
4. Backend boundary
- backend/ is a separate Express service that contains the server-side integration logic.
- Its public routes are organized by domain: projects, scanner, github, and architecture.
- A GitHub-auth middleware sits in front of trusted routes, implying the backend expects a verified user identity forwarded from the frontend proxy.
5. Proxy/BFF pattern
- The frontend has app/api/proxy/[...path]/route.ts, which acts as a backend-for-frontend bridge.
- This proxy reads the authenticated session server-side and forwards a trusted user identifier to the Express API.
- This is the main trust boundary: the browser talks to Next.js; Next.js talks to Express on behalf of the user.
6. GitHub integration and scanning pipeline
- Backend services in backend/src/services/ include github.ts, scanner.ts, and classifier.ts.
- The flow is: resolve the user’s GitHub identity, fetch/decrypt the stored token from Supabase, interact with GitHub/Octokit, clone or inspect repositories, and scan source code with ts-morph.
- The output of that pipeline is an architecture model rather than raw source listings.
7. Architecture model and shared contract
- The central data contract is the ArchitectureGraph type, shared between frontend and backend via shared/.
- This graph represents hierarchical nodes such as pages, components, API routes, services, folders/files, and dependency edges between them.
- Because the same model is used for scanned repositories and blank-canvas design, it is the core object to show in any system diagram.
8. Persistence layer
- Supabase/Postgres is the main persistent store.
- Backend storage is abstracted behind backend/src/storage/*, with both a supabase-store and an in-memory store, suggesting the app can run with either persistent or ephemeral storage.
- Frontend migrations show the persisted entities likely include users, waitlist entries, projects, and project scans/architectures.
9. Project lifecycle
- The frontend’s project pages support creating and browsing projects, and each project can be associated with a repo scan or a hand-authored architecture board.
- Components like repo-picker, contributor-picker, and architecture-tree-widget indicate project metadata, repo selection, and collaborator management are first-class concepts.
- The backend routes likely supply CRUD and scan operations for these projects.
10. Canvas/editor subsystem
- The canvas is a substantial client-side subsystem built on React Flow.
- It includes node types for files, folders, and infrastructure, plus custom edges, breadcrumb navigation, hover previews, palettes, and detail panels.
- This subsystem consumes the ArchitectureGraph and renders/edit it interactively.
11. Storage of secrets and user identity
- shared/src/crypto.ts and the README point to AES-256-GCM encryption for access tokens.
- Supabase is therefore not just an app database; it also acts as the secure token store used by backend GitHub operations.
- The backend is the only place that decrypts and uses those tokens.
12. Landing site
- landing/ is a separate Next.js application for marketing and waitlist capture.
- It is not part of the core architecture editing/scanning path, but it is a distinct public-facing surface with its own deployable runtime.
13. What to draw as the main architecture
- The most important diagram should show: user browser → Next.js frontend/auth/proxy → Express backend → Supabase + GitHub.
- Inside the frontend, separate the auth/session layer from the canvas/project UI.
- Inside the backend, separate route handling from services (GitHub/scanner/classifier) and from storage.
- Treat shared/ as a compile-time contract layer that keeps the frontend and backend on the same ArchitectureGraph schema.
Main entry points: page.tsx Product app · index.ts API server · github.ts GitHub service · supabase-store.ts Storage layer
Components 24
External
Users and third-party platforms outside the repo
- User browser · People using the product app and interacting with the canvas
Frontend
Next.js product app and browser-side architecture editor
- Product app · Main Next.js application for authentication, projects, and editing
frontend/app/page.tsx - Auth route · GitHub OAuth session endpoint for sign-in and cookies
frontend/app/api/auth/[...nextauth]/route.ts - API proxy · Server-side bridge that forwards authenticated requests to the backend
frontend/app/api/proxy/[...path]/route.ts - Auth session · Client-side auth/session wiring used across the product app
frontend/providers/auth-provider.tsx - Projects UI · Project list, creation, repo selection, and project detail pages
frontend/app/projects/page.tsx - Canvas editor · Interactive architecture canvas and related controls
frontend/components/canvas/architecture-canvas.tsx - Canvas state · Client state for nodes, edges, selection, and editor interactions
frontend/stores/canvas-store.ts - Project widgets · Repo picker, contributor picker, and architecture tree widgets
frontend/components/projects/repo-picker.tsx - Graph utils · Frontend-side ArchitectureGraph helpers and save workflow
frontend/lib/architecture-graph.ts
Backend
Express API and integration services
- API server · Express service entrypoint that mounts all backend routes
backend/src/index.ts - GitHub auth · Trusted-route guard for requests forwarded from the frontend proxy
backend/src/middleware/github-auth.ts - Projects route · Project CRUD and project-scoped operations
backend/src/routes/projects.ts - Scanner route · Repository scanning and architecture extraction endpoint
backend/src/routes/scanner.ts - GitHub route · GitHub identity and repository integration endpoint
backend/src/routes/github.ts - Architecture route · Architecture model CRUD and retrieval endpoint
backend/src/routes/architecture.ts - GitHub service · Resolves user identity, accesses Octokit, and works with stored tokens
backend/src/services/github.ts - Scanner service · Clones or inspects repositories and scans source with ts-morph
backend/src/services/scanner.ts - Classifier · Classifies scanned files into architectural roles and hierarchies
backend/src/services/classifier.ts - Storage layer · Abstracted persistence with Supabase and in-memory implementations
backend/src/storage/supabase-store.ts - Supabase client · Server-side Supabase connection and access helpers
backend/src/lib/supabase.ts
Shared
Compile-time contract and cross-app utilities
- ArchitectureGraph · Shared data contract for scanned and hand-authored architecture graphs
shared/src/types.ts - Crypto · AES-256-GCM helpers for protecting GitHub access tokens
shared/src/crypto.ts
Landing
Separate marketing and waitlist site
- Landing site · Separate marketing and waitlist runtime
landing/app/page.tsx
Connections 29
- User browser → Product app: uses · Users interact with the product app in the browser
- Product app → Auth route: sign in · OAuth session creation happens through NextAuth
- Auth route → GitHub service: identity · Auth flow establishes the GitHub-linked user identity
- Product app → API proxy: api calls · Browser requests go to the Next.js proxy rather than directly to the backend
- API proxy → API server: forwards · Proxy forwards trusted user context to the Express API
- Auth session → Product app: session · Provides authenticated session state to the product UI
- Product app → Projects UI: projects · Project pages drive creation, browsing, and collaboration flows
- Projects UI → Project widgets: tools · Project flows use repo selection and collaborator widgets
- Product app → Canvas editor: edit · The main product surface is the architecture canvas
- Canvas editor → Canvas state: state · Canvas interactions are managed in Zustand state
- Canvas editor → ArchitectureGraph: renders · Canvas consumes the shared ArchitectureGraph schema
- Graph utils → ArchitectureGraph: uses · Frontend helpers operate on the shared graph model
- Graph utils → API proxy: save · Persisting edits typically goes through the authenticated proxy
- API server → GitHub auth: protects · Trusted routes are guarded before reaching domain handlers
- API server → Projects route: mounts · Project CRUD is exposed through route handlers
- API server → Scanner route: mounts · Scanning operations are exposed through route handlers
- API server → GitHub route: mounts · GitHub-related backend operations are exposed through route handlers
- API server → Architecture route: mounts · Architecture data is served through dedicated routes
- Projects route → Storage layer: persists · Projects are stored through the backend storage abstraction
- Architecture route → Storage layer: persists · Architecture records are saved and loaded through storage
- GitHub route → GitHub service: delegates · Route handlers delegate GitHub operations to services
- Scanner route → Scanner service: delegates · Scan requests enter the repository analysis pipeline
- Scanner service → Classifier: classifies · Scan output is organized into architectural roles and hierarchy
- Scanner service → GitHub service: fetches repo · Scanner uses GitHub access to inspect repositories
- GitHub service → Supabase client: loads token · GitHub integration reads stored user credentials from Supabase
- Storage layer → Supabase client: db · Supabase-backed persistence is one storage implementation
- GitHub service → Crypto: decrypts · Stored GitHub access tokens are decrypted before use
- Storage layer → ArchitectureGraph: stores graph · Persisted scans and boards use the shared ArchitectureGraph schema
- Product app → Landing site: separate site · Marketing and waitlist pages are a distinct runtime from the product app