# ten24group/fw24 architecture

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

- Interactive diagram: https://gitdiagram.com/ten24group/fw24
- Repository: https://github.com/ten24group/fw24

## Overview

##### Main Components
- AWS Infrastructure Layer (CDK Stacks & Constructs):
- Use the “lib” folder (notably lib/stacks/corelayer.ts and lib/main.ts) which defines the CDK “stack” responsible for setting up the AWS resources.
- Under “src/constructs”, there are abstractions for various AWS services (e.g., API, Auth, Bucket, Certificate, Cognito roles, DynamoDB, Lambda functions, Layers, Scheduler, etc.). These represent the building blocks that the framework instantiates as part of the infrastructure.
- Application Logic and Runtime:
- “src/application.ts” serves as an entry point for the application.
- Other subdirectories such as “src/core”, “src/decorators”, “src/di”, and “src/entity” contain the application’s business logic, runtime controllers (like API Gateway controllers and Lambda handlers), dependency injection (DI) setups, and entity management.
- AWS Clients:
- The “src/client” directory holds wrappers for AWS-specific services (S3, SES, SNS, SQS, etc.), which bridge the gap between your code and AWS APIs.
- Supporting Services:
- Directories like “src/event”, “src/ui-config-gen”, “src/validation”, etc. offer utilities aiding event processing, UI configuration generation, and request validation.
- Documentation / Developer Facing:
- The “www” directory provides a static website with documentation supporting developers using this framework (Docusaurus-based docs).

##### Relationships and Interactions
- Infrastructure Provisioning:
- The CDK stacks in “lib” use the constructs defined in “src/constructs” to instantiate AWS resources.
- The “cdk.json” file indicates that the CLI interfaces with CDK for deployment.
- Application Runtime Flow:
- The “src/core/runtime” components (e.g., abstract-lambda-handler, api-gateway-controller) showcase key runtime behaviors.
- Controllers and decorators in “src/decorators” modify function behavior, intercept requests, and enforce validations.
- Dependency Injection (DI):
- External Interactions:
- Components under “src/client” are responsible for calling AWS services, so illustrate the connection between application code and AWS services like S3, SES, etc.
- Developer Interaction:
- Document generation and CLI commands (from the README) indicate the separation where developers interact with the framework’s CLI and documentation (shown in the “www” folder).

##### Architectural Patterns and Design Principles
- Modular and Extensible Components:
- The separation between constructs, decorators, DI, and core runtime components emphasizes modularity.
- MVC and Serverless Abstraction:
- Frontend elements (MVC-like controllers and decorators) manage business logic while the backend abstracts AWS infrastructure provisioning.
- Infrastructure as Code (IaC):
- The heavy usage of AWS CDK with customized constructs supports an IaC approach to deploying cloud resources.
- Dependency Injection:
- DI patterns make the various pieces of the framework loosely coupled and easier to test.

##### Final Advice for the Principal Software Engineer
- That every key architectural element is captured, from the modular construct design to serverless abstractions and dependency injection flows.

This structured approach will create a detailed, accurate system design that faithfully represents the architecture of Framework24, making it easier for stakeholders to understand both the high-level structure and the key interactions within the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Layer
    subgraph "Developer Layer"
        DOCS["Docs & CLI Interface"]:::docs
    end

    %% Application Layer
    subgraph "Application Layer"
        APP_ENTRY["Application Entry (src/application.ts)"]:::app
        CORE_RUNTIME["Core Runtime (src/core/runtime)"]:::app
        DI_CONTAINER["DI Container (src/di)"]:::di
        DI_UTILS["DI Utils (src/di/utils)"]:::di
        EVENT_PROC["Event Processing (src/event)"]:::support
        UI_CONFIG["UI Config Gen (src/ui-config-gen)"]:::support
        REQ_VALID["Request Validation (src/validation)"]:::support
        CLIENTS["AWS Clients (src/client)"]:::client
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        AWS_CONSTRUCTS["AWS Constructs (src/constructs)"]:::infra
        CDK_ENTRY["CDK Entry (lib/main.ts)"]:::infra
        CDK_STACKS["CDK Stacks (lib/stacks/corelayer.ts)"]:::infra
    end

    %% Connections between layers
    DOCS -->|"triggers"| APP_ENTRY
    APP_ENTRY -->|"executes"| CORE_RUNTIME
    CORE_RUNTIME -->|"routes to"| DI_CONTAINER
    CORE_RUNTIME -->|"calls"| CLIENTS
    CORE_RUNTIME -->|"invokes"| EVENT_PROC
    CORE_RUNTIME -->|"invokes"| UI_CONFIG
    CORE_RUNTIME -->|"invokes"| REQ_VALID
    DI_CONTAINER -->|"wires"| DI_UTILS
    DI_CONTAINER -->|"injects"| AWS_CONSTRUCTS
    CLIENTS -->|"integrates with"| AWS_CONSTRUCTS
    AWS_CONSTRUCTS -->|"provisions"| CDK_STACKS
    CDK_ENTRY -->|"deploys"| CDK_STACKS

    %% Styling classes
    classDef docs fill:#bbf,stroke:#333,stroke-width:2px;
    classDef app fill:#cfc,stroke:#333,stroke-width:2px;
    classDef infra fill:#fcc,stroke:#333,stroke-width:2px;
    classDef di fill:#fcf,stroke:#333,stroke-width:2px;
    classDef support fill:#cff,stroke:#333,stroke-width:2px;
    classDef client fill:#ffc,stroke:#333,stroke-width:2px;

    %% Click Events
    click DOCS "https://github.com/ten24group/fw24/tree/main/www"
    click APP_ENTRY "https://github.com/ten24group/fw24/blob/main/src/application.ts"
    click CORE_RUNTIME "https://github.com/ten24group/fw24/tree/main/src/core/runtime"
    click DI_CONTAINER "https://github.com/ten24group/fw24/tree/main/src/di"
    click DI_UTILS "https://github.com/ten24group/fw24/tree/main/src/di/utils"
    click EVENT_PROC "https://github.com/ten24group/fw24/tree/main/src/event"
    click UI_CONFIG "https://github.com/ten24group/fw24/tree/main/src/ui-config-gen"
    click REQ_VALID "https://github.com/ten24group/fw24/tree/main/src/validation"
    click CLIENTS "https://github.com/ten24group/fw24/tree/main/src/client"
    click AWS_CONSTRUCTS "https://github.com/ten24group/fw24/tree/main/src/constructs"
    click CDK_ENTRY "https://github.com/ten24group/fw24/blob/main/lib/main.ts"
    click CDK_STACKS "https://github.com/ten24group/fw24/blob/main/lib/stacks/corelayer.ts"
```
