# cbnsndwch/rocicorp-mono architecture

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

## Overview

##### High-Level Architecture Overview

**┌─ Rocicorp Monorepo ─────────────────────┐**

- ┌─ Zero ──────────┐  ┌─ Replicache ─┐  │
- Modern Database │  │ Sync Engine  │  │
- ┘  └─────────────┘  │

- ┘

##### Zero Product Architecture

a) Client-side components:
- zero-client (main client library)
- zero-react (React integration)
- zero-solid (Solid.js integration)
- zero-schema (schema definition)

b) Server-side components:
- zero-cache (server implementation)
- zql (query engine with IVM)
- zqlite (SQLite integration)

- Blue rectangles for client-side components
- Green rectangles for server-side components
- Yellow diamonds for data stores
- Red hexagons for query engines

##### Replicache Architecture

- Client library components
- Documentation system
- Integration points with Zero
- Sync engine components
- Data flow patterns

##### Specific Implementation Details

Technical details such as:
- WebSocket connections for real-time updates
- SQLite storage on the client
- PostgreSQL integration on the server
- Authentication flows
- Cache invalidation patterns

##### Development and Deployment

CI/CD pipeline using the configuration from .github/workflows:
- Bundle size monitoring
- Cloudflare deployment
- Performance testing
- Mirror operations

Key Elements to Include:

##### Data Flow
**Client ←→ WebSocket ←→ Server ←→ Database**

##### Component Relationships
**zero-client → zero-cache → zql → database**

##### Integration Points
**Applications (zbugs) → zero-client → Replicache**

##### Deployment Architecture
**GitHub → CI/CD → Cloudflare/Production**

Use standardized symbols:
- 📦 for packages
- 🔄 for sync operations
- 💾 for storage
- 🔌 for integrations
- 🔒 for security/auth

##### Development and deployment workflows

Tools Recommendation:
- Version control integration
- Component reuse
- Clear visual hierarchy
- Standard notation

Remember to maintain consistency in:

This architecture should clearly show how the monorepo's components work together while maintaining separation of concerns and highlighting the unique features of both Zero and Replicache products.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Monorepo["Rocicorp Monorepo"]
        subgraph Products
            Zero["Zero Database"]
            Replicache["Replicache Sync Engine"]
        end

        subgraph ClientSide["Client-Side Components"]
            ZeroClient["Zero Client Library"]:::client
            ZeroReact["Zero React Integration"]:::client
            ZeroSolid["Zero Solid.js Integration"]:::client
            ZeroSchema["Zero Schema Definition"]:::client
        end

        subgraph ServerSide["Server-Side Components"]
            ZeroCache["Zero Cache Server"]:::server
            ZQL["ZQL Query Engine"]:::engine
            ZQLite["SQLite Integration"]:::storage
        end

        subgraph ReplicacheComponents["Replicache Components"]
            RepCore["Replicache Core"]:::sync
            RepDocs["Documentation System"]:::docs
            RepPerf["Performance Testing"]:::testing
        end

        subgraph Integration["Integration & Deployment"]
            ZBugs["Example App (zbugs)"]:::app
            CICD["CI/CD Pipeline"]:::deployment
        end

        %% Relationships
        Zero --> ZeroClient
        ZeroClient --> ZeroReact
        ZeroClient --> ZeroSolid
        ZeroClient --> ZeroSchema
        ZeroClient --> ZeroCache
        ZeroCache --> ZQL
        ZQL --> ZQLite
        
        Replicache --> RepCore
        RepCore --> RepDocs
        RepCore --> RepPerf
        
        ZBugs --> ZeroClient
        ZBugs --> Replicache
        
        CICD --> Zero
        CICD --> Replicache

    end

    %% Click Events
    click ZeroClient "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zero-client/"
    click ZeroReact "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zero-react/"
    click ZeroSolid "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zero-solid/"
    click ZeroSchema "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zero-schema/"
    click ZeroCache "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zero-cache/"
    click ZQL "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zql/"
    click ZQLite "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/zqlite/"
    click RepCore "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/replicache/"
    click RepDocs "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/replicache/doc/"
    click RepPerf "https://github.com/cbnsndwch/rocicorp-mono/tree/main/packages/replicache-perf/"
    click ZBugs "https://github.com/cbnsndwch/rocicorp-mono/tree/main/apps/zbugs/"
    click CICD "https://github.com/cbnsndwch/rocicorp-mono/tree/main/.github/workflows/"

    %% Styling
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#2ecc71,stroke:#27ae60,color:white
    classDef engine fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:white
    classDef sync fill:#9b59b6,stroke:#8e44ad,color:white
    classDef docs fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef testing fill:#e67e22,stroke:#d35400,color:white
    classDef app fill:#1abc9c,stroke:#16a085,color:white
    classDef deployment fill:#34495e,stroke:#2c3e50,color:white
```
