# fandiplay/makalah-builder architecture

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

- Interactive diagram: https://gitdiagram.com/fandiplay/makalah-builder
- Repository: https://github.com/fandiplay/makalah-builder

## Overview

This is a browser-based Indonesian makalah (school or university paper) editor. Users create and edit a draft, check required sections, preview paginated pages, then print or export DOCX; drafts are saved locally, and AI-assisted writing is optional. The source excerpts establish local storage, document helpers, AI editing, and DOCX library loading. The README is empty and some wiring is outside the excerpts, so uncertain preview/pagination links are marked unverified.

Main entry points: [`js/app.js`](https://github.com/fandiplay/makalah-builder/blob/main/js/app.js) (Editor and dashboard), [`js/ai.js`](https://github.com/fandiplay/makalah-builder/blob/main/js/ai.js) (AI writing and settings), [`js/doc.js`](https://github.com/fandiplay/makalah-builder/blob/main/js/doc.js) (Document block builder), [`js/store.js`](https://github.com/fandiplay/makalah-builder/blob/main/js/store.js) (Draft persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Paper authoring"]
  node_writer["Editor and dashboard<br/>[app.js]"]
  node_requirements["Completeness checklist<br/>[doc.js]"]
  node_templates["SMA and campus templates<br/>[store.js]"]
end

subgraph group_rendering["Document output"]
  node_docblocks["Document block builder<br/>[doc.js]"]
  node_pagination["Page layout engine<br/>[pager.js]"]
  node_printstyles["Print styling<br/>[print.css]"]
  node_screenstyles["Editor styling<br/>[app.css]"]
  node_docxexport["DOCX export<br/>[app.js]"]
end

subgraph group_persistence["Draft storage"]
  node_draftstore[("Draft persistence<br/>[store.js]")]
end

subgraph group_assistance["AI assistance"]
  node_aifeatures["AI writing and settings<br/>[ai.js]"]
end

node_browserstorage[("Browser localStorage")]
node_aiprovider{{"AI API provider"}}
node_docxcdn{{"DOCX library CDN"}}
node_author(("Paper author"))

node_author -->|"edits drafts"| node_writer
node_writer -->|"reads and saves"| node_draftstore
node_draftstore -->|"reads and writes"| node_browserstorage
node_writer -->|"checks sections"| node_requirements
node_writer -->|"uses labels"| node_docblocks
node_writer -.->|"builds preview"| node_pagination
node_docblocks -.->|"provides page blocks"| node_pagination
node_writer -->|"exports DOCX"| node_docxexport
node_docxexport -->|"loads library"| node_docxcdn
node_writer -.->|"opens AI tools"| node_aifeatures
node_aifeatures -->|"sends AI requests"| node_aiprovider
node_aifeatures -->|"updates draft"| node_writer

click node_writer "https://github.com/fandiplay/makalah-builder/blob/main/js/app.js"
click node_requirements "https://github.com/fandiplay/makalah-builder/blob/main/js/doc.js"
click node_templates "https://github.com/fandiplay/makalah-builder/blob/main/js/store.js"
click node_docblocks "https://github.com/fandiplay/makalah-builder/blob/main/js/doc.js"
click node_pagination "https://github.com/fandiplay/makalah-builder/blob/main/js/pager.js"
click node_printstyles "https://github.com/fandiplay/makalah-builder/blob/main/css/print.css"
click node_screenstyles "https://github.com/fandiplay/makalah-builder/blob/main/css/app.css"
click node_docxexport "https://github.com/fandiplay/makalah-builder/blob/main/js/app.js"
click node_draftstore "https://github.com/fandiplay/makalah-builder/blob/main/js/store.js"
click node_aifeatures "https://github.com/fandiplay/makalah-builder/blob/main/js/ai.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_writer,node_requirements,node_templates toneBlue
class node_docblocks,node_pagination,node_printstyles,node_screenstyles,node_docxexport,node_browserstorage toneAmber
class node_draftstore,node_aiprovider toneMint
class node_aifeatures toneRose
class node_docxcdn,node_author toneIndigo
```

## Components

### Paper authoring

- [Editor and dashboard](https://github.com/fandiplay/makalah-builder/blob/main/js/app.js): `js/app.js`
- [Completeness checklist](https://github.com/fandiplay/makalah-builder/blob/main/js/doc.js): `js/doc.js`
- [SMA and campus templates](https://github.com/fandiplay/makalah-builder/blob/main/js/store.js): `js/store.js`

### Document output

- [Document block builder](https://github.com/fandiplay/makalah-builder/blob/main/js/doc.js): `js/doc.js`
- [Page layout engine](https://github.com/fandiplay/makalah-builder/blob/main/js/pager.js): `js/pager.js`
- [Print styling](https://github.com/fandiplay/makalah-builder/blob/main/css/print.css): `css/print.css`
- [Editor styling](https://github.com/fandiplay/makalah-builder/blob/main/css/app.css): `css/app.css`
- [DOCX export](https://github.com/fandiplay/makalah-builder/blob/main/js/app.js): `js/app.js`

### Draft storage

- [Draft persistence](https://github.com/fandiplay/makalah-builder/blob/main/js/store.js): `js/store.js`

### AI assistance

- [AI writing and settings](https://github.com/fandiplay/makalah-builder/blob/main/js/ai.js): `js/ai.js`

### Other components

- **Browser localStorage**
- **AI API provider**
- **DOCX library CDN**
- **Paper author**

## Connections

- Paper author → Editor and dashboard: edits drafts
- Editor and dashboard → Draft persistence: reads and saves (evidence: `js/app.js`)
- Draft persistence → Browser localStorage: reads and writes (evidence: `js/store.js`)
- Editor and dashboard → Completeness checklist: checks sections (evidence: `js/app.js`)
- Editor and dashboard → Document block builder: uses labels (evidence: `js/app.js`)
- Editor and dashboard → Page layout engine: builds preview
- Document block builder → Page layout engine: provides page blocks
- Editor and dashboard → DOCX export: exports DOCX (evidence: `js/app.js`)
- DOCX export → DOCX library CDN: loads library (evidence: `js/app.js`)
- Editor and dashboard → AI writing and settings: opens AI tools
- AI writing and settings → AI API provider: sends AI requests (evidence: `js/ai.js`)
- AI writing and settings → Editor and dashboard: updates draft (evidence: `js/ai.js`)
