How markogalarza/dsm-clase-hexagonal--2026 works
Project type & purpose (from tree + README)
This is a client-side React + TypeScript application built with Vite. There’s no explicit backend service in the repo; instead, persistence is abstracted behind a Repository pattern with at least two concrete implementations:
• FirebaseRepository (external cloud backend)
• LocalStorageRepository (in-browser persistence)
The domain appears centered on a “Product” feature with a clean separation into:
• domain/ (entities + repository interface)
• service/ (use-cases / application services)
• infrastructure/ (data access implementations)
• view/ (React UI screens)
That suggests a lightweight “clean architecture-ish” / layered feature module inside a SPA.
Browser Runtime
• React app (bundled by Vite)
• React rendering + events
External Services
• Firebase (DB/Auth/etc. — label only what you actually use)
Client-side Storage
• LocalStorage (key/value)
Key technologies to label:
• React, TypeScript
• Vite (build + dev server; clarify it’s build-time, not runtime in prod)
• UI events → React components
• Components → services (function calls)
• Services → repository interface (dependency)
• Repository implementation → Firebase SDK / LocalStorage API
• Vite dev server / bundler
• ESLint config
• tsconfig(s)
This helps distinguish *execution architecture* vs *engineering toolchain*.
Goal: This is where you “separate into as many components as possible” based on folders/files.
src/Product/ as a bounded context/module with 4 internal layers:
View layer (src/Product/view/)
• ProductsView.tsx
• NewProductView.tsx
• EditProductView.tsx
• UI composition
• User input handling
• Calls application services
• Views → Services (calls)
Service layer (src/Product/service/)
• productsService.tsx (list/fetch use-case)
• newProductService.tsx (create use-case)
• editProductService.tsx (update use-case)
Responsibilities:
• Orchestrate use-cases
• Validation / mapping (if any)
• Choose repository methods
• Services → Domain repository interface
Domain layer (src/Product/domain/)
• Product.tsx (domain model/entity)
• ProductRepository.tsx (interface/port)
Responsibilities:
• Domain types + invariants (if present)
• Contract for persistence
• Domain types used by Services and Repositories
• Repository interface implemented by Infrastructure
Infrastructure layer (src/Product/infrastructure/)
• FirebaseRepository.tsx (adapter)
• LocalStorageRepository.tsx (adapter)
Responsibilities:
• Implement ProductRepository
• Translate domain objects ↔ storage formats
• Call Firebase SDK or LocalStorage APIs
• FirebaseRepository → Firebase service
• LocalStorageRepository → Browser LocalStorage
• “Repository wiring” → selects which implementation is used by services (either via import, config, or factory)
App composition (src/main.tsx, src/App.tsx)
Outside the Product module, show:
• main.tsx (React bootstrap/root render)
• App.tsx (top-level routing/composition)
• main.tsx → App.tsx
• App.tsx → Product Views
Relationships & interactions to highlight (data flow)
At least one explicit “happy path” flow annotation, e.g. “Create product”:
Concrete repo
• LocalStorageRepository writes to LocalStorage, or
• FirebaseRepository writes to Firebase
Architectural patterns/design principles present (and worth diagramming)
• Layered architecture within a feature module (view → service → domain → infrastructure)
• Ports & adapters / repository pattern
• Domain defines ProductRepository (port)
• Infrastructure implements it (adapters)
• Replaceable persistence
System Context: User ↔ SPA ↔ (Firebase, LocalStorage)
3. Component (Product module): View/Service/Domain/Infrastructure split with concrete file names as nodes
This approach stays maximally faithful to the repo structure while being detailed enough to capture the essential architectural elements without overthinking it.