# rudalson/wabe architecture

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

- Interactive diagram: https://gitdiagram.com/rudalson/wabe
- Repository: https://github.com/rudalson/wabe

## Overview

##### Main Components Structure

a) Core Framework Components:
- Authentication System
- Database Layer
- GraphQL API Engine
- File Management
- Email Service
- Payment Processing
- Hooks System
- Server Core

b) External Integrations:
- Database Providers (MongoDB)
- OAuth Providers (Google)
- Email Services (Resend)
- Payment Services (Stripe)

##### Component Relationships

a) Central Core:
- Schema Manager (packages/wabe/src/schema) connected directly to the core

b) Primary Services Layer:
- Authentication Service (packages/wabe/src/authentication)
- Database Controller (packages/wabe/src/database)
- GraphQL Engine (packages/wabe/src/graphql)
- Hook System (packages/wabe/src/hooks)

c) Supporting Services Layer:
- Email Controller (packages/wabe/src/email)
- Payment Controller (packages/wabe/src/payment)
- File Management (packages/wabe/src/files)

##### Specific Component Details

Authentication Flow:
- OAuth providers
- Email/Password authentication
- Session management
- Role-based access control

Database Layer:
- Database adapters (MongoDB)
- Query controllers
- Cache system

GraphQL Layer:
- Schema generation
- Resolver mapping
- Type system
- API endpoints

##### Integration Points

Clearly mark:
- External service connection points
- Plugin architecture
- Hook system integration points
- Custom adapter interfaces

##### Data Flow Indicators

- Request flow from client to GraphQL API
- Authentication flow
- Database operations
- Hook execution chain

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Server["Server Core"]:::core
        Schema["Schema Manager"]:::core
        Server --> Schema
    end

    subgraph PrimaryServices
        Auth["Authentication System"]:::primary
        DB["Database Layer"]:::primary
        GQL["GraphQL API Engine"]:::primary
        Hooks["Hook System"]:::primary
    end

    subgraph SupportServices
        Email["Email Controller"]:::support
        Payment["Payment Controller"]:::support
        Files["File Management"]:::support
    end

    subgraph ExternalServices
        MongoDB[("MongoDB")]:::external
        OAuth["OAuth (Google)"]:::external
        Resend["Resend Email"]:::external
        Stripe["Stripe Payment"]:::external
    end

    subgraph AuthComponents
        Session["Session Management"]:::component
        RBAC["Role-based Access"]:::component
        SchemaGen["Schema Generation"]:::component
    end

    %% Core Connections
    Server --> Auth
    Server --> DB
    Server --> GQL
    Server --> Hooks

    %% Primary Service Connections
    Auth --> Session
    Auth --> RBAC
    Auth --> OAuth
    GQL --> SchemaGen
    DB --> MongoDB
    
    %% Support Service Connections
    Server --> Email
    Server --> Payment
    Server --> Files
    
    %% External Connections
    Email --> Resend
    Payment --> Stripe

    %% Hook System Connections
    Hooks --> Auth
    Hooks --> DB
    Hooks --> Email
    Hooks --> Payment

    %% Click Events
    click Auth "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/authentication/"
    click DB "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/database/"
    click GQL "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/graphql/"
    click Files "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/files/"
    click Email "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/email/"
    click Payment "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/payment/"
    click Hooks "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/hooks/"
    click Server "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/server/"
    click Schema "https://github.com/rudalson/wabe/tree/main/packages/wabe/src/schema/"
    click MongoDB "https://github.com/rudalson/wabe/blob/main/packages/wabe/src/database/adapters/MongoAdapter.ts"
    click OAuth "https://github.com/rudalson/wabe/blob/main/packages/wabe/src/authentication/oauth/Google.ts"
    click Resend "https://github.com/rudalson/wabe/tree/main/packages/wabe-resend/"
    click Stripe "https://github.com/rudalson/wabe/tree/main/packages/wabe-stripe/"
    click Session "https://github.com/rudalson/wabe/blob/main/packages/wabe/src/authentication/Session.ts"
    click RBAC "https://github.com/rudalson/wabe/blob/main/packages/wabe/src/authentication/roles.ts"
    click SchemaGen "https://github.com/rudalson/wabe/blob/main/packages/wabe/src/graphql/GraphQLSchema.ts"

    classDef core fill:#2d5af1,stroke:#333,stroke-width:2px
    classDef primary fill:#3498db,stroke:#333,stroke-width:2px
    classDef support fill:#f1c40f,stroke:#333,stroke-width:2px
    classDef external fill:#2ecc71,stroke:#333,stroke-width:2px
    classDef component fill:#9b59b6,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Primary Services"]:::primary
        L3["Support Services"]:::support
        L4["External Services"]:::external
        L5["Sub Components"]:::component
    end
```
