# hassamalidev/pentwin architecture

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

- Interactive diagram: https://gitdiagram.com/hassamalidev/pentwin
- Repository: https://github.com/hassamalidev/pentwin

## Overview

PenTwin is an early-stage product intended to turn DOCX/PDF documents into realistic handwriting based on a user’s writing sample. The README establishes that user-to-result workflow, but the web, worker, engine, extractor, and importer entry points are empty exports, so their internal responsibilities and runtime connections are not yet evidenced. The only implemented behavior visible here is shared branding, page-size configuration, types, and seeded randomness. The product flow below is documented intent, not a claim that it is already implemented.

Main entry points: [`packages/engine/src/index.ts`](https://github.com/hassamalidev/pentwin/blob/main/packages/engine/src/index.ts) (Handwriting rendering), [`packages/importers/src/index.ts`](https://github.com/hassamalidev/pentwin/blob/main/packages/importers/src/index.ts) (Document import), [`packages/extractor/src/index.ts`](https://github.com/hassamalidev/pentwin/blob/main/packages/extractor/src/index.ts) (Text extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product_flow["Handwriting workflow"]
  node_source_docs["DOCX/PDF input"]
  node_writing_sample["Writing sample"]
  node_handwritten_output["Handwritten result"]
end

subgraph group_runtime_stubs["Runtime placeholders"]
  node_document_import["Document import<br/>[index.ts]"]
  node_text_extraction["Text extraction<br/>[index.ts]"]
  node_handwriting_render["Handwriting rendering<br/>[index.ts]"]
  node_web_app["Web entry<br/>[index.ts]"]
  node_worker_app["Worker entry<br/>[index.ts]"]
end

subgraph group_shared["Shared utilities"]
  node_shared_config["Page settings<br/>[constants.ts]"]
  node_shared_rng["Seeded randomness<br/>[rng.ts]"]
  node_shared_brand["Brand identity<br/>[brand.ts]"]
end

node_user(("User"))

node_user -->|"provides document"| node_source_docs
node_user -->|"provides sample"| node_writing_sample
node_source_docs -.->|"intended import"| node_document_import
node_document_import -.->|"intended extraction"| node_text_extraction
node_text_extraction -.->|"intended rendering"| node_handwriting_render
node_writing_sample -.->|"informs rendering"| node_handwriting_render
node_handwriting_render -->|"intended result"| node_handwritten_output

click node_document_import "https://github.com/hassamalidev/pentwin/blob/main/packages/importers/src/index.ts"
click node_text_extraction "https://github.com/hassamalidev/pentwin/blob/main/packages/extractor/src/index.ts"
click node_handwriting_render "https://github.com/hassamalidev/pentwin/blob/main/packages/engine/src/index.ts"
click node_web_app "https://github.com/hassamalidev/pentwin/blob/main/apps/web/src/index.ts"
click node_worker_app "https://github.com/hassamalidev/pentwin/blob/main/apps/worker/src/index.ts"
click node_shared_config "https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/constants.ts"
click node_shared_rng "https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/rng.ts"
click node_shared_brand "https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/brand.ts"

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_source_docs,node_writing_sample,node_handwritten_output,node_user toneBlue
class node_document_import,node_text_extraction,node_handwriting_render,node_web_app,node_worker_app toneAmber
class node_shared_config,node_shared_rng,node_shared_brand toneMint
```

## Components

### Handwriting workflow

- **DOCX/PDF input**
- **Writing sample**
- **Handwritten result**

### Runtime placeholders

- [Document import](https://github.com/hassamalidev/pentwin/blob/main/packages/importers/src/index.ts): `packages/importers/src/index.ts`
- [Text extraction](https://github.com/hassamalidev/pentwin/blob/main/packages/extractor/src/index.ts): `packages/extractor/src/index.ts`
- [Handwriting rendering](https://github.com/hassamalidev/pentwin/blob/main/packages/engine/src/index.ts): `packages/engine/src/index.ts`
- [Web entry](https://github.com/hassamalidev/pentwin/blob/main/apps/web/src/index.ts): `apps/web/src/index.ts`
- [Worker entry](https://github.com/hassamalidev/pentwin/blob/main/apps/worker/src/index.ts): `apps/worker/src/index.ts`

### Shared utilities

- [Page settings](https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/constants.ts): `packages/shared/src/constants.ts`
- [Seeded randomness](https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/rng.ts): `packages/shared/src/rng.ts`
- [Brand identity](https://github.com/hassamalidev/pentwin/blob/main/packages/shared/src/brand.ts): `packages/shared/src/brand.ts`

### Other components

- **User**

## Connections

- User → DOCX/PDF input: provides document (evidence: `README.md`)
- User → Writing sample: provides sample (evidence: `README.md`)
- DOCX/PDF input → Document import: intended import (evidence: `README.md`)
- Document import → Text extraction: intended extraction
- Text extraction → Handwriting rendering: intended rendering
- Writing sample → Handwriting rendering: informs rendering (evidence: `README.md`)
- Handwriting rendering → Handwritten result: intended result (evidence: `README.md`)
