# novato-intlgnt/songfusionapp architecture

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

- Interactive diagram: https://gitdiagram.com/novato-intlgnt/songfusionapp
- Repository: https://github.com/novato-intlgnt/songfusionapp

## Overview

##### Project type and purpose
- From the file tree and “song-fusionapp” name, this is a full-stack JavaScript web application.
- It follows an MVC/layered pattern: an Express-based Node.js backend exposing REST endpoints for “users” and “songs,” plus a static front-end (HTML/CSS/JS) served from the server.
- It persists data in a relational database (see code_sql.sql) and offers user authentication/verification.

##### File structure
Top level:
- package.json / .env_EJEMPLO – Node.js app with environment variables
- src/app.mjs & src/server.mjs – application and server startup
src/dev (back-end layers):
- routes – route definitions (user, song)
- controllers – request handlers orchestrating logic
- services – business rules (e.g. verify-email, song logic)
- models – data access objects (SQL schema, user/song models)
- middlewares – e.g. auth validation
- schemes – input validation schemas
src/public (front-end assets):
- HTML pages (login.html, dashboard.html)
- CSS (styles, dashboard, login)
- JS (login script, dashboard UI logic)

##### README
- Minimal content, but confirms the app’s name.
- No extra architecture notes, so we infer patterns from file structure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client Side"
        Browser["Web Browser"]:::frontend
        Assets["Front-end Assets"]:::frontend
    end

    Browser -->|"loads static files"| SFH
    SFH -->|"serves assets"| Browser

    %% Back-end Server
    subgraph "Server Side"
        SFH["Static File Handler"]:::backend
        Router["API Router"]:::backend
        Auth["Auth Middleware"]:::backend
        Validation["Validation Schemas"]:::backend

        subgraph "Controllers"
            UC["UserController"]:::backend
            SC["SongController"]:::backend
        end

        subgraph "Services"
            US["UserService\n(verify-email)"]:::backend
            SS["SongService"]:::backend
        end

        subgraph "Data Access Layer"
            UM["UserModel"]:::backend
            SM["SongModel"]:::backend
            DBInit["DB Schema"]:::backend
        end
    end

    %% External Systems
    ExternalEmail["External Email Service"]:::external
    DB["Relational Database"]:::database

    %% Request Flow
    Browser -->|"API request"| Router
    Router --> Auth
    Auth --> Validation
    Validation --> UC
    Validation --> SC
    UC --> US
    SC --> SS
    US --> UM
    SS --> SM
    UM --> DB
    SM --> DB
    US -->|"sends email via"| ExternalEmail

    %% Click Events
    click Assets "https://github.com/novato-intlgnt/songfusionapp/tree/main/src/public/"
    click SFH "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/server.mjs"
    click SFH "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/app.mjs"
    click Router "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/routes/user.mjs"
    click Router "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/routes/song.mjs"
    click Auth "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/middlewares/auth.mjs"
    click Validation "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/schemes/user-scheme.mjs"
    click Validation "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/schemes/song-scheme.mjs"
    click UC "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/controllers/users.mjs"
    click SC "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/controllers/song.mjs"
    click US "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/services/verify-email.mjs"
    click SS "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/services/song.mjs"
    click UM "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/models/user.mjs"
    click SM "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/models/song.mjs"
    click DBInit "https://github.com/novato-intlgnt/songfusionapp/blob/main/src/dev/models/code_sql.sql"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef backend fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef database fill:#eeeeee,stroke:#424242,color:#424242,stroke-width:2px;
    classDef external fill:#ffe0b2,stroke:#e65100,color:#e65100;
```
