# filecoinfoundationweb/filecoin-foundation architecture

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

- Interactive diagram: https://gitdiagram.com/filecoinfoundationweb/filecoin-foundation
- Repository: https://github.com/filecoinfoundationweb/filecoin-foundation

## Overview

##### Monorepo and Build System
- At the highest level, show the monorepo’s central control via Turborepo. Label a “Build & Task Runner” component that represents Turborepo, including its remote caching feature (with Vercel) and the commands (dev, build, start).
- Version control and CI/CD integration by including GitHub workflow components (e.g., pull_request_template, dependabot, various CI pipelines).

##### Applications (the “apps” directory)
- Main applications. For example, you have multiple web sites such as “ff-site” and “ffdweb-site.”
- For each application, indicate that they are Next.js (or similar React-based) projects. You might show separate blocks for client-side code, public assets (assets, images, etc.), routing configurations (next.config.js, page directories), and testing (Cypress tests).

##### Shared Packages (the “packages” directory)
- ESLint and Typescript configurations (e.g., eslint-config, typescript-config).
- React hooks (e.g., hooks) providing shared state and interface logic.
- UI components (e.g., packages/ui) which encapsulate common components (buttons, navigation, layout, etc.).
- Utility functions and shared tools (e.g., packages/utils) that include functions for markdown processing, image utilities, URL manipulations, schema definitions, etc.
- How these packages are consumed by various applications in the “apps” directory.

##### Architectural Patterns & Design Principles
- Modularity and reusability. The separation between applications and shared packages shows an adherence to the DRY principle.
- Demonstrate a component-based architecture (reflecting React and Next.js solutions) along with clear separation of concerns (presentation, state management, utility functions).

##### Data Flow & Interactions
- Build system (Turborepo) with both the applications and the packages to demonstrate how a single developer command (like “npm run dev” or “turbo dev”) triggers all individual apps.

##### Additional Components
- CI/CD and remote caching: Create a “CI/CD” block that incorporates all configured GitHub workflows and Turborepo’s caching (including Vercel integration).
- Configuration and deployment: Include a configuration node that points to tools like Next.js configuration (next.config.js), postcss.config.js, and package.json build scripts.
- Testing: Mark out the testing modules, especially Cypress, to show that there’s automated end-to-end testing for each application.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Top Level Components
    BT["Build & Task Runner (Turborepo)"]:::build
    CI["CI/CD and Remote Caching"]:::ci

    %% Applications Subgraph
    subgraph "Applications"
        FS["ff‑site Application (Next.js)"]:::app
        FDS["ffdweb‑site Application (Next.js)"]:::app
    end

    %% Shared Packages Subgraph
    subgraph "Shared Packages"
        ESL["ESLint Config"]:::config
        TS["TypeScript Config"]:::config
        HR["Shared React Hooks"]:::package
        UI["Shared UI Components"]:::package
        UT["Utility Functions and Shared Tools"]:::package
    end

    %% Connections between Top Level Components
    CI -->|"triggers"| BT

    %% Build System triggers Applications and Packages
    BT -->|"builds"| FS
    BT -->|"builds"| FDS
    BT -->|"builds"| ESL
    BT -->|"builds"| TS
    BT -->|"builds"| HR
    BT -->|"builds"| UI
    BT -->|"builds"| UT

    %% Applications depend on Shared Packages
    FS -->|"uses"| ESL
    FS -->|"uses"| TS
    FS -->|"uses"| HR
    FS -->|"uses"| UI
    FS -->|"uses"| UT

    FDS -->|"uses"| ESL
    FDS -->|"uses"| TS
    FDS -->|"uses"| HR
    FDS -->|"uses"| UI
    FDS -->|"uses"| UT

    %% Styles
    classDef build fill:#F5B7B1,stroke:#000,stroke-width:2px;
    classDef ci fill:#F9E79F,stroke:#000,stroke-width:2px;
    classDef app fill:#AED6F1,stroke:#000,stroke-width:2px;
    classDef config fill:#D2B4DE,stroke:#000,stroke-width:2px;
    classDef package fill:#A9DFBF,stroke:#000,stroke-width:2px;

    %% Click Events
    click BT "https://github.com/filecoinfoundationweb/filecoin-foundation/blob/main/turbo.json"
    click CI "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/.github/"
    click FS "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/apps/ff‑site"
    click FDS "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/apps/ffdweb‑site"
    click ESL "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/packages/eslint‑config"
    click TS "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/packages/typescript‑config"
    click HR "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/packages/hooks"
    click UI "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/packages/ui"
    click UT "https://github.com/filecoinfoundationweb/filecoin-foundation/tree/main/packages/utils"
```
