# penguinoneshaw/nudc2019-organisation architecture

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

- Interactive diagram: https://gitdiagram.com/penguinoneshaw/nudc2019-organisation
- Repository: https://github.com/penguinoneshaw/nudc2019-organisation

## Overview

##### Project type and purpose
- This is a Node.js full-stack web application serving two distinct functions:
a. A presentation framework (slides, event details) under the `/presentation` route
b. An invoice and event-details management endpoint under `/invoices`
- It uses Express.js for HTTP routing, Handlebars for server-side templating, Rollup for bundling frontend code, and SCSS for styles.

##### File structure
- Top-level:
- index.js          ← main Express server
- framework/        ← custom presentation framework (components, styles, templates)
- handlebars_templates/ ← invoice and event templates
- data/             ← events.js (JS data source), slides.json
- public/           ← generated frontend assets (bundle, CSS)
- rollup.config.js  ← build config
- Procfile          ← Heroku deployment
- Patterns:
- MVC-like separation:
- “data” as model
- Handlebars templates as views
- index.js routes as controllers
- A static generation layer for presentation (client assets) and a dynamic templating layer for invoices.

##### README
- Confirms two functional blocks—presentation & invoices—both served by the same Express server.
- NPM start boots the server.
- Future plans mention static generation for competition details (presentation).

a. Main components
1. Client Browser
2. Express Server (index.js)
- Router: `/presentation`
- Router: `/invoices`
3. Presentation Framework
- framework/index.js — assembles components
- framework/components/*.js & .scss
- data/slides.json
- Rollup bundle → public/framework.bundle.js
- public/style.css
4. Invoice/Event System
- handlebars_templates/*.hbs
- data/events.js
- index.js loads data & passes to templates
5. Build/Deploy
- rollup.config.js
- Procfile & Heroku
6. Yarn & cache (local dev dependencies)
b. Relationships & interactions
- Browser GET /presentation → Express serves framework/index.hbs + bundle + CSS
- Browser GET /invoices → Express compiles Handlebars with data/events.js → HTML response
- Rollup reads framework/*.js & SCSS and outputs to public/
- Data files feed both presentation and invoices pipelines.
c. Architectural patterns/design principles
- MVC pattern: routes/controllers, templates/views, data/models
- Single server monolith serving both static assets and dynamic pages
- Build pipeline for frontend assets (Rollup + SCSS)
d. Key technologies
- Node.js + Express.js
- Handlebars.js
- Rollup.js
- SCSS
- Yarn Plug’n’Play

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Top Tier: Client
    Browser["Client Browser"]:::client

    %% Middle Tier: Express Server
    subgraph "Express Server"
        index["index.js"]:::server
        subgraph "Presentation Module"
            presRoute["GET /presentation"]:::server
            presLoader["framework/index.js"]:::server
            presTpl["framework/index.hbs"]:::server
            subgraph "Components"
                compIndex["components/index.js"]:::server
                comp1["dancesport-frame.js"]:::server
                comp2["offbeat-frame.js"]:::server
                comp3["round-frame.js"]:::server
                comp4["dancesport-frameholder.js"]:::server
            end
            styles["main.scss"]:::build
        end
        subgraph "Invoice Module"
            invRoute["GET /invoices"]:::server
        end
    end

    %% Bottom Tier: Data & Templates
    subgraph "Data & Templates"
        subgraph "Data Sources"
            slides["slides.json"]:::data
            events["events.js"]:::data
        end
        subgraph "Handlebars Templates"
            htInvoices["invoice.hbs"]:::tpl
            htInvoiceList["invoice_list.hbs"]:::tpl
            htEventIndex["event_index.hbs"]:::tpl
            htCompetitor["competitor_list.hbs"]:::tpl
            htUniversity["university_index.hbs"]:::tpl
            htLayout["index.hbs"]:::tpl
            htBase["template.hbs"]:::tpl
        end
    end

    %% Bottom Tier: Build Pipeline & Assets
    subgraph "Build & Deploy"
        rollup["rollup.config.js"]:::build
        bundle["public/framework.bundle.js"]:::asset
        stylecss["public/style.css"]:::asset
        procfile["Procfile"]:::build
        pkg["package.json"]:::build
    end

    %% Connections: Client to Server
    Browser -->|GET /presentation| presRoute
    Browser -->|GET /invoices| invRoute

    %% Presentation Flow
    presRoute --> presLoader
    presLoader --> slides
    presLoader --> presTpl
    presLoader --> compIndex
    presLoader --> bundle
    presLoader --> stylecss
    compIndex --> comp1
    compIndex --> comp2
    compIndex --> comp3
    compIndex --> comp4
    styles --> bundle
    rollup --> bundle
    rollup --> stylecss
    bundle -->|serves JS| Browser
    stylecss -->|serves CSS| Browser

    %% Invoice Flow
    invRoute --> events
    invRoute --> htLayout
    invRoute --> htBase
    invRoute --> htInvoices
    invRoute --> htInvoiceList
    invRoute --> htEventIndex
    invRoute --> htCompetitor
    invRoute --> htUniversity
    invRoute -->|renders HTML| Browser

    %% Build & Deploy Dependencies
    rollup --> presLoader
    pkg --> rollup
    pkg --> presLoader
    pkg --> invRoute

    %% Click Events
    click index "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/index.js"
    click presLoader "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/index.js"
    click presTpl "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/index.hbs"
    click compIndex "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/components/index.js"
    click comp1 "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/components/dancesport-frame/dancesport-frame.js"
    click comp2 "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/components/offbeat-frame/offbeat-frame.js"
    click comp3 "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/components/round-frame/round-frame.js"
    click comp4 "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/components/dancesport-frameholder/dancesport-frameholder.js"
    click styles "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/framework/styles/main.scss"
    click slides "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/data/slides.json"
    click events "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/data/events.js"
    click htInvoices "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/invoice.hbs"
    click htInvoiceList "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/invoice_list.hbs"
    click htEventIndex "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/event_index.hbs"
    click htCompetitor "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/competitor_list.hbs"
    click htUniversity "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/university_index.hbs"
    click htLayout "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/index.hbs"
    click htBase "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/handlebars_templates/template.hbs"
    click rollup "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/rollup.config.js"
    click bundle "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/public/framework.bundle.js"
    click stylecss "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/public/style.css"
    click procfile "https://github.com/penguinoneshaw/nudc2019-organisation/tree/master/Procfile"
    click pkg "https://github.com/penguinoneshaw/nudc2019-organisation/blob/master/package.json"

    %% Styles
    classDef client fill:#a2d5f2,stroke:#000,color:#000
    classDef server fill:#9fc5e8,stroke:#000,color:#000
    classDef data fill:#b6d7a8,stroke:#000,color:#000
    classDef tpl fill:#fce5cd,stroke:#000,color:#000
    classDef build fill:#f9cb9c,stroke:#000,color:#000
    classDef asset fill:#ffe599,stroke:#000,color:#000
```
