# remake/remake-framework architecture

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

## Overview

##### Main Components

a. Client-Side Layer:
- Client-side directory structure with key modules:
- Input handling system (inputjs)
- Data utilities
- Save data management
- Copy layout functionality
- Parse data attributes
- Query system
- Hummingbird utilities

b. Server-Side Layer:
- Express.js server
- Authentication system (Passport.js)
- Template rendering (Handlebars)
- File upload handling
- API endpoints
- User data management

c. Database Layer:
- File-based data storage system
- User accounts storage

##### Component Relationships

**[Client Browser] ←→ [Remake Framework]**
- Client-Side Components
- Input Handlers
- Data Utilities
- Save Management

- Server Components
- Express Server
- Authentication
- Template Engine
- API Routes

- Data Storage
- User Data
- File Storage

##### Implementation Details

- Key directories from _remake/client-side and _remake/lib
- Relationship between the template system and data management
- How user data flows through the system
- Demonstrate the file upload pathway

##### Technical Stack Indicators

- Express.js
- Passport.js
- Handlebars
- Bcrypt
- express-fileupload

Key Flows to Highlight:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        Browser["Web Browser"]
        InputSystem["Input Handling System"]:::clientside
        DataUtils["Data Utilities"]:::clientside
        SaveMgmt["Save Management"]:::clientside
        CopyLayout["Copy Layout System"]:::clientside
        ParseData["Parse Data Attributes"]:::clientside
        QuerySys["Query System"]:::clientside
        HummingUtils["Hummingbird Utilities"]:::clientside
    end

    subgraph Server["Server Layer"]
        Express["Express Server"]:::serverside
        Auth["Authentication<br/>(Passport.js)"]:::security
        Templates["Template Engine<br/>(Handlebars)"]:::serverside
        APIRoutes["API Routes"]:::serverside
        UserAccounts["User Accounts"]:::serverside
        FileUpload["File Upload Handler"]:::serverside
    end

    subgraph Storage["Data Storage Layer"]
        UserData["User Data Store"]:::storage
        FileStore["File Storage"]:::storage
    end

    %% Client Layer Relationships
    Browser --> InputSystem
    InputSystem --> DataUtils
    InputSystem --> SaveMgmt
    Browser --> CopyLayout
    Browser --> ParseData
    Browser --> QuerySys
    HummingUtils --> Browser

    %% Server Layer Relationships
    Express --> Auth
    Express --> Templates
    Express --> APIRoutes
    Express --> UserAccounts
    Express --> FileUpload

    %% Cross-Layer Relationships
    SaveMgmt -.-> APIRoutes
    FileUpload -.-> FileStore
    UserAccounts -.-> UserData
    Templates -.-> Browser

    %% Click Events
    click InputSystem "https://github.com/remake/remake-framework/tree/master//_remake/client-side/inputjs/"
    click DataUtils "https://github.com/remake/remake-framework/blob/master//_remake/client-side/data-utilities/index.js"
    click SaveMgmt "https://github.com/remake/remake-framework/blob/master//_remake/client-side/get-save-data/index.js"
    click CopyLayout "https://github.com/remake/remake-framework/blob/master//_remake/client-side/copy-layout/index.js"
    click ParseData "https://github.com/remake/remake-framework/blob/master//_remake/client-side/parse-data-attributes/index.js"
    click QuerySys "https://github.com/remake/remake-framework/blob/master//_remake/client-side/queryjs/index.js"
    click HummingUtils "https://github.com/remake/remake-framework/tree/master//_remake/client-side/hummingbird/lib/"
    click Express "https://github.com/remake/remake-framework/blob/master//_remake/server.js"
    click APIRoutes "https://github.com/remake/remake-framework/blob/master//_remake/lib/init-api-new.js"
    click UserAccounts "https://github.com/remake/remake-framework/blob/master//_remake/lib/init-user-accounts.js"
    click Templates "https://github.com/remake/remake-framework/blob/master//_remake/utils/init-handlebars-helpers.js"
    click UserData "https://github.com/remake/remake-framework/blob/master//_remake/lib/user-data.js"

    %% Styling
    classDef clientside fill:#2374ab,color:#fff
    classDef serverside fill:#2a9d8f,color:#fff
    classDef security fill:#e63946,color:#fff
    classDef storage fill:#f4a261,color:#000
    
    %% Legend
    subgraph Legend
        ClientComp["Client-Side Component"]:::clientside
        ServerComp["Server-Side Component"]:::serverside
        SecureComp["Security Component"]:::security
        StorageComp["Storage Component"]:::storage
        Direct["→ Direct Flow"]
        Conditional["--> Conditional Flow"]
    end
```
