# steef-o/hvilken-baat-er-det-i-dag architecture

> Architecture diagram of the GitHub repository steef-o/hvilken-baat-er-det-i-dag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/steef-o/hvilken-baat-er-det-i-dag
- Repository: https://github.com/steef-o/hvilken-baat-er-det-i-dag

## Overview

##### Project type and purpose
- This is a single-page front-end application built with React + TypeScript, bundled by Vite, styled with Tailwind CSS, and deployed as a static site (demo on Vercel).
- Purpose: At runtime it displays which cruise ship(s) are currently visiting Eidfjord.

##### High-level file-structure analysis
- Top‐level config & build files:
- package.json / package-lock.json – NPM dependencies & scripts
- vite.config.ts – Vite bundler config
- tailwind.config.js & postcss.config.js – Tailwind CSS setup
- tsconfig*.json – TypeScript settings
- vitest.config.ts – unit-test runner config
- biome.json – code-formatting rules
- Static asset & entry point:
- index.html – SPA container
- src/index.css – global styles
- src/main.tsx – React entry & Vite client hookup
- Application code:
- src/components – all UI components
- src/state/Atoms.tsx – atom-based state management
- src/assets/img – illustrations & ship imagery

##### Key architectural patterns & tech
- Single-page app (SPA) using the component-composition pattern.
- Global, fine-grained state via “Atoms” (e.g., Jotai/Recoil style).
- Build pipeline: Vite dev server → bundle → Tailwind CSS post-processing → static files.
- Deployment: Continuous build to Vercel (serves via CDN).
- (Optionally) runtime data source: external Cruise‐Data API for “currently visiting” info.

##### Main components
A. User & Client Environment
- Browser (User)
- React SPA
- Components: Toolbar, DailyMessage, Illustration, ShipList (Field, ShipListItem)
- State Layer: Atoms.tsx
- Assets: Images (src/assets/img)
B. Build/CI Pipeline
- Vite Dev Server (local)
- Vite + Tailwind + PostCSS → Bundled JS/CSS
- Biome (formatter) & Vitest (tests)
- Continuous Integration (Git → Vercel)
C. Hosting & Runtime Services
- Static Hosting (Vercel/CDN)
- (Optional) External Cruise Data API

##### Relationships & data flows
1. Developer runs `npm run dev` → Vite serves index.html → React SPA loads in browser.
2. On mount, SPA (via Atoms) fetches “current ships” from external API → stores in state.
3. UI components subscribe to state atoms → render list & messages.
4. CI pipeline triggers build → artifacts published to Vercel → CDN serves static files to end users.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Client Environment
    subgraph "User & Client Environment"
        User["User"]:::external
        Browser["Browser"]:::external
        subgraph "React SPA"
            Container["index.html"]:::frontend
            Entry["src/main.tsx"]:::frontend
            Styles["src/index.css"]:::frontend
            subgraph "UI Components"
                Toolbar["Toolbar"]:::frontend
                DM["DailyMessage"]:::frontend
                Ill["Illustration"]:::frontend
                subgraph "ShipList"
                    SL["ShipList"]:::frontend
                    Field["Field"]:::frontend
                    Item["ShipListItem"]:::frontend
                end
            end
            State["src/state/Atoms.tsx"]:::state
            Assets["src/assets/img"]:::assets
        end
    end

    %% Build & CI Pipeline
    subgraph "Build & CI Pipeline"
        Dev["Vite Dev Server (npm run dev)"]:::build
        Git["Git (repo)"]:::build
        CI["CI Pipeline"]:::build
        Bundle["Bundle: Vite + Tailwind + PostCSS"]:::build
        Formatter["Biome (formatter)"]:::build
        Tests["Vitest (tests)"]:::build
        CFG1["vite.config.ts"]:::build
        CFG2["tailwind.config.js"]:::build
        CFG3["postcss.config.js"]:::build
        CFG4["tsconfig.json & tsconfig.node.json"]:::build
        CFG5["biome.json"]:::build
        CFG6["vitest.config.ts"]:::build
        CFG7["package.json & package-lock.json"]:::build
        CFG8["src/vite-env.d.ts"]:::build
        CFG9["README.md"]:::build
    end

    %% Hosting & Runtime
    subgraph "Hosting & Runtime"
        Vercel["Vercel"]:::hosting
        CDN["CDN"]:::hosting
    end

    %% External Services
    subgraph "External Services"
        API["Cruise Data API"]:::externalService
    end

    %% Connections - Client Flow
    User --> Browser --> Container --> Entry
    Entry --> Styles
    Entry --> State
    State --> API
    API --> State
    State --> Toolbar
    State --> DM
    State --> Ill
    State --> SL
    Ill --> Assets
    SL --> Field
    SL --> Item

    %% Connections - Dev Flow
    Dev --> Dev
    Dev --> Dev["Vite Dev Server (npm run dev)"]
    Dev --> Dev

    Dev --> Bundle
    CFG1 --> Bundle
    CFG2 --> Bundle
    CFG3 --> Bundle
    CFG4 --> Bundle

    Formatter --> CI
    Tests --> CI
    CFG5 --> CI
    CFG6 --> CI
    CFG7 --> CI
    CFG8 --> CI
    CFG9 --> CI
    Git --> CI
    CI --> Bundle

    Bundle --> Vercel
    Vercel --> CDN
    CDN --> Browser

    %% Click Events
    click Container "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/index.html"
    click Entry "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/main.tsx"
    click Styles "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/index.css"
    click Toolbar "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/Toolbar.tsx"
    click DM "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/DailyMessage.tsx"
    click Ill "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/Illustration.tsx"
    click SL "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/shipList/ShipList.tsx"
    click Field "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/shipList/Field.tsx"
    click Item "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/components/shipList/ShipListItem.tsx"
    click State "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/state/Atoms.tsx"
    click Assets "https://github.com/steef-o/hvilken-baat-er-det-i-dag/tree/main/src/assets/img/"
    click CFG1 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/vite.config.ts"
    click CFG2 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/tailwind.config.js"
    click CFG3 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/postcss.config.js"
    click CFG4 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/tsconfig.json"
    click CFG5 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/biome.json"
    click CFG6 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/vitest.config.ts"
    click CFG7 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/package.json"
    click CFG8 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/src/vite-env.d.ts"
    click CFG9 "https://github.com/steef-o/hvilken-baat-er-det-i-dag/blob/main/README.md"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6;
    classDef state fill:#E0F3FF,stroke:#0366d6;
    classDef assets fill:#D0E8FF,stroke:#0366d6;
    classDef build fill:#FFE4B5,stroke:#FF8C00;
    classDef hosting fill:#E8E8E8,stroke:#999999;
    classDef externalService fill:#E0FFE0,stroke:#008000;
    classDef external fill:#F0F0F0,stroke:#666666;
```
