# thedouglasaraujo/crud-javascript architecture

> Architecture diagram of the GitHub repository thedouglasaraujo/crud-javascript, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thedouglasaraujo/crud-javascript
- Repository: https://github.com/thedouglasaraujo/crud-javascript

## Overview

##### Project Type and Purpose
- This is a lightweight, front-end only Single-Page Application (SPA) for managing student records (Create, Read, Update, Delete).
- Purpose: allow users to input student data (name, course, period, grades, absences), compute average and status (approved, recovery, failed), and search/filter the list.
- Technologies: plain HTML (index.html), CSS (style.css), and JavaScript (script.js). No backend or external database—data is kept in memory or via browser LocalStorage.

##### File Structure Analysis
- Root
- index.html → main UI markup
- style.css  → styling and layout rules
- script.js  → application logic (data model, view updates, event handlers, storage)
- No “backend” folder or API configuration—everything runs client-side.

##### Key Architectural Patterns
- Model-View-Controller (MVC) or Model-View-Presenter (MVP) style:
- Model: data structures for Student (fields + computed properties like average and status).
- View: DOM elements in index.html, manipulated via CSS and JavaScript.
- Controller/Presenter: script.js functions that listen to UI events, update the model, persist to LocalStorage, and refresh the view.

##### Main Components
a. UI Layer
- HTML Form (input fields, buttons)
- Table/List component (to display students)
- Search Bar (filter function)
b. Business Logic Layer
- Data Model (Student object with validation, average/status rules)
- Controller Functions (createStudent, readStudents, updateStudent, deleteStudent, filterStudents)
c. Data Persistence
- Browser LocalStorage (or in-memory JS array)
d. Assets
- CSS styles
- Image assets (for documentation/screenshots)

##### Relationships and Data Flow
- User interacts with UI (forms, buttons) → Controller
- Controller validates input, updates Model
- Controller persists Model to LocalStorage
- Controller triggers View update (re-render list/table)
- Search input → Controller filter function → filtered dataset → View update

##### Final Checklist
[ ] Clear labels on all components
[ ] Annotations for business rules (absence >18, average thresholds)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        Form["HTML Form"]:::ui
        Table["Table / List"]:::ui
        Search["Search Bar"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic"
        direction TB
        Model["Student Model"]:::logic
        Controller["CRUD Controller"]:::logic
    end

    %% Data Persistence Layer
    subgraph "Data Persistence"
        direction TB
        Storage(("LocalStorage (students)")):::persistence
    end

    %% Assets
    subgraph "Assets"
        direction TB
        CSS["CSS Styles"]:::ui
        Images["Image Assets"]:::ui
    end

    %% Documentation
    subgraph "Documentation"
        direction TB
        Docs["README.md"]:::ui
    end

    %% Connections
    Form -->|"createStudent()"| Controller
    Search -->|"filterStudents()"| Controller
    Controller -->|"validate/update"| Model
    Controller -->|"save()"| Storage
    Controller -->|"loadAll()"| Storage
    Controller -->|"renderList()"| Table

    %% Click Events
    click Form "https://github.com/thedouglasaraujo/crud-javascript/blob/main/index.html"
    click Table "https://github.com/thedouglasaraujo/crud-javascript/blob/main/index.html"
    click Search "https://github.com/thedouglasaraujo/crud-javascript/blob/main/index.html"
    click CSS "https://github.com/thedouglasaraujo/crud-javascript/blob/main/style.css"
    click Model "https://github.com/thedouglasaraujo/crud-javascript/blob/main/script.js"
    click Controller "https://github.com/thedouglasaraujo/crud-javascript/blob/main/script.js"
    click Images "https://github.com/thedouglasaraujo/crud-javascript/tree/main/images/"
    click Docs "https://github.com/thedouglasaraujo/crud-javascript/blob/main/README.md"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,stroke-width:2px
    classDef logic fill:#D0FFD6,stroke:#028A0F,stroke-width:2px
    classDef persistence fill:#FFE9C5,stroke:#D97706,stroke-width:2px
```
