# decadez/decadez.icu-main architecture

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

- Interactive diagram: https://gitdiagram.com/decadez/decadez.icu-main
- Repository: https://github.com/decadez/decadez.icu-main

## Overview

##### Project Type and Purpose
- This repository holds the “Website” portion of the decadez.icu ecosystem—a documentation/blog site built with Next.js (React + TypeScript) that sources its content from local Markdown/MDX files.
- Although the overall monorepo also plans for an Antd‑S component library and a NestJS backend, the tree you provided is purely the Next.js “website‑main” project.

##### File Structure Analysis
- Top‐level config and metadata:
- .github/ (CI workflows, issue templates)
- Dockerfile, .env.* , next.config.js, tsconfig.json, postcss.config.js, tailwind.config.js
- Public assets:
- public/images/, robots.txt
- Source code under src/:
- pages/ — Markdown (.md/.mdx) and TSX files defining routes (SSG/SSR)
- plugins/ — custom MDX + markdown processing pipelines
- constants/ — sidebar definitions, link maps, repo URLs
- utils/ — small reusable helpers
- styles/ — global CSS (Tailwind, Algolia, Sandpack)
- Deployment:
- Dockerfile + GitHub Actions (node.js.yml) handle CI/CD → container build → publish.

##### Core Components and Their Relationships
a. Developer & CI/CD
- Developer pushes to GitHub → GitHub Actions triggers → builds Docker image → pushes to registry or hosting.
b. Hosting & Delivery
- Container runs Next.js server (or static export) on production → public assets and generated HTML/CSS/JS served via CDN.
c. Next.js Application
- Pages:
- SSG: builds at `npm run build` by reading Markdown in src/pages/.
- SSR: dynamic routes (if any) served on request.
- MDX Pipeline: custom plugins (markdownToHtml, remark‑header‑custom‑ids, smartypants) convert Markdown → JSX.
- React Component Library: page templates import reusable components (Layout, Nav, Sidebar, CodeBlock, Sandpack).
d. External Services
- Algolia for search indexing.
- CodeSandbox/Sandpack for in‑page code editing & preview.
- (Potentially) GitHub-hosted repo for CI and content versioning.

##### Architectural Patterns & Design Principles
- Hybrid SSR/SSG: leverages Next.js’s static generation for documentation and SSR for any dynamic content.
- Plugin‑based content processing: keeps parsing logic decoupled from page components.
- Monorepo‑friendly: separates “website‑main” from other workspaces (Antd‑S, backend) but likely under a root; uses shared TypeScript types.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer and Source Control
    Dev["Developer"]:::ci
    Dev -->|push code| GH["GitHub"]:::ci
    GH --> CI_CD["CI/CD Pipeline"]:::ci
    click CI_CD "https://github.com/decadez/decadez.icu-main/blob/main/.github/workflows/node.js.yml"

    %% Build Process
    CI_CD --> Docker["Docker Build & Registry"]:::platform
    click Docker "https://github.com/decadez/decadez.icu-main/tree/main/website-main/dockerfile"
    Docker --> Registry["Container Registry"]:::platform

    %% Deployment
    Registry --> Host["Production Host\n(Container Runtime + CDN)"]:::platform
    Host -->|serves| Browser["Browser"]:::app

    %% Next.js Application
    Host --> App["Next.js Application"]:::app

    subgraph "Next.js Application" 
      direction TB
      subgraph "Pages Layer (SSG/SSR)"
        direction TB
        Pages["src/pages/"]:::app
        click Pages "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/pages/"
      end

      subgraph "MDX/Markdown Plugin Layer"
        direction TB
        Plugins["plugins/"]:::app
        click Plugins "https://github.com/decadez/decadez.icu-main/tree/main/website-main/plugins/"
      end

      subgraph "Component Library (UI)"
        direction TB
        Components["src/components/"]:::app
        click Components "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/components/"
        SandpackComp["src/components/MDX/Sandpack/"]:::app
        click SandpackComp "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/components/MDX/Sandpack/"
      end

      subgraph "Static Assets"
        direction TB
        Public["public/"]:::app
        click Public "https://github.com/decadez/decadez.icu-main/tree/main/website-main/public/"
      end

      subgraph "Styles, Config, and Utilities"
        direction TB
        Styles["src/styles/"]:::app
        click Styles "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/styles/"
        Constants["src/constants/"]:::app
        click Constants "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/constants/"
        Utils["src/utils/"]:::app
        click Utils "https://github.com/decadez/decadez.icu-main/tree/main/website-main/src/utils/"
        Types["src/@types/index.d.ts"]:::app
        click Types "https://github.com/decadez/decadez.icu-main/blob/main/website-main/src/@types/index.d.ts"
        Env[".env.development\n.env.production"]:::app
        click Env "https://github.com/decadez/decadez.icu-main/blob/main/website-main/.env.development"
        click Env "https://github.com/decadez/decadez.icu-main/blob/main/website-main/.env.production"
        NextConf["next.config.js"]:::app
        click NextConf "https://github.com/decadez/decadez.icu-main/blob/main/website-main/next.config.js"
        Hooks[".husky/pre-commit.sh"]:::app
        click Hooks "https://github.com/decadez/decadez.icu-main/blob/main/website-main/.husky/pre-commit.sh"
      end
    end

    %% External Services
    App -->|search queries| Algolia["Algolia"]:::external
    App -->|embed editor| SandpackCloud["Sandpack"]:::external
    App -->|versioning| GitHubRepo["GitHub (content repo)"]:::external

    %% Monorepo Context
    AntdS["Antd‑S Component Library"]:::app
    NestJS["NestJS Backend"]:::app
    AntdS --> Components
    NestJS --> App

    %% Styles
    classDef ci fill:#D0E6FF,color:#000
    classDef platform fill:#DFFFE0,color:#000
    classDef app fill:#FFE6B0,color:#000
    classDef external fill:#E3C0FF,color:#000
    class Registry cylinder
    class Algolia,LandpackCloud cloud
```
