# dioxuslabs/docsite architecture

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

- Interactive diagram: https://gitdiagram.com/dioxuslabs/docsite
- Repository: https://github.com/dioxuslabs/docsite

## Overview

Based on our analysis of the repository’s file tree and its README, we can conclude that this project is a multi-package monorepo whose primary purpose is to build and serve the dioxuslabs.com website documentation. The website uses the Dioxus framework for both server-side rendering (using dioxus_ssr) and client-side hydration (using dioxus_web). In addition, there are many packages related to documentation routing, MDbook integration, playground examples, and search functionality—all of which support a rich documentation and demo site infrastructure.

##### Main components
- Frontend – The website interface, generated with Dioxus and pre-rendered using dioxus_ssr. It is then rehydrated and enhanced for interactivity in the client browser via dioxus_web.
- Backend/Server – The server component (written in Rust) that pre-generates content and may serve SSR pages. Components here include server functions (possibly in packages like the “playground/server” and “search” modules) as well as support for hot reloading and live updates.
- Documentation Core – The “docs-src” folder and related packages (such as “packages/docsite”, “packages/docs-router”, and MDbook-related packages) form the backbone for generating and routing documentation. This includes components for handling markdown parsing, routing examples, and code preview demos.
- CLI & Tooling – The Dioxus CLI (“dx” tool) that is used for building, serving, and redeploying documentation locally.
- Build/Deployment Infrastructure – Supporting files such as Dockerfile, .github/workflows, and configuration files (Cargo.toml, Dioxus.toml, tailwind.css) which indicate containerization, CI/CD pipelines, and asset building (using Tailwind CSS).
- Playground & Examples – The “packages/playground” package and its submodules provide live and interactive examples of Dioxus usage and might include both desktop and web (SSR/hotreload) components.

##### Relationships and interactions
- The user (client browser) accesses the website which is served by the backend. The server sends pre-rendered HTML that’s then rehydrated on the client.
- A clear separation exists between static documentation content (generated/rebuilt on file changes using the “dx serve” command) and the dynamic interactivity layer added by dioxus_web.
- External build scripts and deployment workflows (contained in .github/workflows and Dockerfile) tie into the CI/CD pipeline, automatically building and deploying the website.
- Documentation generators and routers (packages/docs-router and packages/docsite) interact with the raw markdown content under docs-src to produce the final website layout.
- The CLI (“dx” tool) is used during development to rebuild documentation upon code or markdown changes, triggering re-builds and live reloads.

##### Architectural patterns and principles
- Modular/monorepo structure: The project is organized into multiple packages and libraries (using Cargo) that clearly separate concerns between documentation generation, routing, interactive examples, and deployment.
- SSR with client rehydration: The architecture leverages a combination of server-side rendered pages (for speed and SEO) and client-side interactivity via hydration.
- CI/CD automation: Use of GitHub Actions workflows and Docker for reliable, repeatable builds and deployments.
- Separation of concerns: Frontend components (Dioxus-based UI), server/backend code, documentation tooling, and build/deployment scripts are all isolated in their own directories or packages.

##### Incorporate relevant technologies
- Rust and Cargo for core development.
- Dioxus framework including dioxus_ssr and dioxus_web.
- Tailwind CSS (v4) for styling.
- Docker for containerized deployment.
- GitHub Actions for CI/CD.
- mdBook-like structure for documentation (visible in docs-src and the include_mdbook packages).
- Various packages (playground, search, docs-router, docsite) that tie into the overall documentation and demo website ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development Tools
    subgraph "Development Tools"
        subgraph "CLI & Tooling"
            CLI["Dioxus CLI"]:::cli
        end
        subgraph "Build/Deployment Infrastructure"
            DOCKERFILE["Dockerfile"]:::infra
            WORKFLOWS["GitHub Workflows"]:::infra
            TAILWIND["Tailwind CSS"]:::infra
            INFRA["CI/CD"]:::infra
            DOCKERFILE -->|"merges"| INFRA
            WORKFLOWS -->|"merges"| INFRA
            TAILWIND -->|"merges"| INFRA
        end
    end

    %% Documentation Core
    subgraph "Documentation Core"
        DOCS_SRC["Raw Markdown (docs-src)"]:::doc
        DOCS_ROUTER["Docs Router (packages/docs-router)"]:::doc
        MDBOOK["MDbook Integration (packages/include_mdbook)"]:::doc
        DOCS_SRC -->|"processed"| DOCS_ROUTER
        DOCS_ROUTER -->|"integrates"| MDBOOK
    end

    %% Frontend
    subgraph "Frontend"
        FRONTEND["Website Interface (SSR + Hydration)"]:::frontend
    end

    %% Backend
    subgraph "Backend"
        SSR_SERVER["SSR Server & Server Functions (packages/playground/server)"]:::backend
        SEARCH["Search Module (packages/search)"]:::backend
        SSR_SERVER -->|"calls_search"| SEARCH
    end

    %% Playground & Examples
    subgraph "Playground & Examples"
        PLAYGROUND["Playground & Examples"]:::playground
    end

    %% Client Browser
    CLIENT["Client Browser"]:::external

    %% Interconnections
    CLI -->|"triggers_rebuild"| DOCS_SRC
    CLI -->|"initiates_build"| INFRA
    MDBOOK -->|"static_site"| FRONTEND
    INFRA -->|"deploys"| FRONTEND
    INFRA -->|"deploys"| SSR_SERVER
    FRONTEND -->|"rehydrates"| CLIENT
    SSR_SERVER -->|"delivers_HTML"| CLIENT
    PLAYGROUND -->|"integrates"| FRONTEND
    PLAYGROUND -->|"integrates"| SSR_SERVER

    %% Click Events
    click FRONTEND "https://github.com/dioxuslabs/docsite/blob/main/packages/docsite/src/main.rs"
    click SSR_SERVER "https://github.com/dioxuslabs/docsite/tree/main/packages/playground/server"
    click SEARCH "https://github.com/dioxuslabs/docsite/tree/main/packages/search/search"
    click DOCS_SRC "https://github.com/dioxuslabs/docsite/tree/main/docs-src"
    click DOCS_ROUTER "https://github.com/dioxuslabs/docsite/tree/main/packages/docs-router"
    click MDBOOK "https://github.com/dioxuslabs/docsite/tree/main/packages/include_mdbook"
    click CLI "https://github.com/dioxuslabs/docsite/blob/main/Dioxus.toml"
    click DOCKERFILE "https://github.com/dioxuslabs/docsite/tree/main/Dockerfile"
    click WORKFLOWS "https://github.com/dioxuslabs/docsite/tree/main/.github/workflows"
    click TAILWIND "https://github.com/dioxuslabs/docsite/blob/main/tailwind.css"
    click PLAYGROUND "https://github.com/dioxuslabs/docsite/tree/main/packages/playground"

    %% Styles
    classDef frontend fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef backend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef doc fill:#e5ccff,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef cli fill:#ffccee,stroke:#333,stroke-width:2px;
    classDef playground fill:#ffd9b3,stroke:#333,stroke-width:2px;
    classDef external fill:#ffcccc,stroke:#333,stroke-width:2px;
```
