# calamina/calamina-cafe architecture

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

- Interactive diagram: https://gitdiagram.com/calamina/calamina-cafe
- Repository: https://github.com/calamina/calamina-cafe

## Overview

##### Main Components
- Astro Static Site Generator Core:
- The base configuration is in astro.config.mjs, setting up the build and routing.
- The public folder and package.json indicate standard static site assets and node-based dependencies.
- Content Layer (Data Source):
- Under src/collections and its subdirectories (about, projects/phone, projects/web), YAML files organize the website’s content (favorites, projects, resume, now links, etc.).
- This represents your “data” or content backend that feeds into the pages.
- Page Routing & Layouts:
- The src/pages directory holds the route definitions (.astro pages for home, about, projects, and even dynamic project pages).
- Layouts (in src/layouts) like BaseLayout, MainLayout, and ProjectLayout structure the views.
- UI Components:
- Combination of Vue and Astro components which indicates hybrid templating.
- Styling & Assets:
- The assets directory holds style files (using SCSS), images, SVGs, and fonts.
- Assets for projects are organized under src/assets/img/content, supporting different sections (phone and web projects), which underlines the design’s visual element.
- Models and Utilities:
- The src/models directory provides TypeScript definitions (Link, Media, Moment, Project, etc.) that define the data structures.
- The src/utils folder contains helper functions (e.g., images utilities) and enums that support component logic and data processing.

##### Relationships and Data Flow
- Content Flow:
- Content from YAML files (collections) is consumed by pages under src/pages. Pages use this data via the models (which help ensure type correctness) and render dynamic components.
- Layout and Component Interaction:
- The layouts define the shared structure (header, footer, navigation bars) and include various components from the src/components directory.
- For instance, a project page (coming from src/pages/projects/web/[project].astro) will import components such as ProjectGallery, ProjectInfo, and ProjectNavigation.
- Styling and Image Management:
- SCSS styles from src/assets/style are applied globally and through component-scoped styles.
- The images are organized and referenced from the assets or public folder, with utilities handling image transformations or paths as needed.
- External Dependencies & Build Tools:
- package.json and package-lock.json reflect all external Node modules required, and the astro.config.mjs file configures the build.
- The use of VS Code settings (e.g., .vscode folder) and tsconfig.json shows that the project adheres to TypeScript best practices.

##### Architectural Patterns and Design Principles
- Static Site Generation (SSG):
- The project is structured for static site generation using Astro, emphasizing content-based routing and pre-built pages.
- Component-Based UI:
- By separating UI elements into components, the design adheres to modern component-based architecture. This also facilitates reusability across various pages.
- Clear Separation Between Content and Presentation:
- YAML collection files (content) are entirely separate from the presentation logic (layouts and components), promoting modularity.
- Type Safety:
- The use of models in TypeScript supports a strongly typed codebase.

##### Final Elements
- Annotations for external dependencies like Node modules, configuration files, and build tools.

This detailed approach ensures that no essential part is overlooked and that the architecture is communicated clearly, making it straightforward for anyone to understand the interplay of components in the project.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Layer 1: Astro Core"
        AC1["astro.config.mjs"]:::astroCore
        AC2["package.json"]:::astroCore
        AC3["package-lock.json"]:::astroCore
        AC4["public"]:::astroCore
    end

    subgraph "Layer 2: Content Layer"
        CL1["Collections (YAML)"]:::contentLayer
        CL2["About Content"]:::contentLayer
        CL3["Projects Content"]:::contentLayer
    end

    subgraph "Layer 3: Models & Utilities"
        MD["Models (TypeScript)"]:::modelsUtil
        UT["Utilities"]:::modelsUtil
    end

    subgraph "Layer 4: Pages & Layouts"
        P["Pages"]:::pagesLayouts
        L["Layouts (Base, Main, Project)"]:::pagesLayouts
    end

    subgraph "Layer 5: UI Components"
        UC["UI Components (Astro/Vue)"]:::uiComponents
    end

    subgraph "Layer 6: Assets & Styling"
        A1["SCSS Styles"]:::assetsStyling
        A2["Images & SVGs"]:::assetsStyling
    end

    %% Relationships
    AC1 -->|"configures"| CL1
    CL1 -->|"contains"| CL2
    CL1 -->|"contains"| CL3
    CL1 -->|"feeds"| MD
    CL1 -->|"feeds"| UT
    CL1 -->|"suppliesDataTo"| P
    MD -->|"providesTypesTo"| P
    UT -->|"providesUtilsTo"| P
    P -->|"rendersUsing"| L
    L -->|"incorporates"| UC
    UC -->|"styledBy"| A1
    UC -->|"displaysMediaVia"| A2

    %% Click Events for Astro Core
    click AC1 "https://github.com/calamina/calamina-cafe/blob/master/astro.config.mjs"
    click AC2 "https://github.com/calamina/calamina-cafe/blob/master/package.json"
    click AC3 "https://github.com/calamina/calamina-cafe/blob/master/package-lock.json"
    click AC4 "https://github.com/calamina/calamina-cafe/tree/master/public"

    %% Click Events for Content Layer
    click CL1 "https://github.com/calamina/calamina-cafe/tree/master/src/collections"
    click CL2 "https://github.com/calamina/calamina-cafe/tree/master/src/collections/about"
    click CL3 "https://github.com/calamina/calamina-cafe/tree/master/src/collections/projects"

    %% Click Events for Models & Utilities
    click MD "https://github.com/calamina/calamina-cafe/tree/master/src/models"
    click UT "https://github.com/calamina/calamina-cafe/tree/master/src/utils"

    %% Click Events for Pages & Layouts
    click P "https://github.com/calamina/calamina-cafe/tree/master/src/pages"
    click L "https://github.com/calamina/calamina-cafe/tree/master/src/layouts"

    %% Click Event for UI Components
    click UC "https://github.com/calamina/calamina-cafe/tree/master/src/components"

    %% Click Events for Assets & Styling
    click A1 "https://github.com/calamina/calamina-cafe/tree/master/src/assets/style"
    click A2 "https://github.com/calamina/calamina-cafe/tree/master/src/assets/img"

    %% Styles
    classDef astroCore fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef contentLayer fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef modelsUtil fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef pagesLayouts fill:#ffebcc,stroke:#ff9900,stroke-width:2px;
    classDef uiComponents fill:#e6ccff,stroke:#9900cc,stroke-width:2px;
    classDef assetsStyling fill:#d9f2d9,stroke:#339966,stroke-width:2px;
```
