# federicocalonso/iebasuite architecture

> Architecture diagram of the GitHub repository federicocalonso/iebasuite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/federicocalonso/iebasuite
- Repository: https://github.com/federicocalonso/iebasuite

## Overview

1. **What this repo is**
   - This is a **React + TypeScript SPA built with Vite** for electrical/technical field work.
   - The product is organized as a **hub of modules**: client management, project management, and multiple technical tools that are either available or planned.
   - The current implemented focus is on **“Mis Clientes”** and **“Gestión de Proyectos / Relevador de Planta”**; many other modules in the README are future placeholders.

2. **Top-level application shape**
   - The app starts in `src/main.tsx` and is wired through a **core shell/router layer** in `src/core`.
   - The `HubShell`, `HubRouter`, `HubHome`, and `HubProjects` components suggest a **multi-screen application shell** rather than a single-purpose editor.
   - `LoginScreen` and `AuthContext` indicate that access is gated by authentication, while `ClientContext`, `ProjectContext`, `ProfileContext`, and `SymbolsContext` provide shared domain state across screens.

3. **Primary user-facing subsystems**
   - **Client management**: handled by the `HubClients` area and the `projects/` components indirectly through shared project/customer data.
   - **Project management**: `HubProjects`, `ProjectList`, `ProjectItem`, `ProjectHeader`, and `ProjectConfigDialog` manage the lifecycle of a project/obra.
   - **Technical editor**: `src/screens/EditorScreen.tsx` plus the `editor/` component set form the main workbench for drawing and configuring a project’s physical installation.
   - **Future modules**: the README lists several upcoming product lines such as pricing, unifilar, compliance forms, grounding, differential tests, thermography, power quality, and low-voltage systems.

4. **Editor architecture**
   - The editor is split into a **layout shell** (`EditorLayout`) and a **guided creation flow overlay** (`CreationFlowOverlay`), which implies a step-based onboarding/configuration experience.
   - The editor uses **tabbed domain sections** in `src/components/editor/tabs/`: general, project, walls, openings, circuits, connections, coverage, electrical, and master configuration.
   - This indicates the editor is not just a canvas; it is a **structured project model editor** where geometry, electrical data, and coverage rules are edited in separate bounded areas.

5. **Domain-specific visual components**
   - The component set in `src/components/` reflects the object model of the application: `WallCard`, `OpeningCard`, `CircuitoCard`, `ConexionCard`, `ElectricalCard`, `NetlistReport`, `MasterView`, `Preview`, and `SymbolDialog`.
   - These components suggest the UI is centered around **cards/forms for each domain entity**, plus a **preview/reporting layer** for inspection and output.
   - `SymbolManagerDialog` and `SymbolDialog` point to a **symbol library** used by the editor and project rendering.

6. **State and data flow**
   - The core state flow appears to be: **Firebase-backed services → contexts → hooks → components**.
   - `src/hooks/` centralizes interaction patterns such as editor state, app actions, zoom/pan, toast notifications, project installation, and project list loading.
   - `useEditorState`, `useAppActions`, and `useUIState` likely separate **domain editing**, **command execution**, and **presentation state** so the editor remains manageable.

7. **Backend and persistence boundaries**
   - The `src/firebase/` folder contains `clientService`, `profileService`, `projectService`, and `symbolService`, which are the main persistence boundary.
   - `firebase/config.ts` indicates **Firebase is the external backend**, likely handling auth plus project/client/symbol storage.
   - `ClientContext` and `ProjectContextCore` likely wrap these services so UI components do not talk to Firebase directly.

8. **Rendering and geometry pipeline**
   - `src/lib/geometry.ts`, `layout.ts`, `renderer.ts`, and `symbols.ts` are the computational core for the editor.
   - This suggests a pipeline where the application **transforms project data into layout/geometry structures and then into rendered visuals or reports**.
   - `src/types/measurements.ts`, `project.ts`, `reports.ts`, `symbols.ts`, `ui.ts`, and `user.ts` define the shared contract between the backend, editor, and reporting layers.

