# feathersjs/feathers architecture

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

- Interactive diagram: https://gitdiagram.com/feathersjs/feathers
- Repository: https://github.com/feathersjs/feathers

## Overview

##### Main Components

a) Core Framework Layer:
- Feathers Core (@feathersjs/feathers)
- Authentication System (@feathersjs/authentication)
- Transport Layer (REST & Socket.IO)
- Schema & Validation System (@feathersjs/schema)

b) Database Adapters Layer:
- Common Adapter Interface
- Supported Databases:
- MongoDB (@feathersjs/mongodb)
- Knex (@feathersjs/knex)
- Memory (@feathersjs/memory)

c) Client Layer:
- REST Client
- Socket.IO Client
- Authentication Client
- Transport Commons

d) Integration Layer:
- Express Integration
- Koa Integration
- Authentication Strategies (Local, OAuth, JWT)

##### Relationship Flows

- Client requests → Transport Layer → Core Services
- Services → Database Adapters → Actual Databases
- Authentication Flow: Client → Auth Service → Strategies → Database
- Real-time Events: Socket.IO → Channels → Services

**[Client Layer]**
- ↓
**[Transport Layer (REST/Socket.IO)]**
- ↓
**[Authentication Layer]**
- ↓
**[Core Services Layer]**
- ↓
**[Database Adapters]**
- ↓
**[Databases]**

##### Implementation Details

Technical details like:
- Service interfaces
- Hook points
- Event channels
- Authentication flows
- Database adapter interfaces

##### Notes

Important notes about:
- Scalability points
- Plugin architecture
- Transport independence
- Database adapter flexibility
- Real-time capabilities

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef db fill:#4CAF50,stroke:#2E7D32,color:white
    classDef auth fill:#FF9800,stroke:#EF6C00,color:white
    classDef transport fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef client fill:#78909C,stroke:#546E7A,color:white
    classDef integration fill:#607D8B,stroke:#455A64,color:white
    classDef testing fill:#795548,stroke:#4E342E,color:white
    classDef tools fill:#FF5722,stroke:#D84315,color:white

    subgraph ClientLayer
        REST_CLIENT["REST Client"]:::client
        SOCKETIO_CLIENT["Socket.IO Client"]:::client
        AUTH_CLIENT["Authentication Client"]:::client
    end

    subgraph TransportLayer
        TRANSPORT["Transport Commons"]:::transport
        REST["REST Transport"]:::transport
        SOCKETIO["Socket.IO Transport"]:::transport
    end

    subgraph CoreLayer
        CORE["Feathers Core"]:::core
        SCHEMA["Schema & Validation"]:::core
        CONFIG["Configuration"]:::core
        ERRORS["Error Handling"]:::core
        UTILS["Common Utilities"]:::core
        TYPEBOX["TypeBox Schema"]:::core
    end

    subgraph AuthLayer
        AUTH["Authentication System"]:::auth
        LOCAL_AUTH["Local Strategy"]:::auth
        OAUTH["OAuth Strategy"]:::auth
        JWT["JWT"]:::auth
    end

    subgraph AdapterLayer
        ADAPTER_COMMON["Common Adapter Interface"]:::db
        MONGODB["MongoDB Adapter"]:::db
        KNEX["Knex Adapter"]:::db
        MEMORY["Memory Adapter"]:::db
    end

    subgraph IntegrationLayer
        EXPRESS["Express Integration"]:::integration
        KOA["Koa Integration"]:::integration
    end

    subgraph DevTools
        CLI["CLI"]:::tools
        GENERATORS["Generators"]:::tools
    end

    subgraph Testing
        ADAPTER_TESTS["Adapter Tests"]:::testing
        COMMON_TESTS["Common Tests"]:::testing
    end

    %% Relationships
    ClientLayer --> TransportLayer
    TransportLayer --> CoreLayer
    TransportLayer --> AuthLayer
    AuthLayer --> CoreLayer
    CoreLayer --> AdapterLayer
    IntegrationLayer --> CoreLayer

    %% Click Events
    click REST_CLIENT "https://github.com/feathersjs/feathers/tree/dove/packages/rest-client"
    click SOCKETIO_CLIENT "https://github.com/feathersjs/feathers/tree/dove/packages/socketio-client"
    click AUTH_CLIENT "https://github.com/feathersjs/feathers/tree/dove/packages/authentication-client"
    click TRANSPORT "https://github.com/feathersjs/feathers/tree/dove/packages/transport-commons"
    click CORE "https://github.com/feathersjs/feathers/tree/dove/packages/feathers"
    click SCHEMA "https://github.com/feathersjs/feathers/tree/dove/packages/schema"
    click CONFIG "https://github.com/feathersjs/feathers/tree/dove/packages/configuration"
    click ERRORS "https://github.com/feathersjs/feathers/tree/dove/packages/errors"
    click UTILS "https://github.com/feathersjs/feathers/tree/dove/packages/commons"
    click TYPEBOX "https://github.com/feathersjs/feathers/tree/dove/packages/typebox"
    click AUTH "https://github.com/feathersjs/feathers/tree/dove/packages/authentication"
    click LOCAL_AUTH "https://github.com/feathersjs/feathers/tree/dove/packages/authentication-local"
    click OAUTH "https://github.com/feathersjs/feathers/tree/dove/packages/authentication-oauth"
    click ADAPTER_COMMON "https://github.com/feathersjs/feathers/tree/dove/packages/adapter-commons"
    click MONGODB "https://github.com/feathersjs/feathers/tree/dove/packages/mongodb"
    click KNEX "https://github.com/feathersjs/feathers/tree/dove/packages/knex"
    click MEMORY "https://github.com/feathersjs/feathers/tree/dove/packages/memory"
    click EXPRESS "https://github.com/feathersjs/feathers/tree/dove/packages/express"
    click KOA "https://github.com/feathersjs/feathers/tree/dove/packages/koa"
    click CLI "https://github.com/feathersjs/feathers/tree/dove/packages/cli"
    click GENERATORS "https://github.com/feathersjs/feathers/tree/dove/packages/generators"
    click ADAPTER_TESTS "https://github.com/feathersjs/feathers/tree/dove/packages/adapter-tests"
    click COMMON_TESTS "https://github.com/feathersjs/feathers/tree/dove/packages/tests"
```
