# dsan01/dscode architecture

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

- Interactive diagram: https://gitdiagram.com/dsan01/dscode
- Repository: https://github.com/dsan01/dscode

## Overview

##### Project Type and Purpose
- This is a Jamstack-style static website built with the Astro framework.
- Its purpose is to generate a multilingual portfolio or services site, sourcing content from local markdown files (`src/data/project/...`) and static TypeScript data (`src/data/static/*`). It uses Astro’s island architecture to render most of the page at build time, with interactive bits powered by React (TSX components).

##### File Structure Analysis
- Top-level:
- `public/` – truly static files (images, favicon, etc.).
- `astro.config.mjs`, `package.json` – build/config.
- `src/`:
- `assets/` – raw images, 404 graphics.
- `components/` – UI split into `generics`, `primitives`, `sections`, and `ui`.
- `data/` – content sources:
– `project/*` (multilingual markdown),
– `static/` (TS data for services and trajectory).
- `pages/` – route files (Astro templates) including dynamic `[slug].astro`.
- `layouts/` – top-level layout wrapper.
- `lib/` – helper code (DOM selectors, Strapi client stub).
- `i18n/` – internationalization utilities and UI strings.
- `store/` – client-side state management for filters.
- `styles/`, `types/`, `tsconfig.json` – styling and TypeScript support.

##### Key Insights from README
- This project started from Astro’s “basics” template; core behaviors (build, dev server, preview) follow Astro’s standard CLI.
- No cloud-native or back-end service beyond static files; dynamic behavior is limited to client islands and optional Strapi fetching.

a. Main Components
1. **Content Sources**
- Local Markdown files (`src/data/project/*`)
- Static TS data (`src/data/static/*`)
2. **Astro Build Engine**
- Reads `astro.config.mjs`
- Parses pages and components, applies layouts
- Generates static HTML/CSS/JS in `dist/`
3. **Component Library**
- Astro components (`.astro`) for static parts
- React/TSX components for interactive islands
4. **Internationalization Layer**
- `src/i18n/*` utilities inject translations at build time
5. **Client-Side Runtime**
- Small React/Preact islands for UI state (filter store, modals, carousel)
6. **Static Assets**
- `public/` folder served untouched
7. **(Optional) External API**
- `src/lib/strapi.ts` indicates potential Strapi CMS integration

b. Relationships & Data Flows
- At **Build Time**:
- Content Sources → Astro Build Engine → Pages & Layouts → Static HTML/CSS
- i18n Utilities transform text for each locale → Inject into pages/components
- At **Client Runtime**:
- User → interacts with React/TSX islands → state in `store/` → UI updates
- Static assets and JS bundles served by CDN
- (If used) API calls to Strapi → dynamic content fetched in islands

c. Architectural Patterns & Principles
- **Jamstack**: Pre-built assets, decoupled front end, served via CDN
- **Component-Based UI**: Clear separation into generics/primitives/sections/ui
- **Island Architecture**: Only hydrate interactive pieces of the page
- **Directory-Driven Routing**: Astro pages folder automatically defines routes

