How saulvvelazquez/metas-app-frontend works
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: App.js App · api.js API client · index.js index.js · MetaForm.js Meta form
Components 17
src
React application code and UI orchestration
- index.js · Mounts the React app into the browser DOM
src/index.js - App · Top-level UI coordinator for session, role, and screen switching
src/App.js - API client · Shared Axios client that injects user identity headers
src/api.js - CSS · Global and app-level styles for layout and presentation
src/index.css - App.css · Component-scoped application styling
src/App.css - Test setup · React test configuration and starter test coverage
src/setupTests.js - Vitals · Web vitals reporting hook from the CRA toolchain
src/reportWebVitals.js
UI flows
Authentication and goal management screens
- Login · User sign-in entry point
src/Login.js - Register · Account creation entry point
src/Register.js - Meta list · Displays metas and their current status or progress
src/components/MetaList.js - Meta form · Creates and edits metas with client-side validation
src/components/MetaForm.js - Edit modal · Modal container for inline edit actions
src/components/EditModal.js - Category form · Creates categories used to organize metas
src/components/CategoriaForm.js
public
Browser shell and PWA assets
- index.html · Root HTML document that hosts the React mount point
public/index.html - manifest · Web app manifest for installable browser behavior
public/manifest.json
external
Backend and browser services outside this repo
- FastAPI API · External REST backend providing persistence and authorization
- MySQL · Persistent database used behind the backend API
Connections 22
- 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