# aeternum-web/sistema-fime architecture

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

- Interactive diagram: https://gitdiagram.com/aeternum-web/sistema-fime
- Repository: https://github.com/aeternum-web/sistema-fime

## Overview

##### Project type and purpose
- Sistema FIME is a full-stack, community-driven web application built with .NET/Blazor for the Facultad de Ingeniería Mecánica y Eléctrica (FIME) student community.
- Purpose: enable student communication, Q&A, sharing experiences, and collaborative features via a modern SPA.

##### File structure
- Top-level “SistemaFIME” folder houses the Blazor project:
- Pages/ & Pages/Shared: client UI components (Razor pages, layouts, shared menus, content sections).
- Data/ApplicationDbContext.cs: EF Core data layer.
- Models: domain DTOs (DashboardModels.cs).
- wwwroot: static assets (CSS, JS) including Tailwind setup.
- Dockerfile(.dev), docker-compose.yml/dev, .env, build/test scripts: containerization and local orchestration.
- Node modules, package.json, tailwind.config.js, build-tailwind.sh: front-end styling toolchain.
- Program.cs, App.razor, _Host.cshtml: application startup and hosting.

##### README for additional insights
- Tech stack: C#, .NET (Blazor), PostgreSQL.
- Deployment via Docker.
- No external third-party services beyond a relational database.

