# alebrex99/aw1-weeks-2025 architecture

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

- Interactive diagram: https://gitdiagram.com/alebrex99/aw1-weeks-2025
- Repository: https://github.com/alebrex99/aw1-weeks-2025

## Overview

##### Project type and purpose
- This is a teaching repository for “Applicazioni Web I – 2024/2025.” Over 12 weeks the student builds a simple full-stack Q&A web application.
- By week 11–12 the core architecture emerges:
- A React/Vite “react-qa” frontend
- A Node/ESM “qa-server” backend
- A SQLite database

##### File structure
- Top-level directories: week01…week12. Each week holds exercises; weeks 11–12 contain the full app.
- In week11/week12:
- qa-server/
– index.mjs (Express server entry)
– dao.mjs (data-access layer)
– QAModels.mjs (schema/business logic)
– questions.sqlite (persisted Q&A)
– test.http (manual API tests)
- react-qa/
– src/ (React app)
· API/API.mjs (client-side HTTP calls)
· components/ (UI components)
· models/QAModels.mjs (shared typings or helpers)
– index.html, vite.config.js (build setup)

##### Detail
- Layers in the backend: routing, business logic, data access.
- React’s component hierarchy in a simplified form (NavHeader, Questions, Answers, AnswerForm).
- Build tools (Vite, npm) as side notes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Browser
    Browser["Web Browser"]:::external

    %% Frontend Layer
    subgraph "Frontend (React/Vite)" 
        direction TB
        Vite["Vite Dev Server / Static Host"]:::frontend
        HTML["index.html"]:::frontend
        Entry["main.jsx"]:::frontend
        Components["UI Components"]:::frontend
        APIClient["API/API.mjs"]:::frontend
        SharedModels["models/QAModels.mjs"]:::frontend
        Config["vite.config.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Express/SQLite)"
        direction TB
        Express["index.mjs (Express Server)"]:::backend
        BusinessLogic["QAModels.mjs"]:::backend
        DAO["dao.mjs"]:::backend
        Tests["test.http"]:::backend
        Package["package.json"]:::backend
        DB["questions.sqlite"]:::db
    end

    %% Connections
    Browser -->|Loads| Vite
    Vite --> HTML
    HTML --> Entry
    Entry --> Components
    Components --> APIClient
    APIClient -->|HTTP GET/POST| Express
    Express --> BusinessLogic
    BusinessLogic --> DAO
    DAO --> DB

    %% Response arrows
    DB -->|Data| DAO
    DAO -->|Models| BusinessLogic
    BusinessLogic -->|JSON| Express
    Express -->|HTTP Response| APIClient
    APIClient --> Components

    %% Click Events
    click Vite "https://github.com/alebrex99/aw1-weeks-2025/tree/main/week12/react-qa"
    click Components "https://github.com/alebrex99/aw1-weeks-2025/tree/main/week12/react-qa/src/components"
    click APIClient "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/react-qa/src/API/API.mjs"
    click SharedModels "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/react-qa/src/models/QAModels.mjs"
    click Entry "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/react-qa/src/main.jsx"
    click HTML "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/react-qa/index.html"
    click Config "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/react-qa/vite.config.js"
    click Express "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/index.mjs"
    click DAO "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/dao.mjs"
    click BusinessLogic "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/QAModels.mjs"
    click DB "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/questions.sqlite"
    click Tests "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/test.http"
    click Package "https://github.com/alebrex99/aw1-weeks-2025/blob/main/week12/qa-server/package.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3385ff,color:#000
    classDef backend fill:#d4edda,stroke:#28a745,color:#000
    classDef db fill:#fff3cd,stroke:#ffc107,color:#000,shape:cylinder
    classDef external fill:#f8d7da,stroke:#dc3545,color:#000
```
