# tarsaaaaa/pagegen architecture

> Architecture diagram of the GitHub repository tarsaaaaa/pagegen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tarsaaaaa/pagegen
- Repository: https://github.com/tarsaaaaa/pagegen

## Overview

#### Purpose and Delivery Model
A static, browser-only assignment front-page generator. Users enter assignment metadata, select a document type, see a live rendered page, and export it as PDF. There is no backend, database, authentication, or server-side generation.

Primary browser entry point: `index.html`. The deployed site is compatible with static hosting such as Netlify.

#### Application Shell and User Input
`index.html` defines the interactive form, document-type controls, preview area, and download action. It is the main integration boundary between user-entered values and the generated document.

`styles.css` provides the application UI styling and likely separates editor controls from the printable preview presentation.

#### Client-Side Generation Controller
`script.js` is the runtime controller for form events, dynamic field updates, template selection, live preview synchronization, and PDF/download behavior.

Primary control flow:
1. Browser loads `index.html`, `styles.css`, and `script.js`.
2. Input and selection events are handled in `script.js`.
3. Script updates the preview DOM with current values.
4. Script applies layout adjustments for long content and selected template.
5. Download action converts or prints the rendered preview to PDF.

#### Template Boundary
`template.html` is the key document-layout asset for generated front pages. It represents the reusable page structure that the runtime populates or uses as the basis for preview rendering.

The supported Lab Report / Lab Sheet variants form a template-selection boundary: shared assignment data flows into different visual/document layouts rather than separate generation systems.

#### Preview and Print/PDF Output
The rendered front page is produced locally in the browser, likely from preview markup in `index.html` and/or `template.html`, with styling from `styles.css`.

PDF output is a client-side boundary: the browser receives no generated file from a remote application service. Any external PDF library, if referenced by the HTML or script, executes entirely in the user’s browser.

#### Assets and External Dependencies
`assets/` contains visual resources used by the UI or generated page, such as branding or document decoration.

Infrastructure is limited to static-file hosting. The README identifies Netlify deployment, but the repository’s runtime artifacts are the static files: `index.html`, `script.js`, `styles.css`, and `template.html`.

