# sealcode/sealious architecture

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

- Interactive diagram: https://gitdiagram.com/sealcode/sealious
- Repository: https://github.com/sealcode/sealious

## Overview

##### Main Components

a. Core Framework Layer:
- App Core (src/app/)
- Context Management (src/context.ts)
- Configuration Management (src/app/config-manager.ts)
- Internationalization System (src/i18n/)

b. Collection System:
- Base Collections
- Custom Collections
- Field Types (extensive system under src/app/base-chips/field-types/)
- Policy Types (src/app/policy-types/)

c. Data Layer:
- Datastore (src/datastore/)
- Query System
- Graph Management
- MongoDB Integration

d. HTTP Layer:
- REST API Endpoints
- Route Management
- Middleware System
- Session Management
- Error Handling

e. Supporting Systems:
- Email System (src/email/)
- File Upload Management
- User Management
- Authentication/Authorization

##### Relationships and Interactions

- HTTP requests flow through the HTTP layer to Collections
- Collections interact with the Datastore
- Policy enforcement flow between components
- Context propagation through the system
- Field type validation flow
- Email system integration points

##### Implementation Details

- Declarative nature of the framework
- Automatic REST API generation
- Policy enforcement points
- Field validation pipeline
- Database abstraction layer

##### Additional Elements

Notes about:
- Configuration system
- Plugin architecture
- Built-in collections
- Policy inheritance
- Field type system

Remember to highlight the framework's key features:
- Automatic REST API generation
- Built-in user and session management
- Declarative database schema
- Policy-based access control
- Field type validation system

This will create a comprehensive visualization that accurately represents Sealious's architecture while maintaining clarity and usefulness for development teams.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        AppCore["App Core"]:::core
        Context["Context Management"]:::core
        Config["Configuration Manager"]:::core
        I18n["Internationalization"]:::core
    end

    subgraph Collections
        BaseCollections["Base Collections"]:::collection
        CustomCollections["Custom Collections"]:::collection
        FieldTypes["Field Types System"]:::collection
        PolicyTypes["Policy Types"]:::collection
    end

    subgraph DataLayer
        Datastore["Datastore"]:::data
        QuerySystem["Query System"]:::data
        GraphMgmt["Graph Management"]:::data
        MongoDB["MongoDB Integration"]:::data
    end

    subgraph HTTPLayer
        RestAPI["REST API Core"]:::http
        Routes["Route Management"]:::http
        Middleware["Middleware System"]:::http
        ErrorHandler["Error Handling"]:::http
    end

    subgraph Support
        Email["Email System"]:::support
        FileUpload["File Upload Management"]:::support
        UserMgmt["User Management"]:::support
        SessionMgmt["Session Management"]:::support
    end

    subgraph Security
        PolicyEnforce["Policy Enforcement"]:::security
        SessionHandle["Session Handling"]:::security
        Auth["Authentication"]:::security
    end

    subgraph Response
        RespSystem["Response System"]:::response
        ErrorResp["Error Responses"]:::response
    end

    %% Relationships
    HTTPLayer --> Collections
    Collections --> DataLayer
    Collections --> PolicyEnforce
    Context --> Collections
    Context --> HTTPLayer
    PolicyEnforce --> Collections
    Support --> Collections
    Collections --> Response
    HTTPLayer --> Response
    Auth --> SessionHandle
    SessionHandle --> UserMgmt

    %% Click Events
    click AppCore "https://github.com/sealcode/sealious/blob/dev/src/app/app.ts"
    click Context "https://github.com/sealcode/sealious/blob/dev/src/context.ts"
    click Config "https://github.com/sealcode/sealious/blob/dev/src/app/config-manager.ts"
    click I18n "https://github.com/sealcode/sealious/tree/dev/src/i18n/"
    click BaseCollections "https://github.com/sealcode/sealious/blob/dev/src/app/collections/base-collections.ts"
    click FieldTypes "https://github.com/sealcode/sealious/tree/dev/src/app/base-chips/field-types/"
    click PolicyTypes "https://github.com/sealcode/sealious/tree/dev/src/app/policy-types/"
    click Datastore "https://github.com/sealcode/sealious/blob/dev/src/datastore/datastore.ts"
    click QuerySystem "https://github.com/sealcode/sealious/blob/dev/src/datastore/query.ts"
    click GraphMgmt "https://github.com/sealcode/sealious/blob/dev/src/datastore/graph.ts"
    click RestAPI "https://github.com/sealcode/sealious/blob/dev/src/http/http.ts"
    click Routes "https://github.com/sealcode/sealious/blob/dev/src/http/routes/routes.ts"
    click ErrorHandler "https://github.com/sealcode/sealious/blob/dev/src/http/handle-error.ts"
    click Middleware "https://github.com/sealcode/sealious/blob/dev/src/http/middlewares.ts"
    click Email "https://github.com/sealcode/sealious/blob/dev/src/email/mailer.ts"
    click UserMgmt "https://github.com/sealcode/sealious/blob/dev/src/app/collections/users.ts"
    click SessionMgmt "https://github.com/sealcode/sealious/blob/dev/src/app/collections/sessions.ts"
    click FileUpload "https://github.com/sealcode/sealious/blob/dev/src/http/routes/uploaded-files.ts"
    click PolicyEnforce "https://github.com/sealcode/sealious/blob/dev/src/app/policy-types/policy-types.ts"
    click SessionHandle "https://github.com/sealcode/sealious/blob/dev/src/http/routes/session.ts"
    click RespSystem "https://github.com/sealcode/sealious/blob/dev/src/response/response.ts"
    click ErrorResp "https://github.com/sealcode/sealious/blob/dev/src/response/errors.t"

    %% Styles
    classDef core fill:#2374ab
    classDef collection fill:#48a9a6
    classDef data fill:#4ea5d9
    classDef http fill:#f4845f
    classDef support fill:#9b6b9e
    classDef security fill:#d64933
    classDef response fill:#2a9d8f

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Collections]:::collection
        L3[Data Layer]:::data
        L4[HTTP Layer]:::http
        L5[Support Services]:::support
        L6[Security]:::security
        L7[Response Handling]:::response
    end
```