d. Key Technologies
- Astro (Static site generator)
- TypeScript, React/Preact for interactive islands
- Markdown for content
- CSS (global.css)
- (Optional) Strapi API client

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources
    subgraph "Content Sources"
        direction TB
        MarkdownContent["Local Markdown Files"]:::data
        StaticTSData["Static TS Data"]:::data
        StrapiCMS["Optional Strapi CMS"]:::external
    end

    %% Build Configuration
    subgraph "Build Configuration" 
        direction TB
        AstroConfig["astro.config.mjs"]:::build
        ContentConfig["src/content.config.ts"]:::build
    end

    %% Component Library
    subgraph "Component Library (src/components)"
        direction TB
        Generics["Generics"]:::build
        Primitives["Primitives"]:::build
        SectionsIndex["Sections (Index)"]:::build
        SectionsProjects["Sections (Projects)"]:::build
        UIWidgets["UI Widgets"]:::build
    end

    %% Layouts and Pages
    subgraph "Layouts & Pages"
        direction TB
        LayoutWrapper["Layout Wrapper"]:::build
        PagesDir["Route Definitions (Pages)"]:::build
    end

    %% Internationalization
    subgraph "Internationalization (src/i18n)"
        direction TB
        I18nUtils["utils.ts"]:::build
        I18nUI["ui.ts"]:::build
    end

    %% Helpers & Types
    subgraph "Libraries & Types"
        direction TB
        StrapiClient["strapi.ts"]:::external
        DOMHelper["dom-selector.ts"]:::build
        Store["SelectedFilterStore.ts"]:::runtime
        TypesDef["Type Definitions"]:::build
        GlobalStyles["global.css"]:::asset
    end

    %% Build Engine
    AstroBuild["Astro Build Engine"]:::build

    %% Output & Hosting
    DistOutput["dist/ (Static Site)"]:::asset
    CDN["CDN / Static Hosting"]:::asset

    %% Runtime
    subgraph "Client Runtime"
        direction TB
        Browser["User Browser"]:::runtime
        JSBundle["JS Bundles"]:::runtime
        ReactIslands["React/TSX Islands"]:::runtime
    end

    %% Connections - Build Time
    MarkdownContent --> AstroBuild
    StaticTSData --> AstroBuild
    StrapiCMS --> AstroBuild
    AstroConfig --> AstroBuild
    ContentConfig --> AstroBuild
    Generics --> AstroBuild
    Primitives --> AstroBuild
    SectionsIndex --> AstroBuild
    SectionsProjects --> AstroBuild
    UIWidgets --> AstroBuild
    LayoutWrapper --> AstroBuild
    PagesDir --> AstroBuild
    I18nUtils --> AstroBuild
    I18nUI --> AstroBuild
    DOMHelper --> AstroBuild
    TypesDef --> AstroBuild
    GlobalStyles --> AstroBuild

    AstroBuild --> DistOutput
    DistOutput --> CDN

    %% Connections - Runtime
    CDN --> Browser
    Browser --> JSBundle
    JSBundle --> ReactIslands
    ReactIslands --> Store
    Store --> ReactIslands

    %% Click Events
    click MarkdownContent "https://github.com/dsan01/dscode/tree/main/src/data/project/"
    click StaticTSData "https://github.com/dsan01/dscode/blob/main/src/data/static/ServiceProjectData.ts"
    click StaticTSData "https://github.com/dsan01/dscode/blob/main/src/data/static/TrajectoryData.ts"
    click AstroConfig "https://github.com/dsan01/dscode/blob/main/astro.config.mjs"
    click ContentConfig "https://github.com/dsan01/dscode/blob/main/src/content.config.ts"
    click LayoutWrapper "https://github.com/dsan01/dscode/blob/main/src/layouts/Layout.astro"
    click PagesDir "https://github.com/dsan01/dscode/tree/main/src/pages/"
    click Generics "https://github.com/dsan01/dscode/tree/main/src/components/generics/"
    click Primitives "https://github.com/dsan01/dscode/tree/main/src/components/primitives/"
    click SectionsIndex "https://github.com/dsan01/dscode/tree/main/src/components/sections/index/"
    click SectionsProjects "https://github.com/dsan01/dscode/tree/main/src/components/sections/projects/"
    click UIWidgets "https://github.com/dsan01/dscode/tree/main/src/components/ui/"
    click I18nUtils "https://github.com/dsan01/dscode/blob/main/src/i18n/utils.ts"
    click I18nUI "https://github.com/dsan01/dscode/blob/main/src/i18n/ui.ts"
    click Store "https://github.com/dsan01/dscode/blob/main/src/store/SelectedFilterStore.ts"
    click StrapiClient "https://github.com/dsan01/dscode/blob/main/src/lib/strapi.ts"
    click DOMHelper "https://github.com/dsan01/dscode/blob/main/src/lib/dom-selector.ts"
    click GlobalStyles "https://github.com/dsan01/dscode/blob/main/src/styles/global.css"
    click TypesDef "https://github.com/dsan01/dscode/tree/main/src/types/"

    %% Styles
    classDef build fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef runtime fill:#D0FFD8,stroke:#008a00,color:#008a00;
    classDef data fill:#FFE8A1,stroke:#d68600,color:#d68600;
    classDef external fill:#FFD1D1,stroke:#d60000,color:#d60000;
    classDef asset fill:#F0F0F0,stroke:#888888,color:#555555;
```
