# jesshdzz/punta-de-flecha architecture

> Architecture diagram of the GitHub repository jesshdzz/punta-de-flecha, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jesshdzz/punta-de-flecha
- Repository: https://github.com/jesshdzz/punta-de-flecha

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered web application (“Punta de flecha”) built with Next.js, using MySQL as its primary datastore and Docker for containerization. It implements a school-management system (students, attendance, grades, reports, etc.) exposing both UI pages and RESTful API endpoints under the same Next.js codebase.

##### File structure
- next/app: React pages (UI) for routes like /login, /estudiantes, /asistencias, /reportes, each with optional loading.tsx and page.tsx.
- next/app/api: API routes organized by domain (estudiantes, asistencias, calificaciones, auth, reportes, materiales, materias, grupos). Each route.ts is a handler.
- next/dominio/entidades: Domain model definitions (TypeScript classes/interfaces) for core concepts (Estudiante, Profesor, Grupo, MaterialEducativo, etc.).
- next/lib/prisma.ts: Prisma client instantiation.
- next/prisma/schema.prisma & migrations: Database schema and migration history for MySQL.
- docker/docker-compose.yml: Service definitions for app, MySQL, and possibly admin tools.
- next/middleware.ts, next/next.config.ts, tailwind.config.ts, ESLint, PostCSS, tsconfig.json: configuration and build pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers and Components

    Browser["Browser"]:::presentation

    subgraph "Next.js App Container"
        direction TB

        subgraph "Presentation Layer"
            direction TB
            FrontendPages["Frontend (React Pages)"]:::presentation
            LoginPage["Login Page"]:::presentation
            DashboardPage["Dashboard Page"]:::presentation
            StudentsPages["Students Pages"]:::presentation
            AttendancePages["Attendance Pages"]:::presentation
            GradesPages["Grades Pages"]:::presentation
            ReportsPages["Reports Pages"]:::presentation
            MaterialsPages["Materials Pages"]:::presentation
        end

        subgraph "API Layer"
            direction TB
            APIRoutes["API Layer (Route Handlers)"]:::api
        end

        subgraph "Domain Layer"
            direction TB
            DomainEntities["Domain Entities & Business Models"]:::domain
        end

        subgraph "Infrastructure Layer"
            direction TB
            PrismaClient["Prisma Client (ORM)"]:::infra
            Middleware["Global Middleware"]:::infra
            ConfigTooling["Config & Tooling"]:::infra
        end
    end

    MySQLDB["MySQL Database"]:::data

    %% Workflow

    Browser -->|"HTTP(S) GET/POST"| FrontendPages
    FrontendPages -->|"fetch/form submit"| APIRoutes
    APIRoutes -->|"invoke domain logic"| DomainEntities
    DomainEntities -->|"ORM calls"| PrismaClient
    PrismaClient -->|"TCP 3306"| MySQLDB
    MySQLDB -->|"query results"| PrismaClient
    PrismaClient -->|"data"| DomainEntities
    DomainEntities -->|"response"| APIRoutes
    APIRoutes -->|"JSON"| FrontendPages
    FrontendPages -->|"render UI"| Browser

    %% Click Events

    click FrontendPages "https://github.com/jesshdzz/punta-de-flecha/tree/main/next/app"
    click LoginPage "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/login/page.tsx"
    click DashboardPage "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/dashboard/page.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/page.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/loading.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/[id]/page.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/nuevo/page.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/[id]/editar/page.tsx"
    click StudentsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/estudiantes/[id]/baja/page.tsx"
    click AttendancePages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/asistencias/page.tsx"
    click AttendancePages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/asistencias/loading.tsx"
    click GradesPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/calificaciones/page.tsx"
    click GradesPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/calificaciones/loading.tsx"
    click ReportsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/reportes/page.tsx"
    click MaterialsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/materiales/page.tsx"
    click MaterialsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/materiales/loading.tsx"
    click MaterialsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/materiales/nuevo/page.tsx"
    click MaterialsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/materiales/estudiante/page.tsx"
    click MaterialsPages "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/materiales/estudiante/loading.tsx"
    click APIRoutes "https://github.com/jesshdzz/punta-de-flecha/tree/main/next/app/api"
    click DomainEntities "https://github.com/jesshdzz/punta-de-flecha/tree/main/next/dominio/entidades"
    click PrismaClient "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/lib/prisma.ts"
    click MySQLDB "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/prisma/schema.prisma"
    click MySQLDB "https://github.com/jesshdzz/punta-de-flecha/tree/main/next/prisma/migrations/"
    click Middleware "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/middleware.ts"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/next.config.ts"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/tailwind.config.ts"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/postcss.config.mjs"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/eslint.config.mjs"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/tsconfig.json"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/app/globals.css"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/next/styles/globals.css"
    click ConfigTooling "https://github.com/jesshdzz/punta-de-flecha/blob/main/docker/docker-compose.yml"

    %% Styles

    classDef presentation fill:#D6E4FF,stroke:#0366d6,color:#000;
    classDef api fill:#DFF7DF,stroke:#28a745,color:#000;
    classDef domain fill:#E8F8F5,stroke:#20c997,color:#000;
    classDef infra fill:#FFE8D6,stroke:#fd7e14,color:#000;
    classDef data fill:#FBEAE5,stroke:#d73a49,color:#000;
```
