# joao-pacheco/lumen architecture

> Architecture diagram of the GitHub repository joao-pacheco/lumen, 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/joao-pacheco/lumen
- Repository: https://github.com/joao-pacheco/lumen

## Overview

##### Project Type and Purpose
- The README indicates that the project was bootstrapped using create-next-app, meaning it’s a Next.js web application. The purpose is to serve dynamic pages (e.g. app/page.tsx) and possibly offer specialized functionality around “plan365” (as seen in public/plan/plan365.json) and reading-related components.
- Given the file structure with components such as Footer, ProgressBar, and ReadingBox, the project is designed to deliver a user interface with specific reading functionalities along with global styles and layout management.

##### File Structure
- Top-level directories:
- app: Contains the core Next.js route components (layout.tsx, page.tsx, globals.css). This folder implements the new “app directory” paradigm in Next.js.
- components: Houses reusable UI components (Footer, ProgressBar, ReadingBox), which suggests the system is component-driven.
- common: Likely contains shared constants or utilities (e.g., const.ts).
- lib: Provides utility functions, for example, storage handling (storage-handler.ts).
- model: Contains domain models (e.g., dailyText.ts, plan365.ts); these models may be used in data handling or state management.
- store: Contains state management hooks such as useStoreCurrentDate.ts.
- public: Contains static assets including a manifest file and JSON configuration (plan365.json).
- fonts: A curated set of fonts that the application optimizes via Next.js’s built-in font optimization features.
- Configuration and build files appear such as next.config.ts, package.json, eslint.config.mjs, postcss.config.mjs, and GitHub actions in the .github directory, all ensuring quality deployment and development workflows.

##### Core Components
a. Next.js Application Layer:
- App Directory: Represents the main entry point for route-based components like layout.tsx and page.tsx.
- Global Styling: Represent globals.css which is applied across the application.
b. Data and Business Logic:
- Common/Lib: Include a section for common utilities and helper functions (const.ts, storage-handler.ts).
- Store: Capture state management with useStoreCurrentDate.ts which flows data state between components.
c. Static Assets:
- Public Files: A component for static assets (e.g., manifest.json, plan365.json).
d. Third-Party Services and Deployment:
- Vercel/Next.js Cloud: Although not part of the code, indicate deployment on the Vercel platform as recommended by the README.
- CI/CD: Represent the GitHub Workflows (.github/workflows) that enable automated testing and deployment.

##### Relationships and Interactions
- How user requests (from the browser) hit the Next.js router, which then loads pages and calls into components.
- Components may interact with state (via the store) and fetch data through models or libraries.
- Dependency from app components to UI components, and further interaction with common utilities and storage libraries.
- How fonts and static assets are served to the client.
- That layout.tsx defines a global structure that is used by all pages and hence interacts with every UI component.

##### Architectural Patterns and Design Principles
- Component-based Architecture: Decompose UI into smaller, reusable pieces.
- File-based Routing: Leverage Next.js’s app directory for routes.
- Separation of Concerns: Clearly split UI (components), business logic (models, lib), and static assets (public, fonts).
- Optimized Asset Delivery: Next.js font optimization (via next/font) and static serving of assets.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::external

    subgraph "Next.js App"
        Routing["Next.js Routing (layout.tsx, page.tsx)"]:::app
        GlobalStyling["Global Styling (globals.css)"]:::app
    end

    subgraph "UI Components"
        Footer["Footer"]:::ui
        ProgressBar["ProgressBar"]:::ui
        ReadingBox["ReadingBox"]:::ui
        BibleAbbrev["Bible Abbreviations"]:::ui
    end

    subgraph "Business Logic"
        subgraph "Domain Models"
            DailyText["Daily Text Model"]:::business
            Plan365["Plan365 Model"]:::business
        end
        CommonUtils["Common Utilities"]:::business
        StorageHandler["Storage Handler"]:::business
        StateMgmt["State Management"]:::business
    end

    subgraph "Static Assets"
        Manifest["Manifest"]:::assets
        Plan365Config["Plan365 Config"]:::assets
        Fonts["Fonts"]:::assets
    end

    subgraph "CI/CD & Deployment"
        GitHubWorkflows["GitHub Workflows"]:::ci
        VercelDeployment["Vercel Deployment"]:::ci
    end

    Browser -->|"requests"| Routing
    Routing -->|"appliesLayout"| GlobalStyling
    Routing -->|"renders"| Footer
    Routing -->|"renders"| ProgressBar
    Routing -->|"renders"| ReadingBox
    ReadingBox -->|"includes"| BibleAbbrev

    Footer -->|"usesState"| StateMgmt
    ProgressBar -->|"usesUtilities"| CommonUtils
    ReadingBox -->|"interactsWith"| StorageHandler
    StateMgmt -->|"fetchesModel"| DailyText
    StateMgmt -->|"fetchesModel"| Plan365

    GlobalStyling -->|"appliesTo"| Footer
    GlobalStyling -->|"appliesTo"| ProgressBar
    GlobalStyling -->|"appliesTo"| ReadingBox

    Fonts -->|"servesFontsTo"| Browser
    Manifest -->|"providesConfig"| Routing
    Plan365Config -->|"providesPlanData"| ReadingBox

    GitHubWorkflows -->|"triggersDeploy"| VercelDeployment
    VercelDeployment -->|"hosts"| Routing

    %% Click Events
    click Routing "https://github.com/joao-pacheco/lumen/blob/main/app/layout.tsx"
    click Routing "https://github.com/joao-pacheco/lumen/blob/main/app/page.tsx"
    click GlobalStyling "https://github.com/joao-pacheco/lumen/blob/main/app/globals.css"
    click Footer "https://github.com/joao-pacheco/lumen/blob/main/components/Footer/index.tsx"
    click ProgressBar "https://github.com/joao-pacheco/lumen/blob/main/components/ProgressBar/index.tsx"
    click ReadingBox "https://github.com/joao-pacheco/lumen/blob/main/components/ReadingBox/index.tsx"
    click BibleAbbrev "https://github.com/joao-pacheco/lumen/blob/main/components/ReadingBox/bibleAbbreviations.ts"
    click DailyText "https://github.com/joao-pacheco/lumen/blob/main/model/dailyText.ts"
    click Plan365 "https://github.com/joao-pacheco/lumen/blob/main/model/plan365.ts"
    click CommonUtils "https://github.com/joao-pacheco/lumen/blob/main/common/const.ts"
    click StorageHandler "https://github.com/joao-pacheco/lumen/blob/main/lib/storage-handler.ts"
    click StateMgmt "https://github.com/joao-pacheco/lumen/blob/main/store/useStoreCurrentDate.ts"
    click Manifest "https://github.com/joao-pacheco/lumen/blob/main/public/manifest.json"
    click Plan365Config "https://github.com/joao-pacheco/lumen/blob/main/public/plan/plan365.json"
    click Fonts "https://github.com/joao-pacheco/lumen/tree/main/fonts"
    click GitHubWorkflows "https://github.com/joao-pacheco/lumen/blob/main/.github/workflows/nextjs.yml"

    %% Styles
    classDef external fill:#87CEFA,stroke:#1E90FF,stroke-width:2px;
    classDef app fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef ui fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef business fill:#FFD700,stroke:#B8860B,stroke-width:2px;
    classDef assets fill:#FFB6C1,stroke:#C71585,stroke-width:2px;
    classDef ci fill:#D3D3D3,stroke:#696969,stroke-width:2px;
```
