How gzukas/heropad works
Main Components
a) Frontend Layer (apps/web):
• Client Application (React)
• State Management (Jotai atoms)
• UI Components (Material UI)
• Routing (Tanstack Router)
• Internationalization (Lingui)
• Graph Visualization (Sigma.js/Graphology)
• Virtual Lists (Tanstack Virtual)
b) Backend Layer (apps/api):
• API Server (Fastify)
• tRPC Router
• Query Layer (Kysely)
• Input Validation (TypeBox)
• Avatar Generation (DiceBear)
c) Database Layer:
• PostgreSQL Database (Supabase)
• Migrations
• Search functionality
[Client Layer]
• ↕
[Server Layer]
• ↕
[Database Layer]
Component Relationships
• tRPC communication between frontend and backend
• Database queries from the backend
• State management flow in the frontend
• Avatar generation requests
• Search data flow
• Graph data processing pipeline
Detailed Component Breakdown
Frontend (apps/web):
[React Application]
• ↓
[State Management]
• Graph Atom
• Search Atoms
• Locale Atoms
• UI State Atoms
• ↓
[UI Components]
• Sociogram
• Search
• Hero Profile
• Awards List
Backend (apps/api):
[Fastify Server]
• ↓
[tRPC Router]
• Award Routes
• Hero Routes
• Graph Routes
• Search Routes
• ↓
[Database Layer]
• Kysely Queries
• Migrations
[Database] → [Graph Data] → [Graphology] → [Sigma.js] → [Rendered Sociogram]
[Search Input] → [Debounced State] → [tRPC Query] → [Database Search] → [Results]
Infrastructure Elements
Include:
• Supabase hosting
• Database migrations
• Build pipeline
• Testing infrastructure
Notes for Implementation
• Related components in containers
• Annotations for key features like virtualization and internationalization
• The typesafe nature of the stack (TypeScript throughout)
• The real-time interaction capabilities
• The separation of concerns between layers
• The state management flow
• The graph visualization pipeline
Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make Heropad unique, such as its graph visualization capabilities and social relationship mapping.