# ohjelmistokehitys/merge-exercise architecture

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

- Interactive diagram: https://gitdiagram.com/ohjelmistokehitys/merge-exercise
- Repository: https://github.com/ohjelmistokehitys/merge-exercise

## Overview

##### Project type and purpose
- This is a single-page application (SPA) frontend project: a React/TypeScript-based countdown timer scaffolded with Vite.
- There is no separate backend service or database; it’s purely a client-side app that can be served statically or via a simple containerized HTTP server.
- The purpose is to teach Git merging via feature branches while exercising core React/TypeScript/Vite workflows.

##### File structure
- Top-level configuration: Dockerfile, docker-compose.yml, Git ignore/config files, ESLint, tsconfig, vite.config.ts.
- Public assets: index.html and public/.gitkeep hold the static HTML shell and any static assets.
- Source code: src/main.tsx (entry point), src/App.tsx (app shell), src/Timer.tsx (countdown logic/UI).
- Package.json lists dependencies (React, Vite, Pico CSS, dev tooling).
- Screenshots directory contains sample UI states (documentation purposes).

##### README for additional insights
- The README focuses on Git branch merging rather than feature complexity.
- It shows the minimal tech stack: Node.js/NPM, React, Vite, Docker, GitHub Actions (in feature/workflows).
- No backend API or external services are mentioned. Styling relies on the Pico CSS framework.

##### Detailed breakdown of components to capture
- Source Control: branches (main, feature/*), merge conflicts resolution (manual).
- CI/CD: GitHub Actions workflows from feature/workflows branch.
- Local dev: Vite dev server (hot module reload).
- Production build: Vite build → dist folder.
- Containerization: Dockerfile instructions → nginx or static server layer (if present).
- Client runtime: index.html → main.tsx → App.tsx → Timer.tsx.
- Styling: Pico CSS included via HTML head or import.
- NPM scripts: “dev”, “build”, “serve” (if any).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Developer Workstation"
        DW1["Developer Machine\n(Node.js/NPM & Git)"]:::infra
    end

    DW1 -->|git push| GH["GitHub Repo\n(branches & Actions)"]:::infra
    click GH "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/."

    GH -->|triggers| CI["CI/CD Pipeline\n(Build + Grading)"]:::ci
    click CI "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/."

    subgraph "CI/CD Pipeline"
        CI1["GitHub Actions\nWorkflows"]:::ci
        CI2["Vite Build\n(vite.config.ts)"]:::infra
        CI1 --> CI2
        CI2 --> ART["Build Artifacts\n/dist"]:::infra
        click CI2 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/vite.config.ts"
    end

    ART -->|docker build| DC["Docker Container\nHTTP Server"]:::infra

    subgraph "Production Container"
        DC1["Dockerfile"]:::infra
        DC2["docker-compose.yml"]:::infra
        DC3[".dockerignore"]:::infra
        DC1 --> DC
        DC2 --> DC
        DC3 --> DC
        click DC1 "https://github.com/ohjelmistokehitys/merge-exercise/tree/main/Dockerfile"
        click DC2 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/docker-compose.yml"
        click DC3 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/.dockerignore"
    end

    DC -->|serves| Browser["User Browser"]:::runtime

    subgraph "SPA Runtime"
        B1["index.html\n(public/.gitkeep)"]:::infra
        B2["src/main.tsx"]:::infra
        B3["src/App.tsx"]:::ui
        B4["src/Timer.tsx"]:::ui
        B5["Pico CSS"]:::infra
        B1 --> B2 --> B3 --> B4
        B3 -->|"includes Pico CSS"| B5
        click B1 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/index.html"
        click B2 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/src/main.tsx"
        click B3 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/src/App.tsx"
        click B4 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/src/Timer.tsx"
    end

    subgraph "Project Configuration"
        CFG1["tsconfig.json\n(tsconfig.app.json,\ntsconfig.node.json)"]:::infra
        CFG2["eslint.config.js"]:::infra
        CFG3["package.json"]:::infra
        CFG4[".gitignore"]:::infra
        CFG5[".gitattributes"]:::infra
        CFG6["readme.md"]:::infra
        CFG7["screenshots/"]:::infra
        click CFG1 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/tsconfig.json"
        click CFG2 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/eslint.config.js"
        click CFG3 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/package.json"
        click CFG4 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/.gitignore"
        click CFG5 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/.gitattributes"
        click CFG6 "https://github.com/ohjelmistokehitys/merge-exercise/blob/main/readme.md"
        click CFG7 "https://github.com/ohjelmistokehitys/merge-exercise/tree/main/screenshots/"
    end

    classDef infra fill:#D0E8FF,stroke:#005B99,color:#003366;
    classDef ci fill:#DAF5D0,stroke:#4A7F00,color:#336600;
    classDef runtime fill:#FFE8B3,stroke:#CC8400,color:#663600;
    classDef ui fill:#FFE0E0,stroke:#CC0000,color:#660000;
```
