# erickkkt/zoomnews architecture

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

- Interactive diagram: https://gitdiagram.com/erickkkt/zoomnews
- Repository: https://github.com/erickkkt/zoomnews

## Overview

##### Project Type and Purpose
- This is a full-stack application where the backend is built in .NET Core (with EF Core for data access) and the frontend is built using Angular (with separate projects for admin and a user-facing web app).
- The system handles news-related functionalities, evident from controllers like ArticlesController, CategoriesController, and CommentsController, for managing content, and includes administration features and public-facing components.

##### Analyzing the File Structure
- Backend:
- Organized into multiple projects: a main API project (Zoomnews.Api) containing the controllers and startup configurations; a Common library (Zoomnews.Common) for shared utilities like authorization and extensions; a Database project (Zoomnews.Database) that defines the DbContext, migrations, models, and repository interfaces/implementations; and a Services project (Zoomnews.Services) which contains business logic, service interfaces, a unit of work, and service implementations.
- Notice the separation via folders: Controllers, Data, Models, Repositories, and Services. This indicates layered architecture with clear boundaries (API layer, service/business logic layer, repository/data access layer).
- There is also Dockerfile and app settings for deployment, showing containerization support.

- Frontend:
- There are two separate Angular projects: one under “fontend/admin” (for the administration panel) and another under “fontend/webapp” (likely serving the public or user interface).
- Each Angular project contains a typical Angular structure: assets, components, services, environments, and configuration files. The admin project contains components tailored for managing articles, categories, comments, media, and settings, indicating administrative functionalities.
- The separation of these two projects emphasizes a clear division between administrative interfaces and user interfaces.

a. Main Components:
- API Backend (.NET Core):
- API Controllers (e.g., ArticlesController, CategoriesController, etc.)
- Service Layer (business logic – ArticleService, CategoryService, CommentService, MediaService)
- Data Access Layer (Repositories and UnitOfWork pattern)
- Domain/Database Layer (EF Core models, DbContext, migrations)
- Common Utilities & Authorization (Zoomnews.Common)
- External configuration (Docker integration, appsettings)

- Frontend Components:
- Admin Angular Application
▪ Components for content management (articles, categories, comments, media, settings)
▪ Shared elements like navigation, header and dialogs
▪ Angular services for handling API calls, authorization, etc.
- WebApp Angular Application
▪ User-facing components like home, user profile, and dialogs (e.g., avatar-dialog, edit-user)
▪ Angular services and models that interact with the API

b. Relationships and Data Flow:
- Within the backend, illustrate how HTTP requests from Controllers pass to the Service Layer.
- Links from Service Layer to the Data Access Layer (Repositories) which in turn interact with the Database (EF Core DbContext, migrations, models).
- That the Common library is used across both the API and potentially also integrated for shared logic/authorization.
- External configurations (e.g., Docker, appsettings) that influence deployment.

c. Architectural Patterns and Design Principles:
- Layered architecture: Separate presentation (frontend), API/controllers, business logic (services), and persistence layers (database/repositories).
- Use of Repository and Unit of Work patterns in the data access layer.
- Clear separation of concerns between admin and public frontends.

d. Technologies, Frameworks, and Libraries:
- Backend: .NET Core, Entity Framework Core, C#
- Frontend: Angular 8; note Angular CLI configurations, environment settings, assets, and testing (karma, protractor)
- Deployment: Docker configuration for containerization (Dockerfiles in backend and nginx for admin)
- Additional libraries/utilities: Authorization (via Zoomnews.Common), middleware, and extension methods.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        direction TB
        A["Admin Angular App"]:::adminStyle
        B["WebApp Angular App"]:::webappStyle
    end

    subgraph "Backend"
        direction TB
        subgraph "API Layer"
            direction TB
            C["API Controllers"]:::controllerStyle
            D["Service Layer"]:::serviceStyle
            E["Data Access (Repositories)"]:::repositoryStyle
            F["Database (Domain Models & DbContext)"]:::databaseStyle
            G["Common Utilities & Authorization"]:::commonStyle

            C -->|"calls"| D
            D -->|"invokes"| E
            E -->|"accesses"| F
            C ---|"utilizes"| G
        end

        subgraph "Deployment Config"
            direction TB
            H["Dockerfile"]:::deploymentStyle
            I["appsettings.json"]:::deploymentStyle
            J["app.yaml"]:::deploymentStyle
        end

        H ---|"configures"| C
        I ---|"configures"| C
        J ---|"configures"| C
    end

    A -->|"HTTP/REST"| C
    B -->|"HTTP/REST"| C

    %% Click Events
    click A "https://github.com/erickkkt/zoomnews/tree/master/fontend/admin"
    click B "https://github.com/erickkkt/zoomnews/tree/master/fontend/webapp"
    click C "https://github.com/erickkkt/zoomnews/tree/master/backend/Zoomnews.Api/Controllers"
    click D "https://github.com/erickkkt/zoomnews/tree/master/backend/Zoomnews.Services/Services"
    click E "https://github.com/erickkkt/zoomnews/tree/master/backend/Zoomnews.Database/Repositories"
    click F "https://github.com/erickkkt/zoomnews/tree/master/backend/Zoomnews.Database/Data"
    click G "https://github.com/erickkkt/zoomnews/blob/master/backend/Zoomnews.Common"
    click H "https://github.com/erickkkt/zoomnews/tree/master/backend/Zoomnews.Api/Dockerfile"
    click I "https://github.com/erickkkt/zoomnews/blob/master/backend/Zoomnews.Api/appsettings.json"
    click J "https://github.com/erickkkt/zoomnews/blob/master/backend/Zoomnews.Api/app.yaml"

    %% Styles
    classDef adminStyle fill:#f4cccc,stroke:#a61c00,stroke-width:2px;
    classDef webappStyle fill:#fce5cd,stroke:#b45f06,stroke-width:2px;
    classDef controllerStyle fill:#c9daf8,stroke:#1155cc,stroke-width:2px;
    classDef serviceStyle fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef repositoryStyle fill:#fff2cc,stroke:#bf9000,stroke-width:2px;
    classDef databaseStyle fill:#ead1dc,stroke:#990000,stroke-width:2px;
    classDef commonStyle fill:#d0e0e3,stroke:#0b5394,stroke-width:2px;
    classDef deploymentStyle fill:#f4cccc,stroke:#990000,stroke-width:2px;
```
