# deepkit/deepkit-framework architecture

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

- Interactive diagram: https://gitdiagram.com/deepkit/deepkit-framework
- Repository: https://github.com/deepkit/deepkit-framework

## Overview

##### Main Components Identification

The system should be divided into these major components:

a) Core Framework Components:
- Type System (@deepkit/type)
- Dependency Injection (@deepkit/injector)
- HTTP Server (@deepkit/http)
- RPC System (@deepkit/rpc)
- ORM (@deepkit/orm)
- Event Broker (@deepkit/broker)
- CLI Framework (@deepkit/app)

b) Database Adapters:
- MongoDB (@deepkit/mongo)
- MySQL (@deepkit/mysql)
- PostgreSQL (@deepkit/postgres)
- SQLite (@deepkit/sqlite)

c) Supporting Systems:
- File System Abstractions (@deepkit/filesystem)
- Template Engine (@deepkit/template)
- Debugging Tools (@deepkit/framework-debug-api)
- API Console (@deepkit/api-console-gui)

**┌─ Application Layer ─────────────────────────────────────┐**
- HTTP Controllers | RPC Services | CLI Commands          │
- Framework Core ──────────────────────────────────────┐ │
- Dependency Injection | Event System | Configuration   │ │
- Data & Communication ─────────────────────────────┐  │ │
- ORM | Type System | RPC | HTTP Server | Broker    │  │ │
- Storage Adapters ────────────────────────────┐    │  │ │
- MongoDB | MySQL | PostgreSQL | SQLite | S3    │    │  │ │
- ┘

##### Connection Flows

Key interactions:
- Type System integration with all layers
- Database access through ORM
- HTTP/RPC communication flows
- Event propagation through the broker
- File system operations

##### Specific Implementation Details

- Runtime type system integration
- Database abstraction layer
- Module system architecture
- Dependency injection container
- Event-driven communication

##### Development Tools Integration

Connections to:
- API Console
- Debug Tools
- ORM Browser
- Framework Debug GUI

##### External Systems Integration

Connections to:
- File Storage (S3, FTP, SFTP)
- Message Queues
- Cache Systems
- External APIs

##### Notes for Implementation

- Use standard UML notation where appropriate
- Version compatibility information
- Document scalability points
- Security boundaries
- Async/sync operations
- Error handling flows

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Framework Layer
    subgraph CoreFramework["Core Framework Layer"]
        TypeSystem["Type System"]:::core
        DI["Dependency Injection"]:::core
        HTTP["HTTP Server"]:::core
        RPC["RPC System"]:::core
        ORM["ORM"]:::core
        Broker["Event Broker"]:::core
        CLI["CLI Framework"]:::core
        Core["Core Utilities"]:::core
        Framework["Framework Integration"]:::core
        TypeCompiler["Type Compiler"]:::core
    end

    %% Database Adapters Layer
    subgraph DBAdapters["Database Adapters"]
        MongoDB["MongoDB"]:::db
        MySQL["MySQL"]:::db
        PostgreSQL["PostgreSQL"]:::db
        SQLite["SQLite"]:::db
        SQLBase["SQL Base"]:::db
    end

    %% Supporting Systems Layer
    subgraph Support["Supporting Systems"]
        FileSystem["File System"]:::support
        Template["Template Engine"]:::support
        Debug["Debugging Tools"]:::support
        APIConsole["API Console"]:::support
    end

    %% Development Tools Layer
    subgraph DevTools["Development Tools"]
        ORMBrowser["ORM Browser"]:::devtool
        DebugGUI["Framework Debug GUI"]:::devtool
        DesktopUI["Desktop UI"]:::devtool
    end

    %% Relationships
    TypeSystem --> |Powers| ORM
    TypeSystem --> |Validates| RPC
    TypeSystem --> |Supports| HTTP
    DI --> |Manages| Framework
    Core --> |Utilities| Framework
    Framework --> |Uses| TypeCompiler
    ORM --> |Abstracts| SQLBase
    SQLBase --> |Implements| MySQL
    SQLBase --> |Implements| PostgreSQL
    SQLBase --> |Implements| SQLite
    ORM --> |Connects| MongoDB
    HTTP --> |Exposes| APIConsole
    Debug --> |Provides Data| DebugGUI
    ORM --> |Visualized By| ORMBrowser
    Broker --> |Events| Framework
    CLI --> |Commands| Framework
    FileSystem --> |Storage| Framework
    Template --> |Views| Framework

    %% Click Events
    click TypeSystem "https://github.com/deepkit/deepkit-framework/tree/master/packages/type/"
    click DI "https://github.com/deepkit/deepkit-framework/tree/master/packages/injector/"
    click HTTP "https://github.com/deepkit/deepkit-framework/tree/master/packages/http/"
    click RPC "https://github.com/deepkit/deepkit-framework/tree/master/packages/rpc/"
    click ORM "https://github.com/deepkit/deepkit-framework/tree/master/packages/orm/"
    click Broker "https://github.com/deepkit/deepkit-framework/tree/master/packages/broker/"
    click CLI "https://github.com/deepkit/deepkit-framework/tree/master/packages/app/"
    click Core "https://github.com/deepkit/deepkit-framework/tree/master/packages/core/"
    click Framework "https://github.com/deepkit/deepkit-framework/tree/master/packages/framework/"
    click TypeCompiler "https://github.com/deepkit/deepkit-framework/tree/master/packages/type-compiler/"
    click MongoDB "https://github.com/deepkit/deepkit-framework/tree/master/packages/mongo/"
    click MySQL "https://github.com/deepkit/deepkit-framework/tree/master/packages/mysql/"
    click PostgreSQL "https://github.com/deepkit/deepkit-framework/tree/master/packages/postgres/"
    click SQLite "https://github.com/deepkit/deepkit-framework/tree/master/packages/sqlite/"
    click SQLBase "https://github.com/deepkit/deepkit-framework/tree/master/packages/sql/"
    click FileSystem "https://github.com/deepkit/deepkit-framework/tree/master/packages/filesystem/"
    click Template "https://github.com/deepkit/deepkit-framework/tree/master/packages/template/"
    click Debug "https://github.com/deepkit/deepkit-framework/tree/master/packages/framework-debug-api/"
    click APIConsole "https://github.com/deepkit/deepkit-framework/tree/master/packages/api-console-gui/"
    click ORMBrowser "https://github.com/deepkit/deepkit-framework/tree/master/packages/orm-browser/"
    click DebugGUI "https://github.com/deepkit/deepkit-framework/tree/master/packages/framework-debug-gui/"
    click DesktopUI "https://github.com/deepkit/deepkit-framework/tree/master/packages/desktop-ui/"

    %% Styles
    classDef core fill:#2374ab,stroke:#000,stroke-width:1px,color:white
    classDef db fill:#2a9d8f,stroke:#000,stroke-width:1px,color:white
    classDef support fill:#e9c46a,stroke:#000,stroke-width:1px,color:black
    classDef devtool fill:#9b5de5,stroke:#000,stroke-width:1px,color:white

    %% Legend
    subgraph Legend
        CoreLegend["Core Components"]:::core
        DBLegend["Database Components"]:::db
        SupportLegend["Supporting Systems"]:::support
        DevLegend["Development Tools"]:::devtool
    end
```
