# readr-media/sachiel architecture

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

- Interactive diagram: https://gitdiagram.com/readr-media/sachiel
- Repository: https://github.com/readr-media/sachiel

## Overview

##### Main components
- Monorepo Root: Represent core configuration files (.dockerignore, Dockerfile, lerna.json, package.json) and tools that govern the entire repo (husky, yarn workspaces, lerna).
- Shared configurations and utilities: Show common pieces—like ESLint configuration files, tailwind.config.js, and global styles—that are referenced across multiple packages.
- Infrastructure & Integration Tools: Include husky (for commit hooks), lerna (for package management), and yarn workspaces (for dependency resolution).

##### Directory structure for architectural patterns
- Each sub-package (for example, packages/mesh) has a highly granular directory structure, splitting features by pages, components, hooks, contexts, utilities, GraphQL queries/mutations, and shared assets.
- Multiple “api”, “graphql”, “components”, and “pages” directories indicate that each project is a full-fledged Next.js application with its own routing, data fetching (via GraphQL and Apollo), and UI components.
- The numerous nested folders for variations (e.g., different mobile, tablet, and desktop components) suggest a separation of concerns based on device-specific or feature-specific UI components.

## Diagram (Mermaid)

```mermaid
graph TB
    Monorepo_Root["Monorepo Root"]:::monorepo

    %% Package container nodes
    MeshRoot["Packages/mesh"]:::package
    PTRoot["Packages/politics-tracker"]:::package
    ReadrRoot["Packages/readr"]:::package

    %% Shared Configurations & Utilities cluster
    subgraph "Shared Configurations & Utilities"
        ESLint["ESLint Configuration"]:::shared
        Tailwind["Tailwind Configuration"]:::shared
        GlobalStyles["Global Styles"]:::shared
    end

    %% Infrastructure & Integration Tools cluster
    subgraph "Infrastructure & Integration Tools"
        Husky["Husky (Git Hooks)"]:::integration
        Lerna["Lerna"]:::integration
        YarnWor["Yarn Workspaces"]:::integration
    end

    %% Package Details for Mesh
    subgraph "Mesh Details"
        M_Frontend["Mesh: Frontend (Pages & Routing)"]:::package
        M_API["Mesh: GraphQL & API Layer"]:::package
        M_Utils["Mesh: Shared Utilities & Contexts"]:::package
        M_External["Mesh: External Integrations"]:::service
    end

    %% Package Details for Politics-Tracker
    subgraph "Politics-Tracker Details"
        PT_Frontend["PoliticsTracker: Frontend Components & Pages"]:::package
        PT_Styles["PoliticsTracker: Shared Styling & Assets"]:::package
        PT_GraphQL["PoliticsTracker: GraphQL Integration"]:::service
        PT_Contexts["PoliticsTracker: Context & Utilities"]:::package
    end

    %% Package Details for Readr
    subgraph "Readr Details"
        R_Frontend["Readr: Frontend (Pages & Layout)"]:::package
        R_GraphQL["Readr: GraphQL & Apollo Integration"]:::service
        R_Components["Readr: Shared Components & Utilities"]:::package
        R_Contexts["Readr: Contexts"]:::package
        R_Public["Readr: Static Assets & Public Files"]:::package
    end

    %% Connect Monorepo Root to Package containers
    Monorepo_Root --> MeshRoot
    Monorepo_Root --> PTRoot
    Monorepo_Root --> ReadrRoot

    %% Connect Monorepo Root to Shared Configurations & Integration Tools
    Monorepo_Root --> ESLint
    Monorepo_Root --> Husky
    Monorepo_Root --> Lerna
    Monorepo_Root --> YarnWor

    %% Connect Package containers to their detailed components
    MeshRoot --> M_Frontend
    MeshRoot --> M_API
    MeshRoot --> M_Utils
    MeshRoot --> M_External

    PTRoot --> PT_Frontend
    PTRoot --> PT_Styles
    PTRoot --> PT_GraphQL
    PTRoot --> PT_Contexts

    ReadrRoot --> R_Frontend
    ReadrRoot --> R_GraphQL
    ReadrRoot --> R_Components
    ReadrRoot --> R_Contexts
    ReadrRoot --> R_Public

    %% Data flow arrows within packages
    M_API -->|"data_flow"| M_Frontend
    PT_GraphQL -->|"data_flow"| PT_Frontend
    R_GraphQL -->|"data_flow"| R_Frontend

    %% Dotted links to denote shared configuration usage
    MeshRoot --- ESLint
    PTRoot --- ESLint
    ReadrRoot --- ESLint

    %% Husky triggers (CI/CD flow)
    Husky -->|"triggers"| Monorepo_Root

click Monorepo_Root "https://github.com/readr-media/sachiel/blob/dev/package.json"
click MeshRoot "https://github.com/readr-media/sachiel/tree/dev/packages/mesh"
click M_Frontend "https://github.com/readr-media/sachiel/tree/dev/packages/mesh/app"
click M_API "https://github.com/readr-media/sachiel/tree/dev/packages/mesh/apollo"
click M_Utils "https://github.com/readr-media/sachiel/tree/dev/packages/mesh/context"
click M_External "https://github.com/readr-media/sachiel/tree/dev/packages/mesh/firebase"

click PTRoot "https://github.com/readr-media/sachiel/tree/dev/packages/politics-tracker"
click PT_Frontend "https://github.com/readr-media/sachiel/tree/dev/packages/politics-tracker/pages"
click PT_Styles "https://github.com/readr-media/sachiel/tree/dev/packages/politics-tracker/styles"
click PT_GraphQL "https://github.com/readr-media/sachiel/tree/dev/packages/politics-tracker/graphql"
click PT_Contexts "https://github.com/readr-media/sachiel/tree/dev/packages/politics-tracker/components/react-context"

click ReadrRoot "https://github.com/readr-media/sachiel/tree/dev/packages/readr"
click R_Frontend "https://github.com/readr-media/sachiel/tree/dev/packages/readr/pages"
click R_GraphQL "https://github.com/readr-media/sachiel/blob/dev/packages/readr/apollo-client.ts"
click R_Components "https://github.com/readr-media/sachiel/tree/dev/packages/readr/components"
click R_Contexts "https://github.com/readr-media/sachiel/tree/dev/packages/readr/contexts"
click R_Public "https://github.com/readr-media/sachiel/tree/dev/packages/readr/public"

click ESLint "https://github.com/readr-media/sachiel/blob/dev/.eslintrc.js"
click Tailwind "https://github.com/readr-media/sachiel/blob/dev/packages/mesh/tailwind.config.js"
click GlobalStyles "https://github.com/readr-media/sachiel/blob/dev/packages/mesh/styles/global.css"

click Husky "https://github.com/readr-media/sachiel/blob/dev//.husky"
click Lerna "https://github.com/readr-media/sachiel/blob/dev/lerna.json"
click YarnWor "https://github.com/readr-media/sachiel/blob/dev/package.json"

classDef monorepo fill:#AED6F1,stroke:#2E86C1,stroke-width:2px;
classDef package fill:#ABEBC6,stroke:#28B463,stroke-width:2px;
classDef shared fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
classDef integration fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
classDef service fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
