# orioltf/complete-intro-to-containers-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/orioltf/complete-intro-to-containers-v2
- Repository: https://github.com/orioltf/complete-intro-to-containers-v2

## Overview

##### Project Type and Purpose
- This is a full-stack (front-end only) application that builds a course website using Next.js.
- It serves dynamic lesson pages rendered from markdown content stored in the “lessons” directory and other supporting data from JSON files (e.g., course.json and lesson.js).
- The README shows that the repository is meant both as the course website and as a basis for exercises in the course content.

##### File Structure
- The “pages” directory holds Next.js routing files including _app.js (for global settings), index.js (homepage) and dynamic route pages under pages/lessons/[section]/[slug].js.
- The “components” folder contains UI building blocks such as header, footer, layout, and social media link components, which are used across various pages.
- The “context” folder provides state management (for course information and header behavior) that likely wraps the app component.
- The “lessons” directory is organized into subdirectories (01-welcome, 02-crafting-containers-by-hand, etc.) containing markdown files and meta.json files for lesson-specific data.
- Additional folders like “data” (which has course and lesson data), “csv”, and “summary” provide supplementary functions – perhaps for content imports or extra processing.
- Configuration files (next.config.js, package.json, .prettierrc, .gitignore) and the GitHub workflows (.github/workflows/next.yaml) indicate CI/CD and development-time formatting and environment settings.

a. Main Components:
- Next.js Server/Application: Represents the central part of the website serving static and dynamic pages.
- UI Components: Include individual UI components (header, footer, layout, social links) defined in the “components” folder.
- Context Providers: Illustrate the usage of React Context (headerContext, courseInfoContext) to manage state across components.
- Content/Data Sources: Represented by the “lessons” markdown files, “course.json”, and “data” folders that provide content for the website.
- Build/CI Processes: Capture how GitHub Actions (via the GitHub workflow file) integrate into the build/deployment pipeline.

b. Relationships and Interactions:
- The Browser (client) interacts with the Next.js server, which renders pages from the “pages” directory.
- The global App (_app.js) wraps pages with Context Providers, ensuring that state (course info, header state) is shared across rendered components.
- UI Components in “components” are imported and used in page templates (for layout & navigation) to provide a consistent look.
- The “lessons” content is dynamically loaded based on the URL parameters of lesson pages.
- GitHub workflows trigger builds and possibly deployments, ensuring the Next.js site is up-to-date.

c. Architectural Patterns and Design Principles:
- Component-based UI design using Next.js and React.
- Dynamic routing leveraging file-based routing in Next.js.
- Separation of concerns: UI components, state management (context), content (markdown and JSON) are kept in separate directories.
- CI/CD integration visible from GitHub workflows, ensuring automated testing and deployment.

d. Relevant Technologies and Libraries:
- Next.js (React framework) for server-side rendering/static generation.
- React Context for state management (as seen in the “context” directory).
- Markdown files for lesson content and JSON files for course and lesson metadata.
- GitHub Actions for CI/CD (in the .github/workflows folder).
- CSS files in “styles” provide the styling infrastructure for the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser/Client"]:::client
    NextServer["Next.js Server/Application"]:::server
    Pages["Pages Directory"]:::pages
    UI["UI Components"]:::ui
    Context["Context Providers"]:::context
    Lessons["Lesson Markdown Files"]:::data
    DataFiles["Course Data Files\n(course.json & data)"]:::data
    Repo["Repository"]:::repo
    CICD["GitHub Actions CI/CD"]:::cicd

    Browser -->|"requests"| NextServer
    NextServer -->|"routes to"| Pages
    NextServer -->|"wraps with"| Context
    NextServer -->|"includes"| UI
    Pages -->|"renders from"| Lessons
    Pages -->|"renders from"| DataFiles
    Repo -->|"triggers"| CICD

    click NextServer "https://github.com/orioltf/complete-intro-to-containers-v2/blob/main/pages/_app.js"
    click Pages "https://github.com/orioltf/complete-intro-to-containers-v2/tree/main/pages"
    click UI "https://github.com/orioltf/complete-intro-to-containers-v2/tree/main/components"
    click Context "https://github.com/orioltf/complete-intro-to-containers-v2/tree/main/context"
    click Lessons "https://github.com/orioltf/complete-intro-to-containers-v2/tree/main/lessons"
    click DataFiles "https://github.com/orioltf/complete-intro-to-containers-v2/tree/main/data"
    click CICD "https://github.com/orioltf/complete-intro-to-containers-v2/blob/main/.github/workflows/next.yaml"

    classDef client fill:#bbf,stroke:#333,stroke-width:2px;
    classDef server fill:#fbb,stroke:#333,stroke-width:2px;
    classDef pages fill:#bfb,stroke:#333,stroke-width:2px;
    classDef ui fill:#ff9,stroke:#333,stroke-width:2px;
    classDef context fill:#9ff,stroke:#333,stroke-width:2px;
    classDef data fill:#fcf,stroke:#333,stroke-width:2px;
    classDef repo fill:#cff,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ddd,stroke:#333,stroke-width:2px;
```
