# neozhu/workflow architecture

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

- Interactive diagram: https://gitdiagram.com/neozhu/workflow
- Repository: https://github.com/neozhu/workflow

## Overview

##### Project Type and Purpose
- ApprovalFlow is a full-stack, server-side Blazor web application.
- Purpose: internal enterprise workflow and approval system with eight form types and seven functional modules.

##### (Implied) File Structure
- Although the file tree provided is minimal, a standard Blazor Server project will include:
- A .csproj at root
- /Pages for Razor components (UI pages)
- /Shared for common layouts/components
- /Data or /Services for EF Core DbContext, repositories, and business logic
- /wwwroot for static assets (CSS/JS/images)
- Configuration files (appsettings.json)
- Deployment artifacts: release.zip (build output), publish-dotnet8.zip (published site), IIS configuration.

##### README Insights
- Technical stack: .NET 7, Blazor Server, EF Core, MS SQL Server Express, IIS
- Core functional modules: Dashboard, Workflow Engine, My Tasks, Warehouse Verify, Check-in/Check-out, Workflow Configuration, System Management
- Eight distinct form processes, each driven by the workflow engine.

##### Relationships and Interactions
- Client Browser ↔ IIS/Kestrel (SignalR) ↔ Blazor Server pages
- Blazor Server services → EF Core DbContext → SQL Server Database
- Workflow Engine module calls data layer to persist and query process states
- Authentication service integrated at the server boundary
- Notification service invoked by business logic upon state changes

##### Architectural Patterns and Design Principles
- Component-based UI (Blazor Razor Components)
- Server-side rendering with real-time updates via SignalR
- Layered architecture: Presentation → Business/Workflow → Data
- Dependency Injection for services (e.g., IWorkflowManager, IRepository<T>)
- Configuration-driven workflows (workflow definitions stored in DB or JSON)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Containers
    subgraph "Client"
        direction TB
        Browser["Client Browser<br/>Renders Blazor UI via SignalR"]:::presentation
    end

    subgraph "Web Server (IIS / Kestrel)"
        direction TB
        WebServer["Web Server<br/>Hosts Blazor Server App"]:::presentation

        subgraph "Application Layer"
            direction TB
            WorkflowEngine["Workflow Engine Module"]:::business
            Dashboard["Dashboard Module"]:::business
            MyTasks["My Tasks Module"]:::business
            Warehouse["Warehouse Verify Module"]:::business
            CheckInOut["Check-in/Check-out Module"]:::business
            WorkflowConfig["Workflow Configuration Module"]:::business
            SystemMgmt["System Management Module"]:::business
        end
    end

    subgraph "Data Layer"
        direction TB
        EFCore["EF Core DbContext"]:::data
        SQLServer["MS SQL Server Express"]:::data
    end

    subgraph "External Services"
        direction TB
        Auth["Authentication Service"]:::external
        FileStorage["File/Blob Storage"]:::external
        EmailService["Notification Service (SMTP)"]:::external
    end

    subgraph "Artifacts & Documentation"
        direction TB
        README["README.md"]:::docs
        GITIGNORE[".gitignore"]:::docs
        LICENSE["LICENSE"]:::docs
        PUBLISH["publish-dotnet8.zip"]:::docs
        RELEASE["release.zip"]:::docs
    end

    %% Connections
    Browser -->|"SignalR (WebSockets/HTTP)"| WebServer
    WebServer -->|"Processes Requests"| WorkflowEngine
    WorkflowEngine -->|"CRUD Operations"| EFCore
    EFCore -->|"SQL Queries"| SQLServer
    WorkflowEngine -->|"Triggers Emails"| EmailService
    WorkflowEngine -->|"Stores Attachments"| FileStorage
    Browser -.->|"Authentication"| Auth
    WebServer -->|"Validates Token"| Auth

    %% Artifact Links
    WebServer -->|"Deployment Artifacts"| README
    WebServer --> RELEASE
    WebServer --> PUBLISH
    WebServer --> LICENSE
    WebServer --> GITIGNORE

    %% Click Events
    click README "https://github.com/neozhu/workflow/blob/main/README.md"
    click GITIGNORE "https://github.com/neozhu/workflow/blob/main/.gitignore"
    click LICENSE "https://github.com/neozhu/workflow/tree/main/LICENSE"
    click PUBLISH "https://github.com/neozhu/workflow/blob/main/publish-dotnet8.zip"
    click RELEASE "https://github.com/neozhu/workflow/blob/main/release.zip"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366d6;
    classDef business fill:#DFF5D9,stroke:#28a745;
    classDef data fill:#FFE4B5,stroke:#e36209;
    classDef external fill:#E0E0E0,stroke:#6a737d;
    classDef docs fill:#F3E6FF,stroke:#5f259f;
```