##### Main components
a. Presentation Layer
- Blazor SPA running in the browser.
- Entry point: App.razor → Router → Pages/*.razor.
- Shared UI components under Pages/Shared (menus, layouts, cards).
b. Business Logic Layer
- Razor page code-behind or injected services (if present).
- Feature components (e.g., DashboardModels) orchestrate data fetch & UI rendering.
c. Data Access Layer
- ApplicationDbContext (EF Core) connecting to PostgreSQL.
- Models folder defines the schema for dashboards, comments, materias, profesores.
d. Infrastructure & Deployment
- Docker image (Dockerfile) with ASP.NET host.
- docker-compose for local dev: services for web app and postgres.
- build-tailwind.sh & Node toolchain generate CSS assets pre-deployment.
e. External Services
- PostgreSQL container or managed service.
- (Optionally) future integrations: email, authentication providers (not in current tree).

##### Relationships and interactions
- Browser ←→ Blazor WebAssembly or Blazor Server (hosted) over HTTP.
- Web host (Kestrel) processes Razor pages, serves static wwwroot content.
- EF Core inside web host issues SQL queries to PostgreSQL.
- build/test scripts run on the CI/dev workstation, produce Docker images, push to registry or deploy.

##### Architectural patterns & design principles
- Layered architecture (Presentation → Business → Data).
- Component-based UI with reusable Razor components.
- Containerization (micro-VM per service) for reproducible environments.
- Modular CSS with Tailwind to keep styling consistent.

##### Detail
- That the EF Core ApplicationDbContext → PostgreSQL link is explicit.
- DevOps scripts (docker-compose, build-tailwind, start.sh) to show how the system comes up end-to-end.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        Browser["User Browser"]:::frontend
        subgraph "Blazor SPA" 
            direction TB
            AppRazor["App.razor"]:::frontend
            ProgramCS["Program.cs"]:::frontend
            IndexRazor["Index.razor"]:::frontend
            CounterRazor["Counter.razor"]:::frontend
            FetchDataRazor["FetchData.razor"]:::frontend
            DashboardRazor["Dashboard.razor"]:::frontend
            HostCshtml["_Host.cshtml"]:::frontend
            subgraph "Shared Components"
                direction TB
                MainLayout["MainLayout.razor"]:::frontend
                LayoutCshtml["_Layout.cshtml"]:::frontend
                subgraph "Menus"
                    MenuAdmin["MenuAdmin.razor"]:::frontend
                    MenuGuest["MenuGuest.razor"]:::frontend
                    MenuStudent["MenuStudent.razor"]:::frontend
                end
                subgraph "Plantillas"
                    Header["Header.razor"]:::frontend
                    Footer["Footer.razor"]:::frontend
                end
                subgraph "Dashboard Cards & Sections"
                    ComentarioCard["ComentarioCard.razor"]:::frontend
                    ComentariosSection["ComentariosSection.razor"]:::frontend
                    DashboardStatsCard["DashboardStatsCard.razor"]:::frontend
                    DashboardStatsSection["DashboardStatsSection.razor"]:::frontend
                    MateriaCard["MateriaCard.razor"]:::frontend
                    MateriasSection["MateriasSection.razor"]:::frontend
                    ProfesorCard["ProfesorCard.razor"]:::frontend
                    ProfesoresSection["ProfesoresSection.razor"]:::frontend
                end
            end
        end
    end

    %% Backend Layer
    subgraph "Backend" 
        direction TB
        ASPNETHost["ASP.NET Host (Kestrel)"]:::backend
        subgraph "Data Access"
            ApplicationDbContext["ApplicationDbContext.cs"]:::backend
        end
        subgraph "Domain Models"
            DashboardModels["DashboardModels.cs"]:::backend
        end
    end

    %% Database
    PostgreSQL["PostgreSQL DB"]:::database

    %% Infrastructure & Build
    subgraph "Infrastructure & Build" 
        direction TB
        subgraph "Docker & Orchestration"
            Dockerfile["Dockerfile / Dockerfile.dev"]:::infra
            Compose["docker-compose.yml / docker-compose.dev.yml"]:::infra
            EnvFiles[".env / .dockerignore"]:::infra
        end
        subgraph "Tailwind & Node"
            PackageJSON["package.json / package-lock.json"]:::infra
            TailwindConfig["tailwind.config.js"]:::infra
            BuildTailwind["build-tailwind.sh"]:::infra
            NodeModules["node_modules"]:::infra
        end
        subgraph "Static Assets"
            CSS["wwwroot/css/*.css"]:::infra
            JS["wwwroot/js/*.js"]:::infra
        end
        subgraph "Helper Scripts & Settings"
            AppSettings["appsettings.json / appsettings.Development.json"]:::infra
            LaunchSettings["launchSettings.json"]:::infra
            StartScripts["start.sh / start-dev.sh / test-build.sh"]:::infra
        end
    end

    %% Connections
    Browser -->|"loads SPA"| AppRazor
    AppRazor --> ProgramCS
    ProgramCS --> IndexRazor
    IndexRazor --> CounterRazor
    IndexRazor --> FetchDataRazor
    IndexRazor --> DashboardRazor
    HostCshtml --> ASPNETHost
    ASPNETHost --> ApplicationDbContext
    ApplicationDbContext -->|"SQL Queries"| PostgreSQL

    BuildTailwind --> CSS
    PackageJSON --> BuildTailwind
    TailwindConfig --> BuildTailwind
    NodeModules --> BuildTailwind

    ASPNETHost --> Dockerfile
    Dockerfile --> Compose
    Compose --> PostgreSQL

    StartScripts --> Dockerfile

    %% Click Events
    click AppRazor "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/App.razor"
    click ProgramCS "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Program.cs"
    click IndexRazor "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Index.razor"
    click CounterRazor "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Counter.razor"
    click FetchDataRazor "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/FetchData.razor"
    click DashboardRazor "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Dashboard.razor"
    click HostCshtml "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/_Host.cshtml"
    click MainLayout "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/MainLayout.razor"
    click LayoutCshtml "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/_Layout.cshtml"
    click MenuAdmin "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/Menus/MenuAdmin.razor"
    click MenuGuest "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/Menus/MenuGuest.razor"
    click MenuStudent "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/Menus/MenuStudent.razor"
    click Header "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/plantillas/Header.razor"
    click Footer "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/plantillas/Footer.razor"
    click ComentarioCard "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/ComentarioCard.razor"
    click ComentariosSection "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/ComentariosSection.razor"
    click DashboardStatsCard "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/DashboardStatsCard.razor"
    click DashboardStatsSection "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/DashboardStatsSection.razor"
    click MateriaCard "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/MateriaCard.razor"
    click MateriasSection "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/MateriasSection.razor"
    click ProfesorCard "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/ProfesorCard.razor"
    click ProfesoresSection "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Pages/Shared/Components/content/usuario/bienvenida/Dashboard/ProfesoresSection.razor"
    click ApplicationDbContext "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Data/ApplicationDbContext.cs"
    click DashboardModels "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Models/DashboardModels.cs"
    click Dockerfile "https://github.com/aeternum-web/sistema-fime/tree/main/SistemaFIME/Dockerfile"
    click Compose "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/docker-compose.yml"
    click EnvFiles "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/.env"
    click PackageJSON "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/package.json"
    click TailwindConfig "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/tailwind.config.js"
    click BuildTailwind "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/build-tailwind.sh"
    click NodeModules "https://github.com/aeternum-web/sistema-fime/tree/main/SistemaFIME/node_modules"
    click CSS "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/wwwroot/css/app.css"
    click JS "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/wwwroot/js/app.js"
    click AppSettings "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/appsettings.json"
    click LaunchSettings "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/Properties/launchSettings.json"
    click StartScripts "https://github.com/aeternum-web/sistema-fime/blob/main/SistemaFIME/start.sh"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#E0FFE0,stroke:#28a745,color:#28a745
    classDef database fill:#FFE0E0,stroke:#d73a49,color:#d73a49
    classDef infra fill:#FFF0D0,stroke:#735c0f,color:#735c0f
```
