How gentleman-programming/gentlemanclass_hexagonalarchitecture works
Project type and purpose
• This is a full-stack sample application demonstrating Hexagonal (Ports & Adapters) architecture in TypeScript.
• The src folder contains a React/TSX frontend (Vite-powered) and two “hexagonal” backend modules under src/services/:
• dashboard-api – the HTTP/TRPC-exposed API
• repository – the domain/service layer for user data
File structure
• Top-level: index.html, src/main.tsx, React components (Login.tsx, Register.tsx), and trpc.tsx for client-side TRPC setup.
• src/services/dashboard-api:
• server.ts – entry point that spins up a TRPC/HTTP server
• app/ – core business logic (dashboard-api.ts) and composition-root.ts wiring interfaces to adapters
• ports/ – Port interfaces:
– drivers (inbound) for authenticating requests
– drivens (outbound) for repo-querying and control-authenticating
• adapters/ – Concrete implementations of ports:
– drivers side (e.g. auth-trpc-adapter.ts)
– drivens side (e.g. stub or local repo-query adapters)
• src/services/repository:
• Same hexagonal structure but focused on user persistence/monitoring
• No HTTP server here – it’s consumed by dashboard-api via its ports/adapters
README
• Confirms this is an example of Hexagonal Architecture (Ports & Adapters).
• Emphasizes use of interfaces (ports) and their implementors (adapters) to decouple business logic from I/O.
Important details
• Ports and adapters even if currently stubbed
• Composition Root as the central wiring inside each hexagon
• That repository is an internal module consumed by dashboard-api, not directly exposed over HTTP