# node-real/dcellar architecture

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

- Interactive diagram: https://gitdiagram.com/node-real/dcellar
- Repository: https://github.com/node-real/dcellar

## Overview

##### Project type and purpose
- From the file tree and README, this is a monorepo built with Rush that contains a single Next.js-based full-stack web application (“dcellar-web-ui”).
- Purpose: a developer console UI for managing BNB Greenfield decentralized storage—handling buckets, objects, billing, sharing, and token transfers via WalletConnect/MetaMask/Trust Wallet.

##### File structure
- Top-level:
- rush.json, common/, common/config, common/autoinstallers → Rush monorepo configuration
- apps/dcellar-web-ui → the Next.js application
- Within apps/dcellar-web-ui:
- public/ + wasm/ + Dockerfile → static assets & containerization
- src/pages → Next.js pages + serverless API routes
- src/components, src/modules → React UI and feature modules (accounts, buckets, objects, wallet, etc.)
- src/facade → domain-level API facades over BNB Greenfield SDK
- src/context, src/hooks, src/store → React context, custom hooks, Redux slices for state management
- pages/api → backend/edge endpoints that proxy or augment calls to Greenfield RPC, billing, charts
- Build & CI: .github/workflows deploys to QA, Mainnet/Testnet, triggers Docker builds, linting & tests.

##### Architecture synopsis from README
- Technologies: Next.js (SSR/SSG), React, TypeScript, Redux, BNB Greenfield JS SDK, WalletConnect, WASM modules, Sentry, Rush monorepo.
- Core flows:
- Client-side rendering + server-side prefetching (Next.js pages)
- Serverless API routes under /api
- Direct RPC calls to BNB Greenfield and BNB Chain for data & token operations
- Off-chain authentication context for secure user identity
- Fed by React context + Redux for global state.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Browser (Client Tier)"
        direction TB
        RC["React Components"]:::frontend
        RS["Redux Store"]:::frontend
        RCTX["React Contexts"]:::frontend
        WASM["WASM Modules"]:::frontend
        FAC_C["API Facade Layer (Client)"]:::frontend
    end

    %% Backend Layer
    subgraph "Next.js Server (Backend Tier)"
        direction TB
        SSR["SSR Engine"]:::server
        API["API Routes"]:::server
        FAC_S["API Facade Layer (Server)"]:::server
    end

    %% Blockchain & External Services
    subgraph "Blockchain & External Services"
        direction TB
        GF_RPC["BNB Greenfield RPC"]:::blockchain
        CH_RPC["BNB Chain RPC"]:::blockchain
        WALLET["Wallet Providers"]:::blockchain
        AUTH["Off-Chain Auth Service"]:::blockchain
    end

    %% CI/CD & Monitoring
    subgraph "Infrastructure"
        direction TB
        CICD["CI/CD Pipeline"]:::infra
        DOCK["Docker Build"]:::infra
        SENTRY_C["Sentry Client"]:::infra
        SENTRY_E["Sentry Edge"]:::infra
        SENTRY_S["Sentry Server"]:::infra
        RUSH["Rush Monorepo"]:::infra
    end

    %% Data Flows
    RC -->|"dispatch actions"| RS
    RS -->|"invoke facades"| FAC_C
    FAC_C -->|"JSON-RPC/HTTP"| GF_RPC
    RC -->|"loads modules"| WASM
    RC -->|"uses context"| RCTX
    RCTX -->|"auth tokens"| AUTH
    RC -->|"wallet ops"| WALLET

    RC -->|"page request"| SSR
    SSR -->|"renders pages"| RC

    API -->|"calls facades"| FAC_S
    FAC_S -->|"JSON-RPC/HTTP"| GF_RPC
    FAC_S -->|"RPC calls"| CH_RPC

    CICD -->|"builds image"| DOCK
    DOCK -->|"deploys"| SSR

    %% Error & Telemetry
    RC -->|"errors & telemetry"| SENTRY_C
    SSR -->|"errors & telemetry"| SENTRY_S
    API -->|"errors & telemetry"| SENTRY_E

    %% Monorepo Config
    RUSH -->|"manages workspace"| SSR

    %% Click Events
    click RC "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/components"
    click RS "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/store"
    click RCTX "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/context"
    click FAC_C "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/facade"
    click FAC_S "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/facade"
    click WASM "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/public/wasm"
    click SSR "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/pages"
    click API "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/src/pages/api"
    click CICD "https://github.com/node-real/dcellar/tree/main/.github/workflows"
    click DOCK "https://github.com/node-real/dcellar/tree/main/apps/dcellar-web-ui/Dockerfile"
    click SENTRY_C "https://github.com/node-real/dcellar/blob/main/apps/dcellar-web-ui/sentry.client.config.js"
    click SENTRY_E "https://github.com/node-real/dcellar/blob/main/apps/dcellar-web-ui/sentry.edge.config.js"
    click SENTRY_S "https://github.com/node-real/dcellar/blob/main/apps/dcellar-web-ui/sentry.server.config.js"
    click RUSH "https://github.com/node-real/dcellar/blob/main/rush.json"
    click RUSH "https://github.com/node-real/dcellar/tree/main/common/"
    click RUSH "https://github.com/node-real/dcellar/tree/main/common/config/rush"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1F618D,color:#1B4F72
    classDef server fill:#FAD7A0,stroke:#B9770E,color:#7E5109
    classDef blockchain fill:#ABEBC6,stroke:#239B56,color:#1D8348
    classDef infra fill:#D5D8DC,stroke:#616A6B,color:#1B2631
```