Main entry points: [`script.js`](https://github.com/tarsaaaaa/pagegen/blob/main/script.js) (Generation Controller), [`index.html`](https://github.com/tarsaaaaa/pagegen/blob/main/index.html) (Live Rendered Preview), [`styles.css`](https://github.com/tarsaaaaa/pagegen/blob/main/styles.css) (UI & Print Styles), [`template.html`](https://github.com/tarsaaaaa/pagegen/blob/main/template.html) (Reusable Page Template)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser App"]
  node_user(("User<br/>actor"))
  node_index["Application Shell<br/>HTML entry point<br/>[index.html]"]
  node_styles["UI &amp; Print Styles<br/>CSS<br/>[styles.css]"]
  node_controller["Generation Controller<br/>client-side JavaScript<br/>[script.js]"]
  node_form["Assignment Inputs<br/>form controls<br/>[index.html]"]
  node_type_select["Document Type Selection<br/>template controls<br/>[index.html]"]
  node_assets["Visual Assets<br/>static assets"]
end

subgraph group_document["Document Pipeline"]
  node_template["Reusable Page Template<br/>HTML template<br/>[template.html]"]
  node_preview["Live Rendered Preview<br/>preview DOM<br/>[index.html]"]
  node_layout["Layout Adjustment<br/>client-side rendering<br/>[script.js]"]
  node_pdf["PDF / Print Export<br/>browser-side output<br/>[script.js]"]
end

subgraph group_delivery["Static Delivery"]
  node_static_host{{"Static Hosting<br/>deployment"}}
end

node_user -->|"enters metadata"| node_form
node_user -->|"selects type"| node_type_select
node_index -->|"loads"| node_styles
node_index -->|"loads"| node_controller
node_form -->|"input events"| node_controller
node_type_select -->|"selection events"| node_controller
node_controller -->|"selects and populates"| node_template
node_template -->|"provides layout"| node_preview
node_controller -->|"applies"| node_layout
node_layout -->|"updates rendering"| node_preview
node_styles -->|"styles"| node_preview
node_assets -->|"decorates"| node_preview
node_preview -->|"rendered export source"| node_pdf
node_user -->|"downloads"| node_pdf
node_static_host -->|"serves"| node_index

click node_index "https://github.com/tarsaaaaa/pagegen/blob/main/index.html"
click node_styles "https://github.com/tarsaaaaa/pagegen/blob/main/styles.css"
click node_controller "https://github.com/tarsaaaaa/pagegen/blob/main/script.js"
click node_form "https://github.com/tarsaaaaa/pagegen/blob/main/index.html"
click node_type_select "https://github.com/tarsaaaaa/pagegen/blob/main/index.html"
click node_template "https://github.com/tarsaaaaa/pagegen/blob/main/template.html"
click node_preview "https://github.com/tarsaaaaa/pagegen/blob/main/index.html"
click node_layout "https://github.com/tarsaaaaa/pagegen/blob/main/script.js"
click node_pdf "https://github.com/tarsaaaaa/pagegen/blob/main/script.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user,node_index,node_styles,node_controller,node_form,node_type_select,node_assets toneBlue
class node_template,node_preview,node_layout,node_pdf toneAmber
class node_static_host toneMint
```

## Components

### Browser App

All generation runs locally in the browser.

- **User**: actor
- [Application Shell](https://github.com/tarsaaaaa/pagegen/blob/main/index.html): HTML entry point · Contains editor controls, preview area, and download action. · `index.html`
- [UI & Print Styles](https://github.com/tarsaaaaa/pagegen/blob/main/styles.css): CSS · Styles editor controls and printable presentation. · `styles.css`
- [Generation Controller](https://github.com/tarsaaaaa/pagegen/blob/main/script.js): client-side JavaScript · Handles events, preview updates, template selection, and export. · `script.js`
- [Assignment Inputs](https://github.com/tarsaaaaa/pagegen/blob/main/index.html): form controls · `index.html`
- [Document Type Selection](https://github.com/tarsaaaaa/pagegen/blob/main/index.html): template controls · Selects Lab Report or Lab Sheet layout. · `index.html`
- **Visual Assets**: static assets · Branding or document decoration resources.

### Document Pipeline

- [Reusable Page Template](https://github.com/tarsaaaaa/pagegen/blob/main/template.html): HTML template · Document layout basis populated with assignment data. · `template.html`
- [Live Rendered Preview](https://github.com/tarsaaaaa/pagegen/blob/main/index.html): preview DOM · Current assignment front page rendered in the browser. · `index.html`
- [Layout Adjustment](https://github.com/tarsaaaaa/pagegen/blob/main/script.js): client-side rendering · Adapts selected templates and long content. · `script.js`
- [PDF / Print Export](https://github.com/tarsaaaaa/pagegen/blob/main/script.js): browser-side output · Converts or prints the rendered preview locally. · `script.js`

### Static Delivery

- **Static Hosting**: deployment · Serves static files; compatible with Netlify.

## Connections

- User → Assignment Inputs: enters metadata
- User → Document Type Selection: selects type
- Application Shell → UI & Print Styles: loads
- Application Shell → Generation Controller: loads
- Assignment Inputs → Generation Controller: input events
- Document Type Selection → Generation Controller: selection events
- Generation Controller → Reusable Page Template: selects and populates
- Reusable Page Template → Live Rendered Preview: provides layout
- Generation Controller → Layout Adjustment: applies
- Layout Adjustment → Live Rendered Preview: updates rendering
- UI & Print Styles → Live Rendered Preview: styles
- Visual Assets → Live Rendered Preview: decorates
- Live Rendered Preview → PDF / Print Export: rendered export source
- User → PDF / Print Export: downloads
- Static Hosting → Application Shell: serves
