# saulvvelazquez/metas-app-frontend architecture

> Architecture diagram of the GitHub repository saulvvelazquez/metas-app-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saulvvelazquez/metas-app-frontend
- Repository: https://github.com/saulvvelazquez/metas-app-frontend

## Overview

1. **Repository type and top-level shape**
   - This is a **React single-page frontend** for a personal goals system (“Metas App - Frontend”).
   - The repo is intentionally thin: most behavior lives in `src/`, with a small `public/` shell for the browser entry point and PWA metadata.

2. **Runtime boundary**
   - The app runs in the browser as a React application.
   - It depends on an external **FastAPI REST backend** at `http://localhost:8000` for all persistent data: users, metas, categories, and admin-facing operations.
   - There is no backend code in this repo; the frontend is the presentation and orchestration layer.

3. **Application bootstrap**
   - `src/index.js` is the entry point that mounts the React tree into `public/index.html`.
   - Global styling is split between `src/index.css` and component/page styles like `src/App.css`.
   - `src/reportWebVitals.js` and `src/setupTests.js` indicate standard Create React App conventions, with testing support in `src/App.test.js`.

4. **Central orchestration layer**
   - `src/App.js` is the main coordinator for the UI.
   - Based on the README and file layout, it likely controls:
     - current session state,
     - whether the user sees login/register or the main app,
     - role-based branching for **User** vs **Admin**,
     - top-level CRUD flows for metas and categories,
     - dashboard-level admin actions.
   - This is the key place to draw the boundary between “authenticated shell” and “authentication screens.”

5. **Authentication subsystem**
   - `src/Login.js` and `src/Register.js` are dedicated entry points for account access.
   - Authentication is session-like rather than token-based: the README says the app persists user identity in **localStorage**.
   - The frontend stores at least `user_id` and `rol`, and reuses them across requests and page refreshes.

6. **HTTP/API integration layer**
   - `src/api.js` is the shared API client and is architecturally important.
   - It centralizes Axios configuration and injects identity into request headers via an interceptor:
     - `x-user-id`
     - `x-rol`
   - This means the frontend does not send user identity in each payload; instead, identity is part of the request context, and the backend is expected to authorize based on headers.

7. **Goal management subsystem**
   - `src/components/MetaList.js` is the read/display layer for metas.
   - `src/components/MetaForm.js` is the create/edit layer, including validation such as date consistency and state/progress handling.
   - Together these components cover the core CRUD lifecycle for goals: list, create, update, delete, and status/progress display.

8. **Category management subsystem**
   - `src/components/CategoriaForm.js` handles creation of categories.
   - Categories are modeled as a relational concept, and the frontend reflects that by linking metas to categories rather than treating them as free text.
   - The category form is part of the admin-oriented data model setup rather than the everyday user flow.

9. **Editing and modal interaction**
   - `src/components/EditModal.js` suggests that edit operations are done in modal dialogs rather than dedicated routes.
   - This implies the UI is largely **single-view, state-driven**, with overlays/forms layered on top of lists instead of deep navigation.
   - For an architecture diagram, this is an important UI interaction boundary: list view -> modal form -> API update -> refreshed list.

10. **Data flow for normal users**
   - User opens the app → sees login/register if no session is stored.
   - After login, `App.js` loads the user context from localStorage and requests user-specific metas from the backend.
   - `MetaList.js` renders the metas, and `MetaForm.js` is used for create/update actions.
   - Each API call goes through `api.js`, which adds the identity headers automatically.

11. **Data flow for admin users**
   - If `rol` is `Admin`, `App.js` exposes extra capabilities.
   - The admin flow includes global visibility over data, user management, and category creation.
   - The README describes an admin dashboard concept, so the frontend likely switches between standard CRUD screens and higher-privilege views based on the stored role.

12. **Validation and business rules at the frontend**
   - The app enforces some business rules before or during submission:
     - date validation between start and limit dates,
     - automatic state updates when progress reaches 100%,
     - status categories such as “Pendiente”, “En Progreso”, and “Completado”.
   - These are client-side UX rules, but the backend should still be treated as the source of truth.

