# javiercodely/react-sistema-educativo architecture

> Architecture diagram of the GitHub repository javiercodely/react-sistema-educativo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/javiercodely/react-sistema-educativo
- Repository: https://github.com/javiercodely/react-sistema-educativo

## Overview

##### Project type and purpose
- This is a single-page React application scaffolded with Vite.
- Purpose: a student dashboard for managing exam registrations, schedules, notifications, and academic roadmap; it consumes a set of RESTful APIs (alumno, preceptor, profesor, notificaciones) and uses Firebase for push notifications.

##### File structure
- Top-level:
- public, src, index.html, vite.config.js, package.json, README.md
- vercel.json (deployment on Vercel)
- src/ splits into:
- components (UI pieces organized by feature: alumno, notificaciones)
- pages (route targets: auth/Login, alumno/StudentDashboard, notificaciones)
- services/api (clients for each API domain: alumno, notificaciones, preceptor, profesor)
- services/auth (authentication flows)
- contexts (React Contexts for auth & notifications state)
- mocks (development stubs)
- utils, constants, types, styles

##### Key architectural insights from README & structure
- Frontend-only repo, no backend code here.
- Uses React + Vite for fast HMR & build.
- ESLint + optional TS support (currently using .tsx files).
- Deployed to Vercel.

##### Main components
a. Client Layer (browser)
- React SPA (App.jsx → routes → pages → components)
- React Contexts (AuthContext, NotificacionesContext)
b. API Layer within Client
- apiClient (axios/fetch wrapper)
- Domain services: alumnoService, notificacionesService, preceptorService, profesorService
- authServices (login, token refresh)
c. Backend Layer (external)
- Auth Service (JWT, OAuth)
- Alumno API
- Preceptor API
- Profesor API
- Notificaciones API
d. External Services
- Firebase (Realtime messaging, push)
e. Deployment & Build
- Vite Dev Server / Build Tool
- Vercel hosting

##### Relationships & interactions
- User actions in UI → React components → call domain services (HTTP) → backend APIs → return JSON → updates context & state → UI re-render.
- On login → authServices → Auth API → store JWT in context/localStorage → attach Authorization header on subsequent API calls.
- Notifications: services/notificaciones fetch initial list; Firebase SDK (services/firebase.js) listens for push events → NotificacionesContext → UI dropdown.
- Build: Vite compiles React code → Vercel hosts static assets.

##### Architectural patterns & principles
- Layered architecture: UI layer, service layer, API layer.
- Separation of concerns: components vs pages vs services vs contexts.
- Context API for cross-cutting concerns (authentication, notifications).
- Mock services for development.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend" 
        style Frontend fill:#E8F1FF,stroke:#3182CE,stroke-width:2px
        SPA["React SPA"]:::frontend
        SPA -->|"renders"| App["App.jsx"]:::frontend
        App -->|"guards routes"| Protected["protectedRoute.tsx"]:::frontend

        subgraph "Pages"
            style Pages fill:#ffffff,stroke:none
            Login["Login.tsx"]:::frontend
            Dashboard["StudentDashboard.tsx"]:::frontend
            NotifPage["NotificacionesPage.tsx"]:::frontend
        end
        Protected --> Login
        Protected --> Dashboard
        Protected --> NotifPage

        subgraph "Components"
            direction TB
            style Components fill:#ffffff,stroke:none
            AlumnoDir["src/components/alumno/"]:::frontend
            NotifDir["src/components/notificaciones/"]:::frontend
        end

        subgraph "Contexts"
            style Contexts fill:#ffffff,stroke:none
            AuthCtx["AuthContext"]:::frontend
            NotifCtx["NotificacionesContext"]:::frontend
        end

        subgraph "Services"
            style Services fill:#ffffff,stroke:none
            APIClient["apiClient.ts"]:::frontend
            AuthSrv["authServices.ts"]:::frontend
            FirebaseSDK["firebase.js"]:::frontend
            AlumnoSrv["alumnoService"]:::frontend
            NotifSrv["notificacionesService.ts"]:::frontend
        end

        %% Interactions
        App -->|uses| AuthCtx
        App -->|uses| NotifCtx
        AuthCtx -->|invokes| AuthSrv
        NotifCtx -->|invokes| NotifSrv
        APIClient -->|HTTP| AlumnoSrv
        APIClient -->|HTTP| NotifSrv
        APIClient -->|HTTP| PreceptorAPI
        APIClient -->|HTTP| ProfesorAPI
        FirebaseSDK -->|WebSocket/Push| NotifCtx

    end

    %% Backend Layer
    subgraph "Backend APIs"
        style Backend fill:#E6FFEA,stroke:#2F855A,stroke-width:2px
        AuthAPI["Auth Service"]:::backend
        AlumnoAPI["Alumno API"]:::backend
        PreceptorAPI["Preceptor API"]:::backend
        ProfesorAPI["Profesor API"]:::backend
        NotifAPI["Notificaciones API"]:::backend
    end

    %% External Services
    subgraph "External"
        style External fill:#FFF4E6,stroke:#DD6B20,stroke-width:2px
        Firebase["Firebase Messaging"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deploy"
        style Build fill:#EDF2F7,stroke:#A0AEC0,stroke-width:2px
        Vite["Vite"]:::build
        Vercel["Vercel"]:::build
    end

    %% Data Flows
    SPA -->|HTTP/HTTPS| AuthAPI
    SPA -->|HTTP/HTTPS| AlumnoAPI
    SPA -->|HTTP/HTTPS| PreceptorAPI
    SPA -->|HTTP/HTTPS| ProfesorAPI
    SPA -->|HTTP/HTTPS| NotifAPI
    Firebase -->|push events| FirebaseSDK

    Vite -->|"builds"| Vercel

    %% Click Events
    click SPA "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/main.jsx"
    click App "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/App.jsx"
    click Protected "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/routes/protectedRoute.tsx"
    click Login "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/pages/auth/Login.tsx"
    click Dashboard "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/pages/alumno/StudentDashboard.tsx"
    click NotifPage "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/pages/notificaciones/NotificacionesPage.tsx"
    click AlumnoDir "https://github.com/javiercodely/react-sistema-educativo/tree/main/src/components/alumno/"
    click NotifDir "https://github.com/javiercodely/react-sistema-educativo/tree/main/src/components/notificaciones/"
    click AuthCtx "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/contexts/authContext.tsx"
    click NotifCtx "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/contexts/NotificacionesContext.tsx"
    click APIClient "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/services/api/apiClient.ts"
    click AuthSrv "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/services/auth/authServices.ts"
    click FirebaseSDK "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/services/firebase.js"
    click AlumnoSrv "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/services/api/alumno/estudianteService.ts"
    click NotifSrv "https://github.com/javiercodely/react-sistema-educativo/blob/main/src/services/api/notificaciones/notificacionesServices.ts"
    click Vite "https://github.com/javiercodely/react-sistema-educativo/blob/main/vite.config.js"
    click Vercel "https://github.com/javiercodely/react-sistema-educativo/blob/main/vercel.json"

    %% Styles
    classDef frontend fill:#E8F1FF,stroke:#3182CE,color:#000;
    classDef backend fill:#E6FFEA,stroke:#2F855A,color:#000;
    classDef external fill:#FFF4E6,stroke:#DD6B20,color:#000;
    classDef build fill:#EDF2F7,stroke:#A0AEC0,color:#000;
```
