# dilanvlad/sonikomusicapp architecture

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

- Interactive diagram: https://gitdiagram.com/dilanvlad/sonikomusicapp
- Repository: https://github.com/dilanvlad/sonikomusicapp

## Overview

##### Project type and purpose
- This is a full‐stack .NET solution called “Musica_SonikoMusic.”
- It consists of three main .NET projects:
- Application.MVC – an ASP.NET Core MVC web application (Razor) serving HTML/CSS/JS to users.
- Aplication.API – an ASP.NET Core Web API providing REST endpoints for Albums, Musics, Playlists, Users, Subscriptions, etc.
- Aplication.Modelos – a class‐library of shared domain models (Album, Music, Playlist, Subscription, Identity, Notifications, etc.).
- There is also Aplication.API.Consumer, a console/worker project that calls the Web API (Crud.cs).

##### File structure
- Top‐level projects:
- Application.MVC/Controllers, Views, wwwroot (static assets), Services (EmailService), Storage (music files)
- Aplication.API/Controllers, Data (AppDbContext + EF Core migrations), appsettings, Program.cs
- Aplication.Modelos/entities and subfolders for Favorites, Identity, Subscription, Implementation classes
- Aplication.API.Consumer/Crud.cs – a background consumer of the API
- Key patterns and technologies:
- MVC presentation layer (Razor pages + JS + CSS + Bootstrap)
- RESTful API layer with EF Core, migrations, DbContext
- Shared domain models in a separate library
- Local filesystem storage for uploaded music files
- Email service for account management (forgot/reset password)
- EF Core Code‐First migrations
- JSON‐based configuration (appsettings.json)
- Authentication/Authorization via Identity models

##### README
- Minimal metadata: confirms project name “Aplicacion Musica_SonikoMusic.”

##### Main components and relationships
a. Components:
- Web Browser (end user)
- ASP.NET Core MVC App (Application.MVC)
- ASP.NET Core Web API (Aplication.API)
- Shared Domain Models (Aplication.Modelos)
- SQL Database (connected via EF Core AppDbContext)
- Local File Storage (music files in Application.MVC/Storage/music)
- External Email Service (SMTP or third‐party)
- API Consumer Service (Aplication.API.Consumer)

b. Relationships / Data Flow:
1. Browser ←→ MVC App: HTTP/HTTPS requests for pages, forms, AJAX calls
2. MVC App ←→ Web API: HTTP REST calls to CRUD resources (Albums, Musics, Playlists, etc.)
3. Web API ←→ Database: EF Core issues SQL queries to the underlying DB (e.g., SQL Server)
4. MVC App → File Storage: reads/writes music file blobs from local filesystem
5. MVC App → Email Service: uses EmailService to send password resets, confirmations
6. API Consumer → Web API: scheduled or event‐driven calls to API endpoints

c. Architectural patterns:
- Layered architecture: Presentation (MVC) → API/Service → Data
- MVC for UI, Repository/UnitOfWork via EF Core for persistence
- Shared domain model library for consistency between MVC and API
- Worker service (Consumer) reusing the same API

d. Technologies & frameworks:
- ASP.NET Core MVC 6+ (Razor view engine, TagHelpers)
- ASP.NET Core Web API (Controllers, Attributes)
- EF Core Code-First migrations
- C# 10+, .NET 6+/7+
- Bootstrap, jQuery for UI
- JSON configuration, logging
- Local file storage (could be swapped for Azure Blob, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Containers and components
    Browser["Web Browser"]:::frontend

    subgraph "Presentation Layer"
        MVCApp["Application.MVC\n(ASP.NET Core MVC)"]:::frontend
        MVCControllers["Controllers"]:::frontend
        MVCViews["Views (Razor)"]:::frontend
        MVCAssets["wwwroot (Static Assets)"]:::frontend
        MVCStorage["Storage/music"]:::datastore
        MVCEmail["EmailService"]:::external

        MVCApp --> MVCControllers
        MVCApp --> MVCViews
        MVCApp --> MVCAssets
        MVCApp --> MVCStorage
        MVCApp --> MVCEmail
    end

    subgraph "Backend/API Layer"
        APIApp["Aplication.API\n(ASP.NET Core Web API)"]:::backend
        APIControllers["Controllers"]:::backend
        APIDbCtx["AppDbContext"]:::datastore
        APIMigrations["Migrations"]:::datastore
        APIConfig["appsettings.json"]:::backend

        APIApp --> APIControllers
        APIApp --> APIDbCtx
        APIApp --> APIMigrations
        APIApp --> APIConfig
    end

    Models["Aplication.Modelos\n(Shared Domain Models)"]:::backend

    subgraph "Worker Service"
        Consumer["API Consumer\n(Aplication.API.Consumer)"]:::worker
    end

    DB["SQL Database"]:::datastore
    FileStore["File Storage"]:::datastore
    EmailSvc["External Email Service"]:::external

    %% Relationships
    Browser -->|HTTPS| MVCApp
    MVCApp -->|HTTPS/REST| APIApp
    APIApp -->|SQL| DB
    MVCApp -->|File I/O| FileStore
    MVCApp -->|SMTP/TLS| EmailSvc
    Consumer -->|HTTPS/REST| APIApp
    Models -.-> MVCApp
    Models -.-> APIApp

    %% Click Events
    click MVCApp "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Application.MVC/"
    click MVCControllers "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Application.MVC/Controllers/"
    click MVCViews "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Application.MVC/Views/"
    click MVCAssets "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Application.MVC/wwwroot/"
    click MVCStorage "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Application.MVC/Storage/music/"
    click MVCEmail "https://github.com/dilanvlad/sonikomusicapp/blob/Dilan-Albacura/Application.MVC/Services/EmailService.cs"

    click APIApp "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Aplication.API/"
    click APIControllers "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Aplication.API/Controllers/"
    click APIDbCtx "https://github.com/dilanvlad/sonikomusicapp/blob/Dilan-Albacura/Aplication.API/Data/AppDbContext.cs"
    click APIMigrations "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Aplication.API/Migrations/"
    click APIConfig "https://github.com/dilanvlad/sonikomusicapp/blob/Dilan-Albacura/Aplication.API/appsettings.json"
    click Consumer "https://github.com/dilanvlad/sonikomusicapp/blob/Dilan-Albacura/Aplication.API.Consumer/Crud.cs"
    click Consumer "https://github.com/dilanvlad/sonikomusicapp/blob/Dilan-Albacura/Aplication.API.Consumer/Application.API.Consumer.csproj"

    click Models "https://github.com/dilanvlad/sonikomusicapp/tree/Dilan-Albacura/Aplication.Modelos/"
    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#E6FFED,stroke:#28A745,color:#28A745;
    classDef datastore fill:#FFF5BA,stroke:#D4A017,color:#D4A017;
    classDef external fill:#F0F0F0,stroke:#6A737D,color:#6A737D;
    classDef worker fill:#FFE4B5,stroke:#E36209,color:#E36209;
```