13. **Presentation and styling**
   - The README says the UI uses **Bootstrap 5** for responsive layout.
   - Styling is split between global CSS and component-specific CSS in `App.css`.
   - This is a view-layer concern only; it doesn’t affect data flow, but it shapes the screen structure for desktop/mobile.

14. **Testing and quality signals**
   - `App.test.js` plus `setupTests.js` indicate the repo has at least basic React test scaffolding.
   - There is no sign of a separate CI/CD or state-management framework in the tree, so the architecture is intentionally lightweight and component-driven.

15. **External dependencies and trust boundaries**
   - The critical external dependency is the FastAPI backend on port 8000.
   - The persistence layer is not in this repo; the README references **MySQL** behind the API.
   - The frontend trusts backend responses for domain data but carries role/session metadata locally, which is a notable security boundary for the architecture diagram.

Main entry points: [`src/App.js`](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/App.js) (App), [`src/api.js`](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/api.js) (API client), [`src/index.js`](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/index.js) (index.js), [`src/components/MetaForm.js`](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/MetaForm.js) (Meta form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_src["src"]
  node_node_index["index.js<br/>bootstrap<br/>[index.js]"]
  node_node_app["App<br/>orchestrator<br/>[App.js]"]
  node_node_api["API client<br/>http client<br/>[api.js]"]
  node_node_styles["CSS<br/>styling<br/>[index.css]"]
  node_node_appcss["App.css<br/>styling<br/>[App.css]"]
  node_node_tests["Test setup<br/>test scaffolding<br/>[setupTests.js]"]
  node_node_report["Vitals<br/>telemetry<br/>[reportWebVitals.js]"]
end

subgraph group_group_ui["UI flows"]
  node_node_login["Login<br/>auth screen<br/>[Login.js]"]
  node_node_register["Register<br/>auth screen<br/>[Register.js]"]
  node_node_metalist["Meta list<br/>goal list<br/>[MetaList.js]"]
  node_node_metaform["Meta form<br/>goal editor<br/>[MetaForm.js]"]
  node_node_editmodal["Edit modal<br/>overlay editor<br/>[EditModal.js]"]
  node_node_categoriaform["Category form<br/>category editor<br/>[CategoriaForm.js]"]
end

subgraph group_group_public["public"]
  node_node_public_html["index.html<br/>browser shell<br/>[index.html]"]
  node_node_manifest["manifest<br/>pwa metadata<br/>[manifest.json]"]
end

subgraph group_group_external["external"]
  node_node_backend[("FastAPI API<br/>backend service")]
  node_node_storage[("MySQL<br/>data store")]
end

node_node_index -->|"mounts into"| node_node_public_html
node_node_index -->|"starts"| node_node_app
node_node_app -->|"shows"| node_node_login
node_node_app -->|"shows"| node_node_register
node_node_app -->|"renders"| node_node_metalist
node_node_app -->|"opens"| node_node_metaform
node_node_app -->|"opens"| node_node_categoriaform
node_node_app -->|"uses"| node_node_editmodal
node_node_app -->|"calls"| node_node_api
node_node_login -->|"authenticates via"| node_node_api
node_node_register -->|"creates via"| node_node_api
node_node_metalist -->|"loads metas from"| node_node_api
node_node_metaform -->|"writes metas to"| node_node_api
node_node_categoriaform -->|"writes categories to"| node_node_api
node_node_editmodal -->|"contains"| node_node_metaform
node_node_api -->|"requests"| node_node_backend
node_node_backend -->|"persists to"| node_node_storage
node_node_app -->|"styles with"| node_node_styles
node_node_app -->|"styles with"| node_node_appcss
node_node_index -->|"can report"| node_node_report
node_node_index -->|"supports"| node_node_tests
node_node_app -->|"pairs with"| node_node_manifest

click node_node_index "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/index.js"
click node_node_app "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/App.js"
click node_node_api "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/api.js"
click node_node_login "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/Login.js"
click node_node_register "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/Register.js"
click node_node_metalist "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/MetaList.js"
click node_node_metaform "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/MetaForm.js"
click node_node_editmodal "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/EditModal.js"
click node_node_categoriaform "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/CategoriaForm.js"
click node_node_public_html "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/public/index.html"
click node_node_manifest "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/public/manifest.json"
click node_node_styles "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/index.css"
click node_node_appcss "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/App.css"
click node_node_tests "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/setupTests.js"
click node_node_report "https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/reportWebVitals.js"

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_index,node_node_app,node_node_api,node_node_styles,node_node_appcss,node_node_tests,node_node_report toneBlue
class node_node_login,node_node_register,node_node_metalist,node_node_metaform,node_node_editmodal,node_node_categoriaform toneAmber
class node_node_public_html,node_node_manifest toneMint
class node_node_backend,node_node_storage toneRose
```

## Components

### src

React application code and UI orchestration

- [index.js](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/index.js): bootstrap · Mounts the React app into the browser DOM · `src/index.js`
- [App](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/App.js): orchestrator · Top-level UI coordinator for session, role, and screen switching · `src/App.js`
- [API client](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/api.js): http client · Shared Axios client that injects user identity headers · `src/api.js`
- [CSS](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/index.css): styling · Global and app-level styles for layout and presentation · `src/index.css`
- [App.css](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/App.css): styling · Component-scoped application styling · `src/App.css`
- [Test setup](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/setupTests.js): test scaffolding · React test configuration and starter test coverage · `src/setupTests.js`
- [Vitals](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/reportWebVitals.js): telemetry · Web vitals reporting hook from the CRA toolchain · `src/reportWebVitals.js`

### UI flows

Authentication and goal management screens

- [Login](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/Login.js): auth screen · User sign-in entry point · `src/Login.js`
- [Register](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/Register.js): auth screen · Account creation entry point · `src/Register.js`
- [Meta list](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/MetaList.js): goal list · Displays metas and their current status or progress · `src/components/MetaList.js`
- [Meta form](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/MetaForm.js): goal editor · Creates and edits metas with client-side validation · `src/components/MetaForm.js`
- [Edit modal](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/EditModal.js): overlay editor · Modal container for inline edit actions · `src/components/EditModal.js`
- [Category form](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/src/components/CategoriaForm.js): category editor · Creates categories used to organize metas · `src/components/CategoriaForm.js`

### public

Browser shell and PWA assets

- [index.html](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/public/index.html): browser shell · Root HTML document that hosts the React mount point · `public/index.html`
- [manifest](https://github.com/saulvvelazquez/metas-app-frontend/blob/main/public/manifest.json): pwa metadata · Web app manifest for installable browser behavior · `public/manifest.json`

### external

Backend and browser services outside this repo

- **FastAPI API**: backend service · External REST backend providing persistence and authorization
- **MySQL**: data store · Persistent database used behind the backend API

## Connections

- index.js → index.html: mounts into · The React tree is rendered into the browser shell
- index.js → App: starts · Bootstraps the top-level application component
- App → Login: shows · Presents login when no session is available
- App → Register: shows · Presents registration for new accounts
- App → Meta list: renders · Main authenticated view for goal browsing
- App → Meta form: opens · Creates or updates metas from the shell
- App → Category form: opens · Exposes category creation in higher-privilege flows
- App → Edit modal: uses · Wraps edits in modal interactions
- App → API client: calls · Delegates all backend communication to the shared client
- Login → API client: authenticates via · Submits login requests through the API client
- Register → API client: creates via · Submits registration requests through the API client
- Meta list → API client: loads metas from · Fetches user or admin goal data
- Meta form → API client: writes metas to · Creates and updates goals through REST calls
- Category form → API client: writes categories to · Creates category records through REST calls
- Edit modal → Meta form: contains · Hosts the goal form for inline editing
- API client → FastAPI API: requests · Sends authorized HTTP requests to the external backend
- FastAPI API → MySQL: persists to · Backend stores domain data in MySQL
- App → CSS: styles with · Uses global application styles
- App → App.css: styles with · Uses component-level application styles
- index.js → Vitals: can report · Supports web vitals reporting
- index.js → Test setup: supports · Includes standard CRA test setup
- App → manifest: pairs with · Works alongside PWA metadata in the public shell
