How chavezgaby08/neocdt-is02 works
Project type and purpose
• This is a single‐page web application (SPA) built with React and Vite.
• Purpose: A banking module (“NeoCDT”) that provides user authentication (login/register) and CRUD operations on “solicitudes” (CDT requests).
Main components
a. Client (Web Browser)
• Hosts the React application.
b. Frontend Application
• UI Layer: React pages and components (LoginPage, RegisterPage, Dashboard, SolicitudesList, DetalleSolicitud, EditSolicitud, SolicitudForm, Navbar, etc.).
• State Management Layer: AuthContext (manages auth token, user session).
• API Layer: authservice.js, solicitudService.js (HTTP clients for Auth API and Solicitudes API).
• Build/Dev Tool: Vite (serves the app in development and bundles for production).
• Testing: Jest + React Testing Library (unit tests under src/__tests__).
c. External Backend Services (not in this repo)
• Authentication API (login, register endpoints).
• Solicitudes API (create, read, update, delete endpoints).
• Underlying Database (e.g., PostgreSQL, MongoDB) behind the APIs.
Relationships and interactions
• User interacts with the React UI in the browser.
• On login/register, UI calls AuthContext methods → authservice.js → HTTP POST to Auth API → API returns JWT token → AuthContext stores token.
• On CRUD operations, components call solicitudService.js → HTTP requests with token in headers → Solicitudes API → Database.
• AuthContext provides token and user info to any component that needs to call secured endpoints or conditionally render routes.
Architectural patterns and design principles
• Separation of concerns:
• Presentation: React pages/components
• Business logic & state: Context + hooks
• Data access: API service modules
• Single source of truth for authentication (AuthContext).
• Component hierarchy: high-level pages delegate form/UI logic to child components.
• Modular file structure: clear separation of src/pages, src/components, src/api, src/context.
• Test-driven: Jest config at project root → ensures reliability.
• “UI Components & Pages”
• “AuthContext (State & Session)”
• “API Services (authservice.js, solicitudService.js)”
3. On the right, place “Auth API” and “Solicitudes API” side by side, and beneath them “Database.”
• UI → AuthContext → authservice → Auth API
• UI → solicitudService → Solicitudes API → Database
• Auth API returns JWT → AuthContext → UI
5. Notes labeling Vite (dev server/build tool) above the React container, and Jest (testing) below it.