How franciscoaraujo/investwise-manager works
Main Components
• User Interface (UI) Layer – This includes all the React components found in the “src/components” directory as well as pages (under “src/pages”) that are responsible for rendering different screens (like “fundos”, “cotistas”, “direitos”, “operacoes”) and layout components (e.g., Layout.tsx, Sidebar.tsx, ThemeToggle.tsx).
• Domain/Business Logic – The “src/domain” folder (with its subdirectories like “fundos”) contains the domain types and logic for handling core business concepts. This layer represents your application’s data models, types, and any domain-specific rules.
• Application Layer – The “src/application” directory, including hooks such as “useFundos.ts”, encapsulates logic for orchestrating UI interactions and domain operations. This acts as a mediator between presentation and underlying services.
• Infrastructure/API Layer – Within “src/infrastructure/api” you have modules such as “config.ts” and “fundos-service.ts”, which handle API requests and external data interactions.
• Utility Modules – The “src/lib” directory (e.g., utils.ts) holds shared helper functions used throughout the project.
• Styling & Configuration – Tools like Tailwind (configured via tailwind.config.ts), shadcn-ui components, and Vite (configured through vite.config.ts) indicate that the project uses best-in-class practices for styling and build optimization.
Relationships and Data Flow
• User Input is received via the UI (React components/pages) and then passed to the corresponding Application layer (e.g., custom hooks or context providers in “src/contexts”).
• The Application layer orchestrates interactions with the Domain layer (which holds the business rules) and the Infrastructure layer to fetch or update data.
• API calls flow between the front-end (handled by the “src/infrastructure/api” components) and external services or back-end endpoints.
• Shared utilities and context providers (e.g., Themes via “ThemeContext.tsx”) support cross-component behaviors and styling logic.
Architectural Patterns & Design Principles
• Separation of Concerns – Clear decoupling between UI components, domain/business logic, and API/infrastructure code.
• Component-Based Architecture – With React, components are modularized extensively (see “src/components/ui” for many reusable UI pieces).
• Hooks and Context – Custom hooks (e.g., “useToast”, “useFundos”, “use-mobile”) and context files help maintain state and functionality across components.
• Single-Page Application (SPA) design – The “src/pages” structure indicates routing and different views for the user.
Final Touches
• Don't over-simplify: capturing the multitude of components (e.g., the comprehensive list of UI components in “src/components/ui”) provides an accurate overview.