9. **PWA / offline and deployment characteristics**
   - The presence of `public/manifest.json`, `public/icons/`, and generated service worker files in `dev-dist/` indicates the app is built as a **PWA-capable static frontend**.
   - `useProjectInstallation` and the service worker assets imply support for **installable/offline-friendly behavior**.
   - `.github/workflows/deploy.yaml` points to a **CI/CD deployment of the static build**.

10. **UI system and composition**
   - The UI is organized into reusable primitives in `src/components/shared/` and styling in `src/styles/`.
   - There is a clear distinction between **shared modal/form infrastructure** and **domain-specific cards/dialogs**.
   - This means the architecture favors **composition over monolithic screens**, with domain screens built from shared dialogs, form fields, and cards.

11. **Feature segmentation and readiness**
   - The README’s status column shows the repo is structured as a **platform** with multiple product modules, but only some are implemented today.
   - The existing codebase mainly supports the **project/client/editor workflow**, while other compliance/reporting tools are planned but not yet part of the main runtime path.
   - For an architecture diagram, it would be accurate to show those future modules as **planned branches off the same hub**, not as active execution paths.

12. **How the main runtime likely works**
   - User logs in through the auth layer.
   - The hub loads client/project lists from Firebase-backed services.
   - Selecting or creating a project opens the editor shell.
   - The editor builds up the project via tabs, dialogs, and cards, using shared state hooks and geometry/rendering helpers.
   - Project artifacts and configuration are persisted back through the Firebase service layer, with the UI reflecting changes via contexts and hooks.

