# gguibertg/undersounds architecture

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

- Interactive diagram: https://gitdiagram.com/gguibertg/undersounds
- Repository: https://github.com/gguibertg/undersounds

## Overview

##### Project type and purpose
- UnderSounds is a full-stack, server-rendered web application written in Python (likely using Flask or a similar microframework).
- Its purpose is to serve as a Bandcamp/Spotify-style prototype where end users can browse, buy, and listen to albums and tracks, and where artists can register, upload, and manage their own content.

##### File structure
- Top-level files:
- main.py — application entry point and HTTP server launcher
- controller/ — business-logic layer that maps routes/actions to services
- view/ — template layer (HTML Jinja templates) and view.py (template rendering)
- model/ — data layer implementing DAO + DTO + factory patterns
· dao/ — DAO interfaces and MongoDB implementations
· dto/ — simple Python classes representing domain objects
· mongodbConnector, mongodbDAOFactory — DB connection and factory
- Supporting files: Dockerfile/.dockerignore for containerization, requirements.txt, API_KEYS.py for Firebase credentials.
- The pattern is a classical MVC (Model-View-Controller) with a DAO/Factory sub-pattern for data persistence.

##### README for additional insights
- Requires Python 3.10, uses Firebase for authentication/credentials (credentials.json & API_KEYS.py).
- MongoDB is the primary datastore.
- Execution via “python main.py” to spin up the web server.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Client"
        Browser["Browser"]:::presentation
    end

    %% Static Assets
    subgraph "Static Asset Server"
        Static["static/"]:::presentation
    end

    %% Server Layer
    subgraph "Server"
        main["main.py"]:::business
        controller["controller/controller.py"]:::business
        viewRenderer["view/view.py"]:::business
        templates["view/templates/"]:::presentation
        APIKEYS["API_KEYS.py"]:::external
    end

    %% Persistence Layer
    subgraph "Data Access Layer"
        subgraph "DAO Factory"
            daoFactoryInterface["model/factory/interfaceDAOFactory.py"]:::dataAccess
            mongodbDAOFactory["model/dao/mongodb/mongodbDAOFactory.py"]:::dataAccess
        end

        subgraph "MongoDB Connector"
            mongodbConnector["model/dao/mongodb/mongodbConnector.py"]:::dataAccess
        end

        subgraph "DAO Interfaces"
            iAlbum["model/dao/intefaceAlbumDAO.py"]:::dataAccess
            iContacto["model/dao/intefaceContactoDAO.py"]:::dataAccess
            iGenero["model/dao/intefaceGeneroDAO.py"]:::dataAccess
            iSesion["model/dao/intefaceSesionDAO.py"]:::dataAccess
            iUsuario["model/dao/intefaceUsuarioDAO.py"]:::dataAccess
            iCarrito["model/dao/interfaceCarritoDAO.py"]:::dataAccess
            iFaq["model/dao/interfaceFaqDAO.py"]:::dataAccess
            iResena["model/dao/interfaceReseñaDAO.py"]:::dataAccess
            iSong["model/dao/interfaceSongDAO.py"]:::dataAccess
        end

        subgraph "MongoDB DAO Implementations"
            mAlbum["model/dao/mongodb/collection/mongodbDAOAlbum.py"]:::dataAccess
            mCarrito["model/dao/mongodb/collection/mongodbDAOCarrito.py"]:::dataAccess
            mContacto["model/dao/mongodb/collection/mongodbDAOContacto.py"]:::dataAccess
            mGenero["model/dao/mongodb/collection/mongodbDAOGenero.py"]:::dataAccess
            mResena["model/dao/mongodb/collection/mongodbDAOReseña.py"]:::dataAccess
            mSesion["model/dao/mongodb/collection/mongodbDAOSesion.py"]:::dataAccess
            mUsuario["model/dao/mongodb/collection/mongodbDAOUsuario.py"]:::dataAccess
            mFaq["model/dao/mongodb/collection/mongodbFaqDAO.py"]:::dataAccess
            mSong["model/dao/mongodb/collection/mongodbSongDAO.py"]:::dataAccess
        end
    end

    %% Domain Model
    subgraph "Domain Model (DTOs)"
        albumDTO["model/dto/albumDTO.py"]:::dataAccess
        carritoDTO["model/dto/carritoDTO.py"]:::dataAccess
        contactoDTO["model/dto/contactoDTO.py"]:::dataAccess
        faqDTO["model/dto/faqDTO.py"]:::dataAccess
        generoDTO["model/dto/generoDTO.py"]:::dataAccess
        resenaDTO["model/dto/reseñasDTO.py"]:::dataAccess
        sesionDTO["model/dto/sesionDTO.py"]:::dataAccess
        songDTO["model/dto/songDTO.py"]:::dataAccess
        usuarioDTO["model/dto/usuarioDTO.py"]:::dataAccess
    end

    %% Datastore
    subgraph "Database & External Services"
        MongoDB["MongoDB"]:::datastore
        Firebase["Firebase Auth/Storage"]:::external
    end

    %% Flows
    Browser -->|HTTP Request| main
    main --> controller
    controller -->|renders via| viewRenderer
    viewRenderer --> templates
    viewRenderer --> Static
    controller -->|uses| daoFactoryInterface
    daoFactoryInterface --> mongodbDAOFactory
    mongodbDAOFactory --> mAlbum & mCarrito & mContacto & mGenero & mResena & mSesion & mUsuario & mFaq & mSong
    mAlbum & mCarrito & mContacto & mGenero & mResena & mSesion & mUsuario & mFaq & mSong --> mongodbConnector
    mongodbConnector --> MongoDB
    controller -->|transfers| albumDTO & carritoDTO & contactoDTO & faqDTO & generoDTO & resenaDTO & sesionDTO & songDTO & usuarioDTO
    controller -->|auth via| Firebase

    %% Click Events
    click main "https://github.com/gguibertg/undersounds/blob/main/main.py"
    click controller "https://github.com/gguibertg/undersounds/blob/main/controller/controller.py"
    click viewRenderer "https://github.com/gguibertg/undersounds/blob/main/view/view.py"
    click templates "https://github.com/gguibertg/undersounds/tree/main/view/templates/"
    click Static "https://github.com/gguibertg/undersounds/tree/main/static/"
    click iAlbum "https://github.com/gguibertg/undersounds/blob/main/model/dao/intefaceAlbumDAO.py"
    click iContacto "https://github.com/gguibertg/undersounds/blob/main/model/dao/intefaceContactoDAO.py"
    click iGenero "https://github.com/gguibertg/undersounds/blob/main/model/dao/intefaceGeneroDAO.py"
    click iSesion "https://github.com/gguibertg/undersounds/blob/main/model/dao/intefaceSesionDAO.py"
    click iUsuario "https://github.com/gguibertg/undersounds/blob/main/model/dao/intefaceUsuarioDAO.py"
    click iCarrito "https://github.com/gguibertg/undersounds/blob/main/model/dao/interfaceCarritoDAO.py"
    click iFaq "https://github.com/gguibertg/undersounds/blob/main/model/dao/interfaceFaqDAO.py"
    click iResena "https://github.com/gguibertg/undersounds/blob/main/model/dao/interfaceReseñaDAO.py"
    click iSong "https://github.com/gguibertg/undersounds/blob/main/model/dao/interfaceSongDAO.py"
    click mAlbum "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOAlbum.py"
    click mCarrito "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOCarrito.py"
    click mContacto "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOContacto.py"
    click mGenero "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOGenero.py"
    click mResena "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOReseña.py"
    click mSesion "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOSesion.py"
    click mUsuario "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbDAOUsuario.py"
    click mFaq "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbFaqDAO.py"
    click mSong "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/collection/mongodbSongDAO.py"
    click mongodbConnector "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/mongodbConnector.py"
    click mongodbDAOFactory "https://github.com/gguibertg/undersounds/blob/main/model/dao/mongodb/mongodbDAOFactory.py"
    click daoFactoryInterface "https://github.com/gguibertg/undersounds/blob/main/model/factory/interfaceDAOFactory.py"
    click albumDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/albumDTO.py"
    click carritoDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/carritoDTO.py"
    click contactoDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/contactoDTO.py"
    click faqDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/faqDTO.py"
    click generoDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/generoDTO.py"
    click resenaDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/reseñasDTO.py"
    click sesionDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/sesionDTO.py"
    click songDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/songDTO.py"
    click usuarioDTO "https://github.com/gguibertg/undersounds/blob/main/model/dto/usuarioDTO.py"
    click APIKEYS "https://github.com/gguibertg/undersounds/blob/main/API_KEYS.py"

    %% Styles
    classDef presentation fill:#CFE2F3,stroke:#0B5394,color:#0B5394
    classDef business fill:#D9EAD3,stroke:#38761D,color:#38761D
    classDef dataAccess fill:#FCE5CD,stroke:#B45F06,color:#B45F06
    classDef datastore fill:#EAD1DC,stroke:#990066,color:#990066
    classDef external fill:#E7E6E6,stroke:#666666,color:#666666
```
