# garden-co/jazz architecture

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

- Interactive diagram: https://gitdiagram.com/garden-co/jazz
- Repository: https://github.com/garden-co/jazz

## Overview

##### Main Components Identification

The system consists of several key packages that form different layers:

a. Core Layer:
- `packages/cojson` - The fundamental package handling collaborative JSON operations
- `packages/cojson-storage` - Storage management
- `packages/cojson-transport-ws` - WebSocket-based transport layer

b. Platform-specific Implementations:
- `packages/jazz-browser` - Browser-specific implementation
- `packages/jazz-nodejs` - Node.js implementation
- `packages/jazz-react-native` - React Native implementation

c. Framework Integrations:
- `packages/jazz-react` - React integration
- `packages/jazz-vue` - Vue.js integration
- `packages/jazz-svelte` - Svelte integration

d. Authentication Modules:
- `packages/jazz-browser-auth-clerk`
- `packages/jazz-react-auth-clerk`
- `packages/jazz-react-native-auth-clerk`

**┌─────────────────────────────────────────────────────────┐**
- Application Layer                       │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
- React     │  │    Vue      │  │   Svelte    │     │
- Integration │  │ Integration │  │ Integration │     │
- ┘  └─────────────┘  └─────────────┘     │
- ┤
- Platform Layer                         │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
- Browser   │  │   Node.js   │  │React Native │     │
- Implementation│  │Implementation│  │Implementation│     │
- ┘  └─────────────┘  └─────────────┘     │
- ┤
- Core Layer                           │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
- CoJSON    │  │   Storage   │  │  Transport  │     │
- Core     │  │   Manager   │  │ (WebSocket) │     │
- ┘  └─────────────┘  └─────────────┘     │
- ┘

##### Key Interactions to Highlight

- Authentication flows with auth providers
- Demonstrate how data synchronization works across platforms
- Storage persistence paths

##### Additional Elements

Important aspects:
- Storage adapters (SQLite, IndexedDB)
- WebSocket transport layer
- Authentication providers
- Media handling components
- Tools and utilities

##### Implementation Details

- Local-first architecture with offline capabilities
- Distributed state management
- Cross-platform compatibility
- Real-time synchronization
- Security and encryption features

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App[Client Applications]
        
        subgraph Frameworks
            React["React Integration"]:::framework
            Vue["Vue Integration"]:::framework
            Svelte["Svelte Integration"]:::framework
            ReactNative["React Native Integration"]:::framework
        end

        subgraph Auth
            BrowserAuth["Browser Auth"]:::auth
            ReactAuth["React Auth"]:::auth
            RNAuth["React Native Auth"]:::auth
        end

        subgraph Platform
            Browser["Browser Implementation"]:::platform
            Node["Node.js Implementation"]:::platform
        end
    end

    subgraph Core
        CoJSON["CoJSON Core"]:::core
        
        subgraph Storage
            StorageManager["Storage Management"]:::storage
            IndexedDB["IndexedDB Storage"]:::storage
            SQLite["SQLite Storage"]:::storage
        end
        
        subgraph Transport
            WS["WebSocket Transport"]:::transport
        end

        subgraph Media
            BrowserMedia["Browser Media"]:::media
            RNMedia["React Native Media"]:::media
        end
    end

    subgraph Tools
        DevTools["Development Tools"]:::tools
        CreateApp["Create Jazz App"]:::tools
    end

    %% Relationships
    App --> Frameworks
    Frameworks --> Auth
    Auth --> CoJSON
    CoJSON --> Storage
    CoJSON --> Transport
    Platform --> CoJSON
    Media --> CoJSON

    %% Click Events
    click CoJSON "https://github.com/garden-co/jazz/tree/main/packages/cojson"
    click StorageManager "https://github.com/garden-co/jazz/tree/main/packages/cojson-storage"
    click WS "https://github.com/garden-co/jazz/tree/main/packages/cojson-transport-ws"
    click React "https://github.com/garden-co/jazz/tree/main/packages/jazz-react"
    click Vue "https://github.com/garden-co/jazz/tree/main/packages/jazz-vue"
    click Svelte "https://github.com/garden-co/jazz/tree/main/packages/jazz-svelte"
    click ReactNative "https://github.com/garden-co/jazz/tree/main/packages/jazz-react-native"
    click BrowserAuth "https://github.com/garden-co/jazz/tree/main/packages/jazz-browser-auth-clerk"
    click ReactAuth "https://github.com/garden-co/jazz/tree/main/packages/jazz-react-auth-clerk"
    click RNAuth "https://github.com/garden-co/jazz/tree/main/packages/jazz-react-native-auth-clerk"
    click Browser "https://github.com/garden-co/jazz/tree/main/packages/jazz-browser"
    click Node "https://github.com/garden-co/jazz/tree/main/packages/jazz-nodejs"
    click IndexedDB "https://github.com/garden-co/jazz/tree/main/packages/cojson-storage-indexeddb"
    click SQLite "https://github.com/garden-co/jazz/tree/main/packages/cojson-storage-sqlite"
    click BrowserMedia "https://github.com/garden-co/jazz/tree/main/packages/jazz-browser-media-images"
    click RNMedia "https://github.com/garden-co/jazz/tree/main/packages/jazz-react-native-media-images"
    click DevTools "https://github.com/garden-co/jazz/tree/main/packages/jazz-tools"
    click CreateApp "https://github.com/garden-co/jazz/tree/main/packages/create-jazz-app"

    %% Styles
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef framework fill:#48bb78,stroke:#2f855a,color:white
    classDef auth fill:#ecc94b,stroke:#d69e2e,color:black
    classDef storage fill:#805ad5,stroke:#6b46c1,color:white
    classDef transport fill:#d53f8c,stroke:#b83280,color:white
    classDef platform fill:#4299e1,stroke:#3182ce,color:white
    classDef media fill:#ed8936,stroke:#dd6b20,color:white
    classDef tools fill:#718096,stroke:#4a5568,color:white
```