Main entry points: [`src/components/editor/EditorLayout.tsx`](https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/EditorLayout.tsx) (Editor Layout), [`src/lib/geometry.ts`](https://github.com/federicocalonso/iebasuite/blob/main/src/lib/geometry.ts) (Geometry Core), [`src/core/HubShell.tsx`](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubShell.tsx) (Hub Shell), [`src/core/HubProjects.tsx`](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubProjects.tsx) (Projects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_shell["App Shell"]
  node_node_main(("Main<br/>entry<br/>[main.tsx]"))
  node_node_router["Router<br/>navigation<br/>[HubRouter.tsx]"]
  node_node_shell["Hub Shell<br/>[HubShell.tsx]"]
  node_node_auth["Auth<br/>access<br/>[AuthContext.tsx]"]
  node_node_login["Login<br/>screen<br/>[LoginScreen.tsx]"]
  node_node_home["Hub Home<br/>screen<br/>[HubHome.tsx]"]
end

subgraph group_group_operations["Operations"]
  node_node_clients["Clients<br/>screen<br/>[HubClients.tsx]"]
  node_node_projects["Projects<br/>screen<br/>[HubProjects.tsx]"]
  node_node_project_list["Project List<br/>[ProjectList.tsx]"]
  node_node_project_header["Project Header<br/>ui<br/>[ProjectHeader.tsx]"]
  node_node_project_item["Project Item<br/>ui<br/>[ProjectItem.tsx]"]
  node_node_future_tools["Future Tools<br/>planned modules<br/>[RelevadorTool.tsx]"]
end

subgraph group_group_editor["Editor Workbench"]
  node_node_editor_screen["Editor Screen<br/>[EditorScreen.tsx]"]
  node_node_editor_layout["Editor Layout<br/>shell<br/>[EditorLayout.tsx]"]
  node_node_creation_flow["Creation Flow<br/>workflow"]
  node_node_editor_tabs["Editor Tabs<br/>sections<br/>[GeneralTab.tsx]"]
  node_node_domain_cards["Domain Cards<br/>forms<br/>[WallCard.tsx]"]
  node_node_preview_report["Preview & Report<br/>output<br/>[Preview.tsx]"]
  node_node_symbols["Symbols<br/>[SymbolDialog.tsx]"]
end

subgraph group_group_platform["Platform"]
  node_node_contexts["Contexts<br/>state"]
  node_node_hooks["Hooks<br/>state<br/>[useEditorState.ts]"]
  node_node_services[("Firebase Services<br/>persistence<br/>[projectService.ts]")]
  node_node_geometry{{"Geometry Core<br/>compute<br/>[geometry.ts]"}}
  node_node_types["Types<br/>contracts<br/>[project.ts]"]
  node_node_pwa["PWA Assets<br/>delivery<br/>[manifest.json]"]
  node_node_deploy["Deploy<br/>ci<br/>[deploy.yaml]"]
end

node_node_main -->|"boots"| node_node_router
node_node_router -->|"gates"| node_node_auth
node_node_auth -->|"shows"| node_node_login
node_node_auth -->|"unlocks"| node_node_shell
node_node_shell -->|"hosts"| node_node_home
node_node_shell -->|"opens"| node_node_clients
node_node_shell -->|"opens"| node_node_projects
node_node_projects -->|"contains"| node_node_project_list
node_node_projects -->|"contains"| node_node_project_header
node_node_project_list -->|"renders"| node_node_project_item
node_node_project_list -->|"opens"| node_node_editor_screen
node_node_editor_screen -->|"wraps"| node_node_editor_layout
node_node_editor_layout -->|"overlays"| node_node_creation_flow
node_node_editor_layout -->|"organizes"| node_node_editor_tabs
node_node_editor_layout -->|"composes"| node_node_domain_cards
node_node_editor_layout -->|"shows"| node_node_preview_report
node_node_editor_layout -->|"uses"| node_node_symbols
node_node_editor_tabs -->|"feeds"| node_node_geometry
node_node_domain_cards -->|"feeds"| node_node_geometry
node_node_preview_report -->|"reads"| node_node_geometry
node_node_contexts -->|"wraps"| node_node_services
node_node_hooks -->|"consumes"| node_node_contexts
node_node_hooks -->|"drives"| node_node_geometry
node_node_services -->|"persists"| node_node_types
node_node_geometry -->|"uses"| node_node_types
node_node_symbols -->|"loads"| node_node_services
node_node_pwa -->|"delivered by"| node_node_deploy
node_node_future_tools -.->|"branches from"| node_node_home
node_node_future_tools -.->|"shares data"| node_node_projects

click node_node_main "https://github.com/federicocalonso/iebasuite/blob/main/src/main.tsx"
click node_node_router "https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubRouter.tsx"
click node_node_shell "https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubShell.tsx"
click node_node_auth "https://github.com/federicocalonso/iebasuite/blob/main/src/core/AuthContext.tsx"
click node_node_login "https://github.com/federicocalonso/iebasuite/blob/main/src/core/LoginScreen.tsx"
click node_node_home "https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubHome.tsx"
click node_node_clients "https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubClients.tsx"
click node_node_projects "https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubProjects.tsx"
click node_node_project_list "https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectList.tsx"
click node_node_project_header "https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectHeader.tsx"
click node_node_project_item "https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectItem.tsx"
click node_node_editor_screen "https://github.com/federicocalonso/iebasuite/blob/main/src/screens/EditorScreen.tsx"
click node_node_editor_layout "https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/EditorLayout.tsx"
click node_node_creation_flow "https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/CreationFlowOverlay.tsx"
click node_node_editor_tabs "https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/tabs/GeneralTab.tsx"
click node_node_domain_cards "https://github.com/federicocalonso/iebasuite/blob/main/src/components/WallCard.tsx"
click node_node_preview_report "https://github.com/federicocalonso/iebasuite/blob/main/src/components/Preview.tsx"
click node_node_symbols "https://github.com/federicocalonso/iebasuite/blob/main/src/components/SymbolDialog.tsx"
click node_node_contexts "https://github.com/federicocalonso/iebasuite/blob/main/src/core/ProjectContextCore.tsx"
click node_node_hooks "https://github.com/federicocalonso/iebasuite/blob/main/src/hooks/useEditorState.ts"
click node_node_services "https://github.com/federicocalonso/iebasuite/blob/main/src/firebase/projectService.ts"
click node_node_geometry "https://github.com/federicocalonso/iebasuite/blob/main/src/lib/geometry.ts"
click node_node_types "https://github.com/federicocalonso/iebasuite/blob/main/src/types/project.ts"
click node_node_pwa "https://github.com/federicocalonso/iebasuite/blob/main/public/manifest.json"
click node_node_deploy "https://github.com/federicocalonso/iebasuite/blob/main/.github/workflows/deploy.yaml"
click node_node_future_tools "https://github.com/federicocalonso/iebasuite/blob/main/src/features/relevador/RelevadorTool.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_router,node_node_shell,node_node_auth,node_node_login,node_node_home toneBlue
class node_node_clients,node_node_projects,node_node_project_list,node_node_project_header,node_node_project_item,node_node_future_tools toneAmber
class node_node_editor_screen,node_node_editor_layout,node_node_creation_flow,node_node_editor_tabs,node_node_domain_cards,node_node_preview_report,node_node_symbols toneMint
class node_node_contexts,node_node_hooks,node_node_services,node_node_geometry,node_node_types,node_node_pwa,node_node_deploy toneRose
```

## Components

### App Shell

Entry, authentication, routing, and hub screens.

- [Main](https://github.com/federicocalonso/iebasuite/blob/main/src/main.tsx): entry · Vite/React bootstrap into the app. · `src/main.tsx`
- [Router](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubRouter.tsx): navigation · Top-level route and screen selection. · `src/core/HubRouter.tsx`
- [Hub Shell](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubShell.tsx): shell · Application frame and shared navigation chrome. · `src/core/HubShell.tsx`
- [Auth](https://github.com/federicocalonso/iebasuite/blob/main/src/core/AuthContext.tsx): access · Authentication gate and login screen. · `src/core/AuthContext.tsx`
- [Login](https://github.com/federicocalonso/iebasuite/blob/main/src/core/LoginScreen.tsx): screen · Sign-in entry screen. · `src/core/LoginScreen.tsx`
- [Hub Home](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubHome.tsx): screen · Landing area for module selection. · `src/core/HubHome.tsx`

### Operations

Client and project management surfaces.

- [Clients](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubClients.tsx): screen · Client management hub. · `src/core/HubClients.tsx`
- [Projects](https://github.com/federicocalonso/iebasuite/blob/main/src/core/HubProjects.tsx): screen · Project list and project lifecycle hub. · `src/core/HubProjects.tsx`
- [Project List](https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectList.tsx): list · Selectable project collection and listing UI. · `src/components/projects/ProjectList.tsx`
- [Project Header](https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectHeader.tsx): ui · Project summary and actions header. · `src/components/projects/ProjectHeader.tsx`
- [Project Item](https://github.com/federicocalonso/iebasuite/blob/main/src/components/projects/ProjectItem.tsx): ui · Single project row/card representation. · `src/components/projects/ProjectItem.tsx`
- [Future Tools](https://github.com/federicocalonso/iebasuite/blob/main/src/features/relevador/RelevadorTool.tsx): planned modules · Planned product branches such as pricing, unifilar, compliance, grounding, and testing tools. · `src/features/relevador/RelevadorTool.tsx`

### Editor Workbench

Project modeling, drawing, and technical review.

- [Editor Screen](https://github.com/federicocalonso/iebasuite/blob/main/src/screens/EditorScreen.tsx): screen · Main technical workbench for a project. · `src/screens/EditorScreen.tsx`
- [Editor Layout](https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/EditorLayout.tsx): shell · Editor frame and content composition. · `src/components/editor/EditorLayout.tsx`
- [Creation Flow](https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/CreationFlowOverlay.tsx): workflow · Guided setup overlay for new project creation. · `src/components/editor/CreationFlowOverlay.tsx`
- [Editor Tabs](https://github.com/federicocalonso/iebasuite/blob/main/src/components/editor/tabs/GeneralTab.tsx): sections · Bounded editing areas for the project model. · `src/components/editor/tabs/GeneralTab.tsx`
- [Domain Cards](https://github.com/federicocalonso/iebasuite/blob/main/src/components/WallCard.tsx): forms · Entity-specific cards and dialogs for walls, openings, circuits, connections, and electrical data. · `src/components/WallCard.tsx`
- [Preview & Report](https://github.com/federicocalonso/iebasuite/blob/main/src/components/Preview.tsx): output · Visual preview and netlist/report inspection. · `src/components/Preview.tsx`
- [Symbols](https://github.com/federicocalonso/iebasuite/blob/main/src/components/SymbolDialog.tsx): library · Symbol selection and management for editor rendering. · `src/components/SymbolDialog.tsx`

### Platform

Persistence, shared state, geometry, and PWA/deployment support.

- [Contexts](https://github.com/federicocalonso/iebasuite/blob/main/src/core/ProjectContextCore.tsx): state · Shared app/domain state for auth, clients, projects, profiles, and symbols. · `src/core/ProjectContextCore.tsx`
- [Hooks](https://github.com/federicocalonso/iebasuite/blob/main/src/hooks/useEditorState.ts): state · Editing, UI, zoom/pan, toast, and project-loading orchestration hooks. · `src/hooks/useEditorState.ts`
- [Firebase Services](https://github.com/federicocalonso/iebasuite/blob/main/src/firebase/projectService.ts): persistence · Backend boundary for client, profile, project, and symbol storage. · `src/firebase/projectService.ts`
- [Geometry Core](https://github.com/federicocalonso/iebasuite/blob/main/src/lib/geometry.ts): compute · Layout, geometry, rendering, and symbol computation pipeline. · `src/lib/geometry.ts`
- [Types](https://github.com/federicocalonso/iebasuite/blob/main/src/types/project.ts): contracts · Shared domain contracts for projects, measurements, reports, symbols, UI, and users. · `src/types/project.ts`
- [PWA Assets](https://github.com/federicocalonso/iebasuite/blob/main/public/manifest.json): delivery · Manifest, icons, and service worker assets for installable/offline behavior. · `public/manifest.json`
- [Deploy](https://github.com/federicocalonso/iebasuite/blob/main/.github/workflows/deploy.yaml): ci · CI workflow for static build deployment. · `.github/workflows/deploy.yaml`

## Connections

- Main → Router: boots · App bootstrap hands control to routing.
- Router → Auth: gates · Routing is wrapped by authentication.
- Auth → Login: shows · Unauthenticated users land on login.
- Auth → Hub Shell: unlocks · Authenticated access enters the shell.
- Hub Shell → Hub Home: hosts · The shell provides the main landing area.
- Hub Shell → Clients: opens · Shell routes into client management.
- Hub Shell → Projects: opens · Shell routes into project management.
- Projects → Project List: contains · Project screen is centered on list selection.
- Projects → Project Header: contains · Project screen includes summary/actions header.
- Project List → Project Item: renders · Project list is composed of project items.
- Project List → Editor Screen: opens · Selecting a project leads to the editor.
- Editor Screen → Editor Layout: wraps · Editor screen is structured by the editor layout.
- Editor Layout → Creation Flow: overlays · Creation flow guides initial project setup.
- Editor Layout → Editor Tabs: organizes · Tabbed sections organize the project model.
- Editor Layout → Domain Cards: composes · Layout combines entity cards and dialogs.
- Editor Layout → Preview & Report: shows · Layout includes preview and reporting output.
- Editor Layout → Symbols: uses · Editor consumes the symbol library.
- Editor Tabs → Geometry Core: feeds · Tab edits drive layout and geometry computation.
- Domain Cards → Geometry Core: feeds · Entity edits update derived geometry and electrical structure.
- Preview & Report → Geometry Core: reads · Preview/report output is produced from computed structures.
- Contexts → Firebase Services: wraps · Contexts mediate backend services.
- Hooks → Contexts: consumes · Hooks operate on shared domain state.
- Hooks → Geometry Core: drives · Editor and UI hooks coordinate computed views.
- Firebase Services → Types: persists · Backend data is shaped by shared contracts.
- Geometry Core → Types: uses · Computation layer relies on shared domain types.
- Symbols → Firebase Services: loads · Symbol management persists through Firebase services.
- PWA Assets → Deploy: delivered by · PWA assets are included in the static deployment.
- Future Tools → Hub Home: branches from · Planned modules sit beside the core hub.
- Future Tools → Projects: shares data · Future tools are expected to reuse project context.
