How calebj0seph/fabra-prototype works
Fabra is a 3D product-editor prototype for designing a shirt: a user signs in, opens or creates a design file, edits shirt parts and materials in the 3D editor, and saves assignments to that file. Account registration and login, authenticated file browsing, and the editor’s model, camera, lighting, and material-texture layers are distinct product areas. The graph follows relationships shown in the README, SOURCE INDEX, and excerpts; unsampled subsystem details and uncertain links are omitted.
Main entry points: editor.tsx Editor entry point · queries.ts Account and file queries · actions.ts File actions · page.tsx Design file listing
Components 29
Accounts and auth
- Account registration
src/app/api/register_account/route.ts - Login form
src/app/login/login-form.tsx - Auth endpoint
src/app/api/auth/route.ts - Session middleware
src/middleware.ts - User lookup
src/lib/auth/utils.ts - Login actions
src/lib/auth/actions.ts
Design files
- Account and file queries
src/lib/db/queries.ts - Application database
src/lib/db/setup.ts - Design file listing
src/app/files/page.tsx - File list
src/app/files/files-list.tsx - Create file control
src/app/files/create-file-button.tsx - File actions
src/lib/files/actions.ts - Design editor page
src/app/files/[fileId]/page.tsx - File controls
src/app/files/[fileId]/file-controls.tsx - Saved file data
src/lib/db/queries.ts
3D editor
- Editor entry point
src/editor/editor.tsx - Part and material selection
src/editor/ui/selection-editor.tsx - Selection pickers
src/editor/ui/material-picker.tsx - Part picker
src/editor/ui/part-picker.tsx - Selection state
src/editor/ui/state.ts - Camera controls
src/editor/camera-controls.tsx - Scene lighting
src/editor/lighting.tsx
Model and materials
- Model registry
src/editor/models/models.ts - Shirt model
src/editor/models/shirt.tsx - Model part definitions
src/editor/models/types.ts - Textured materials
src/editor/materials/material-with-textures.tsx - Material catalog
src/editor/materials/materials.ts - Material cloning
src/editor/materials/use-cloned-material.ts
Other components
- App user
Connections 41
- App user → Account registration: registers
README.md - Account registration → Account and file queries: creates account
src/app/api/register_account/route.ts - App user → Login form: submits credentials
src/app/login/login-form.tsx - Login form → Login actions: invokes
src/app/login/login-form.tsx - Login actions → Account and file queries: authenticates
src/lib/auth/actions.ts - Auth endpoint → Account and file queries: authenticates
src/app/api/auth/route.ts - Session middleware → Auth endpoint: checks session
- Session middleware → App user: redirects unauthenticated
- Design file listing → User lookup: gets current user
src/app/files/page.tsx - Design file listing → Account and file queries: loads user files
src/app/files/page.tsx - Design file listing → File list: renders
src/app/files/page.tsx - Design file listing → Create file control: renders
src/app/files/page.tsx - App user → Create file control: creates design
- Create file control → File actions: invokes
src/app/files/create-file-button.tsx - File actions → User lookup: gets current user
src/lib/files/actions.ts - File actions → Account and file queries: creates or updates file
src/lib/files/actions.ts - Design editor page → User lookup: checks user
src/app/files/[fileId]/page.tsx - Design editor page → Account and file queries: loads file
src/app/files/[fileId]/page.tsx - Design editor page → Editor entry point: renders editor
src/app/files/[fileId]/page.tsx - Design editor page → File controls: renders controls
src/app/files/[fileId]/page.tsx - File controls → File actions: updates file
src/app/files/[fileId]/file-controls.tsx - Editor entry point → File actions: saves assignments
src/editor/editor.tsx - File actions → Saved file data: writes file data
src/lib/files/actions.ts - Account and file queries → Application database: queries
src/lib/db/queries.ts - Design file listing → Editor entry point: opens saved design
- Editor entry point → Camera controls: renders
src/editor/editor.tsx - Editor entry point → Scene lighting: renders
src/editor/editor.tsx - Editor entry point → Part and material selection: renders
src/editor/editor.tsx - Editor entry point → Selection state: reads selection state
src/editor/editor.tsx - Editor entry point → Model registry: selects model
src/editor/editor.tsx - Model registry → Shirt model: registers model
src/editor/models/models.ts - Editor entry point → Shirt model: renders model
src/editor/editor.tsx - Shirt model → Textured materials: applies textures
src/editor/models/shirt.tsx - Textured materials → Material catalog: gets texture URLs
src/editor/materials/material-with-textures.tsx - Textured materials → Material cloning: clones base material
src/editor/materials/material-with-textures.tsx - Part and material selection → Selection pickers: renders
src/editor/ui/selection-editor.tsx - Part and material selection → Part picker: renders
src/editor/ui/selection-editor.tsx - Part and material selection → Model part definitions: uses part definitions
src/editor/ui/selection-editor.tsx - Camera controls → Selection state: tracks selected part
src/editor/camera-controls.tsx - Camera controls → Model part definitions: uses camera positions
src/editor/camera-controls.tsx - Shirt model → Model part definitions: defines model parts
src/editor/models/shirt.tsx