# huntertran/blogengine-aspnetcore architecture

> Architecture diagram of the GitHub repository huntertran/blogengine-aspnetcore, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huntertran/blogengine-aspnetcore
- Repository: https://github.com/huntertran/blogengine-aspnetcore

## Overview

##### Main Components

a. Frontend Layer (Vue.js Application)
- Components structure
- State Management (Vuex)
- Routing (Vue Router)
- UI Framework (Vuetify)
- External Services (TinyMCE Editor)

b. Backend Layer (.NET Core 3.1)
- API Controllers
- Service Layer
- Repository Layer
- Data Access Layer
- Authentication/Authorization

c. Database
- SQL Database (indicated by blogengine.db and migrations)

**┌─ Vue.js Frontend Application ─────────────────┐**
- Vue Components                            │
- Public Components (Home, About)        │
- Admin Components (Posts, Categories)   │
- Vuex Store                               │
- Vue Router                               │
- Vuetify UI Framework                     │
- ┘

**┌─ .NET Core API ────────────────────────────────┐**
- Controllers                                │
- AuthController                         │
- PostsController                        │
- CategoriesController                   │
- UsersController                        │

- Services Layer                            │
- Identity Service                       │
- Post Service                           │

- Repository Layer                          │
- Generic Repository                     │
- ┘

**┌─ Data Storage ──────────────────────────────┐**
- SQL Database                            │
- Users                                │
- Posts                                │
- Categories                           │
- PostCategories                       │
- ┘

##### Important Flows to Highlight

a. Authentication Flow:
- Client → AuthController → IdentityService → Database
- Token-based authentication (JWT)

b. Data Flow:
- Client → API Controllers → Services → Repository → Database

##### Technical Details

- .NET Core 3.1 framework
- Vue.js 4 frontend
- Vuetify 2 UI framework
- JWT Authentication
- Entity Framework Core (implied by migrations)
- xUnit for testing

##### Additional Elements

- Version numbers for major components
- External dependencies (TinyMCE)
- API endpoints grouping

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        VueApp["Vue.js Application"]:::frontend
        click VueApp "https://github.com/huntertran/blogengine-aspnetcore/blob/master/blogengine-client/src/App.vue"
        
        subgraph Components
            PublicComp["Public Components"]:::frontend
            click PublicComp "https://github.com/huntertran/blogengine-aspnetcore/tree/master/blogengine-client/src/components"
            AdminComp["Admin Components"]:::frontend
            click AdminComp "https://github.com/huntertran/blogengine-aspnetcore/tree/master/blogengine-client/src/components/admin"
            PostComp["Post Management"]:::frontend
            click PostComp "https://github.com/huntertran/blogengine-aspnetcore/tree/master/blogengine-client/src/components/posts"
            CatComp["Category Management"]:::frontend
            click CatComp "https://github.com/huntertran/blogengine-aspnetcore/tree/master/blogengine-client/src/components/categories"
        end
        
        VueRouter["Vue Router"]:::frontend
        click VueRouter "https://github.com/huntertran/blogengine-aspnetcore/blob/master/blogengine-client/src/router.js"
        VuexStore["Vuex Store"]:::frontend
        click VuexStore "https://github.com/huntertran/blogengine-aspnetcore/blob/master/blogengine-client/src/store.js"
        Vuetify["Vuetify UI"]:::frontend
        click Vuetify "https://github.com/huntertran/blogengine-aspnetcore/blob/master/blogengine-client/src/plugins/vuetify.js"
        TinyMCE["TinyMCE Editor"]:::external
    end

    subgraph API
        subgraph Controllers
            AuthCtrl["Auth Controller"]:::controller
            click AuthCtrl "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Api/Controllers/AuthController.cs"
            PostsCtrl["Posts Controller"]:::controller
            click PostsCtrl "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Api/Controllers/PostsController.cs"
            CatCtrl["Categories Controller"]:::controller
            click CatCtrl "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Api/Controllers/CategoriesController.cs"
            UsersCtrl["Users Controller"]:::controller
            click UsersCtrl "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Api/Controllers/UsersController.cs"
        end

        subgraph Services
            IdentityService["Identity Service"]:::service
            click IdentityService "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Services/Identity/IdentityService.cs"
            PostService["Post Service"]:::service
            click PostService "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Services/Post/PostService.cs"
        end

        subgraph Repository
            GenericRepo["Generic Repository"]:::repository
            click GenericRepo "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Repository/Generic/GenericRepository.cs"
            RepoInterface["Repository Interface"]:::repository
            click RepoInterface "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Repository/Generic/IGenericRepository.cs"
        end
    end

    subgraph Data
        DbContext["Application DbContext"]:::database
        click DbContext "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Repository/Data/ApplicationDbContext.cs"
        SQLDb[(SQL Database)]:::database
        click SQLDb "https://github.com/huntertran/blogengine-aspnetcore/blob/master/BlogEngine.Api/blogging.db"
        Migrations["Migrations"]:::database
        click Migrations "https://github.com/huntertran/blogengine-aspnetcore/tree/master/BlogEngine.Repository/Data/Migrations"
    end

    %% Frontend Connections
    VueApp --> VueRouter
    VueApp --> VuexStore
    VueApp --> Vuetify
    VueApp --> Components
    PostComp --> TinyMCE

    %% API Connections
    Components --> Controllers
    AuthCtrl --> IdentityService
    PostsCtrl --> PostService
    CatCtrl --> PostService
    UsersCtrl --> IdentityService
    
    %% Service to Repository
    PostService --> GenericRepo
    IdentityService --> GenericRepo
    GenericRepo --> RepoInterface
    
    %% Data Layer
    RepoInterface --> DbContext
    DbContext --> SQLDb
    DbContext --> Migrations

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef repository fill:#e67e22,stroke:#d35400,color:white
    classDef database fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Controller["API Controller"]:::controller
        Service["Service"]:::service
        Repository["Repository"]:::repository
        Database["Database"]:::database
        External["External Service"]:::external
    end
```
