# fermanquliyev/geoplanner architecture

> Architecture diagram of the GitHub repository fermanquliyev/geoplanner, 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/fermanquliyev/geoplanner
- Repository: https://github.com/fermanquliyev/geoplanner

## Overview

##### Project Type & Purpose
- AspireStack is a full-stack enterprise application that uses an Angular-based frontend and a .NET-based backend.
- The solution is organized into multiple projects representing clean layered architecture patterns (presentation, application, domain, and infrastructure) as well as support utilities (database initialization, service defaults, and service generation).

##### Main Components
a. Frontend:
- AspireStack.Angular – an Angular project containing modules (dashboard, pages like login, error pages, registration, role and user management, etc.) along with client-side services, interceptors, and UI components.
- AspireStack.Angular.ServiceGenerator – A supporting tool likely used to auto-generate or assist with service code integration on the Angular side.

b. Backend:
- AspireStack.WebApi – the Web API project exposing REST endpoints (e.g., AuthController, dynamic route mapping, etc.).
- AspireStack.AppHost – potentially the entry point or hosting application that bootstraps the backend services.

c. Business Logic & Service Layers:
- AspireStack.Application & AspireStack.Application.Shared – containing application services, DTOs, localization, and common service interfaces (role management, user management, etc.).

d. Domain & Core Model:
- AspireStack.Domain & AspireStack.Domain.Shared – holding core entities, business rules, enumerations, and domain logic (including user and role definitions).

e. Infrastructure:
- AspireStack.Infrastructure – implementing details such as Entity Framework Core database context, repositories, JWT token handling, caching, and other low-level services.
- AspireStack.DbInitializator – responsible for database migrations, initialization, and seeding which ties into the Entity Framework Core setup.

f. Supporting Services:
- AspireStack.ServiceDefaults – providing default extensions or baseline implementations for services.

##### Relationships and Data Flow
- The Angular frontend communicates via HTTP with the ASP.NET Core Web API.
- HTTP requests from the frontend flow into API controllers (e.g., in AspireStack.WebApi) and are then dispatched to the application service layer.
- Business logic implemented in AspireStack.Application leverages domain entities from AspireStack.Domain and works with infrastructure components (e.g., repositories, caching, and JWT services) provided by AspireStack.Infrastructure.
- The DbInitializator sets up the database (likely a relational database) using migrations from Entity Framework Core.
- Utility packages (like service generation and service defaults) integrate throughout the solution to streamline development and enforce consistency.

##### Architectural Patterns & Principles
- Layered/Clean Architecture:
- Presentation Layer (Angular, Web API).
- Application Layer for business logic and service orchestration.
- Domain Layer for core models and business rules.
- Infrastructure Layer for persistence, authentication, caching, and external integrations.
- Use of dependency injection, interceptors (on the frontend), and attributes (e.g., AppServiceAuthorizeAttribute in the Application) for security.
- Separation of concerns ensures that UI concerns stay decoupled from the business logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        A["AspireStack.Angular (Frontend)"]:::frontend
        B["AspireStack.Angular.ServiceGenerator (Service Generator)"]:::frontend
    end

    %% Backend Core
    subgraph "Backend Core"
        D["AspireStack.AppHost (Hosting)"]:::host
        C["AspireStack.WebApi (API Controllers)"]:::api
        E["AspireStack.Application & Application.Shared (Application Layer)"]:::application
        F["AspireStack.Domain & Domain.Shared (Domain Layer)"]:::domain
        G["AspireStack.Infrastructure (Infrastructure Layer)"]:::infrastructure
        H["AspireStack.DbInitializator (DB Initialization)"]:::infrastructure
        I["AspireStack.ServiceDefaults (Supporting Utilities)"]:::utilities
    end

    %% External Database
    J["Database (Relational DB)"]:::database

    %% Relationships
    A -->|"HTTP_calls"| C
    B -->|"generates_services_for"| A
    D -->|"hosts"| C
    C -->|"dispatches_calls_to"| E
    E -->|"executes_business_logic_with"| F
    E -->|"calls_for_persistence_and_security"| G
    G -->|"persists_data_in"| J
    G -->|"triggers_DB_initialization"| H
    H -->|"runs_migrations_and_seeding_on"| J
    I -->|"provides_defaults_to"| E

    %% Click Events
    click A "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.Angular"
    click B "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.Angular.ServiceGenerator"
    click C "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.WebApi"
    click D "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.AppHost"
    click E "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.Application"
    click F "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.Domain"
    click G "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.Infrastructure"
    click H "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.DbInitializator"
    click I "https://github.com/fermanquliyev/geoplanner/blob/master/AspireStack.ServiceDefaults"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef api fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef application fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef domain fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef utilities fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef host fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef database fill:#F0E68C,stroke:#333,stroke-width:2px;
```
