Skip to content

About

Dual-engine React 19 & Typst Rust vector CV with deterministic A4 PDF precompilation, profile isolation adapters, and Node.js 26.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

react-vector-cv

A modular, high-performance curriculum vitae platform built with React 19, TypeScript, and Vite, featuring a dual vector rendering pipeline that pairs deterministic Rust-powered Typst PDF precompilation with browser-native print stylesheets.

Inception (First Commit): 2024-12-23 β€’ Batch / Horizon: Batch 2024–2025 β€’ Architecture Domain: Frontend Engineering / Deterministic Typst & Vector Print Engine

Note on Repository Taxonomy: Under the portfolio standardization framework, this repository is mapped to the canonical identifier showcase-react-vector-cv, reflecting its core role as an architectural reference implementation for vector document generation, data isolation adapters, and modern JavaScript runtime tooling.


πŸ“Œ Architecture & Overview

react-vector-cv is engineered as a zero-compromise, data-driven curriculum vitae and digital portfolio platform. Departing from traditional approaches that couple structured resume data with hardcoded JSX or rely on client-side rasterizers (such as html2canvas or jsPDF), the project implements a decoupled, dual-target vector generation architecture.

The architecture serves two complementary delivery channels from a unified domain schema:

  1. Interactive Web Application: An accessible, responsive React 19 single-page application featuring dynamic system/light/dark theming, zero-dependency bilingual localization (Italiano ↔ English), and native browser print styles calibrated with CSS Paged Media rules (@media print).
  2. Deterministic Typst Precompilation Engine (ADR-0004): A headless document generation pipeline powered by Typst's native Rust compiler (@myriaddreamin/typst-ts-node-compiler via Node.js N-API). The pipeline precompiles four pixel-perfect, ATS-compliant A4 PDF variants (cv-italiano-photo.pdf, cv-italiano-nophoto.pdf, cv-english-photo.pdf, cv-english-nophoto.pdf) directly during the Vite build lifecycle or on-demand via dedicated CLI commands.
+-----------------------------------------------------------------------------------------+
|                                    Domain Schema                                        |
|                          src/types/cv.ts (CvDataSchema)                                 |
+-----------------------------------------------------------------------------------------+
                                           |
                                           v
+-----------------------------------------------------------------------------------------+
|                                Runtime Validation Engine                                |
|                        src/utils/validateCvData.ts (~395 LOC)                           |
+-----------------------------------------------------------------------------------------+
                                           |
                    +----------------------+----------------------+
                    |                                             |
                    v                                             v
+--------------------------------------+      +-------------------------------------------+
|       Public Profile Adapter         |      |          Private Profile Adapter          |
|      src/adapters/cvProfile.public   |      |        src/adapters/cvProfile.private     |
|   (Redacted data & public assets)    |      |    (Extended data, private assets, PII)   |
+--------------------------------------+      +-------------------------------------------+
                    |                                             |
                    +----------------------+----------------------+
                                           |
                        Vite Module Alias Resolution Hook
                          (`cv-profile-adapter` Plugin)
                                           |
                    +----------------------+----------------------+
                    |                                             |
                    v                                             v
+--------------------------------------+      +-------------------------------------------+
|      Interactive Web Runtime         |      |         Typst PDF Precompiler             |
|   - React 19 Component Tree          |      |   - scripts/pdfGenerator.ts               |
|   - Zero-dependency i18n Switcher    |      |   - @myriaddreamin/typst-ts-node-compiler |
|   - useTheme (Dark/Light/System)     |      |   - typst/cv.typ + typst/flags.typ        |
|   - Browser @media print Engine      |      |   - Emits 4 Deterministic A4 PDFs         |
+--------------------------------------+      +-------------------------------------------+
                    |                                             |
                    v                                             v
            Browser & DOM View                           public/pdf/ & dist/pdf/

Architectural Highlights & Key Patterns

  • Data-Driven Decoupling: Complete separation between raw content schema dictionaries (cvData.json / cvData.revised.json) and presentation layers. All domain objects pass through exhaustive runtime type guards before mounting.
  • Dual Vector Output Engine:
    • Native Browser Print (ADR-0002): Leverages standard CSS print stylesheets (@media print, break-inside: avoid-page, print-color-adjust: exact) for zero-overhead client printing (window.print()).
    • Deterministic Typst Engine (ADR-0004): Eliminates client-side PDF renderer bloat and cross-browser print engine discrepancies (Chromium vs WebKit vs Gecko) by embedding Typst's Rust-based layout compiler into the build system.
  • Compile-Time Profile Adapter Pattern: Implements compile-time data and asset isolation via a custom Vite plugin (cv-profile-adapter). Public production builds cleanly omit sensitive contact details, private company icons, and unredacted assets, preventing PII leaks in open-source deployments.
  • Modern High-Throughput Toolchain: Configured for high-velocity development with Node.js 26 (>= 26.13.1), pnpm 11, Oxlint (replacing legacy ESLint with native Rust linting), and Oxfmt for instantaneous code formatting.
  • Edge Delivery Optimization: Bundles static assets with dual Gzip and Brotli pre-compression (vite-plugin-compression) and deploys with hardened security headers via Netlify (netlify.toml).

Directory Structure

react-vector-cv/
β”œβ”€β”€ .oxfmtrc.json                    # Oxfmt configuration
β”œβ”€β”€ .oxlintrc.json                   # Oxlint rules and overrides
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ adr/                         # Architecture Decision Records
β”‚   β”‚   β”œβ”€β”€ 0001-react-19-migration.md
β”‚   β”‚   β”œβ”€β”€ 0002-native-print-vs-client-pdf-generators.md
β”‚   β”‚   β”œβ”€β”€ 0003-manual-spacers-technical-debt.md
β”‚   β”‚   └── 0004-typst-deterministic-pdf.md
β”‚   β”œβ”€β”€ ANALYSIS_AND_AUDIT.md        # Deep codebase audit notes
β”‚   └── RECAP_AND_CHANGELOG.md       # Comprehensive release history
β”œβ”€β”€ netlify.toml                     # Netlify edge deployment & header configuration
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ favicon.svg                  # Brand favicon
β”‚   └── pdf/                         # Precompiled PDF artifacts (gitignored)
β”œβ”€β”€ scripts/
β”‚   └── pdfGenerator.ts              # Headless Typst N-API compiler orchestration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ adapters/
β”‚   β”‚   β”œβ”€β”€ cvProfile.public.ts      # Public profile adapter (redacted assets/data)
β”‚   β”‚   β”œβ”€β”€ cvProfile.private.ts     # Private profile adapter (extended assets/data)
β”‚   β”‚   └── cvProfile.types.ts       # Adapter contracts & module resolution types
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”‚   β”œβ”€β”€ cvData.json          # Public CV JSON data
β”‚   β”‚   β”‚   └── cvData.revised.json  # Private/unredacted CV JSON data (gitignored)
β”‚   β”‚   β”œβ”€β”€ icons/                   # Modular SVG/PNG icon sets (header, work, school)
β”‚   β”‚   └── img/                     # Profile photos & vector signatures
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Header.tsx               # Biographical header & interactive contact chips
β”‚   β”‚   β”œβ”€β”€ WorkExperience.tsx       # Timeline cards with achievements and badges
β”‚   β”‚   β”œβ”€β”€ Education.tsx            # Academic degrees, honors, and certificates
β”‚   β”‚   β”œβ”€β”€ Skills.tsx               # Categorized skills matrix (hard/soft)
β”‚   β”‚   β”œβ”€β”€ Language.tsx             # Spoken languages & proficiency chips
β”‚   β”‚   └── LegalNotes.tsx           # GDPR and regulatory compliance statements
β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   └── cv.ts                    # Supported languages, URL validators, asset categories
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── useTheme.ts              # Reactive dark/light/system theme state machine
β”‚   β”œβ”€β”€ styles/                      # Modular CSS with variables & @media print rules
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── cv.ts                    # Strict TypeScript domain interfaces
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ formatters.ts            # Date and localization formatting utilities
β”‚   β”‚   └── validateCvData.ts        # Invariant and runtime schema validation engine
β”‚   β”œβ”€β”€ App.tsx                      # Root layout, theme toggles, and PDF download triggers
β”‚   └── main.tsx                     # React 19 Concurrent Root bootstrap
β”œβ”€β”€ typst/
β”‚   β”œβ”€β”€ cv.typ                       # Typst A4 CV layout template (Rust layout DSL)
β”‚   β”œβ”€β”€ flags.typ                    # Vector SVG flag components and fallback badges
β”‚   └── fonts/                       # Embedded Liberation Sans font family
β”œβ”€β”€ package.json                     # Node 26 + pnpm 11 package manifest
β”œβ”€β”€ tsconfig.json                    # TypeScript compiler configuration
└── vite.config.ts                   # Vite build config with PDF generator & adapter plugins

πŸ›  Tech Stack

  • Runtime & Package Manager: Node.js >= 26.13.1 (tested against Node 26), pnpm >= 11.21.0
  • Frontend Framework: React 19.3.1, React DOM 19.3.1, TypeScript ~7.0.2
  • Build Tooling & Bundler: Vite 8.3.8, @vitejs/plugin-react 6.3.0
  • Document Compilation Engine: @myriaddreamin/typst-ts-node-compiler 0.7.0 (Native Rust N-API binding)
  • Code Quality & Formatting: Oxlint 1.93.0 (Rust linter), Oxfmt 0.78.0 (Rust formatter)
  • Optimization & Edge Hosting: vite-plugin-compression 0.5.1 (Dual Gzip & Brotli), Netlify CLI & Edge runtime
  • Typography & Assets: Liberation Sans font family, inline vector SVG flag definitions

✨ Features & Architecture Capabilities

  • Dual-Engine Vector Document Export:
    • Interactive Browser Print: Instant client vector printing formatted via @media print with zero external dependencies.
    • Headless Typst Precompilation: Pre-builds four calibrated 2-page A4 PDF documents with sub-100ms compilation times, guaranteed zero font-metric drift, ATS readability, and embedded vector flag graphics.
  • Dynamic Direct PDF Downloads: The web interface dynamically maps the "Download PDF" action to the exact precompiled variant corresponding to active user state (Italiano/English and photo/nophoto).
  • Profile Isolation & Anti-Leakage: Segregates public open-source profiles from private contact information via the cvProfile adapter pattern, controlled through VITE_CV_PROFILE=private and VITE_CV_DATA_FILE.
  • Runtime Invariant Validation: Deeply inspects imported JSON data before execution, validating URL schemes, non-empty text invariants, and contact arrays with descriptive runtime error traces.
  • Ternary Theme State Machine: The useTheme hook provides persistent theme selection (light, dark, system) with live prefers-color-scheme media query listeners and zero layout flash.
  • Zero-Dependency i18n: Implements deterministic bilingual switches (Italiano vs English) directly through typed dictionary projection without runtime bundle penalties.

Project Scripts & CLI Commands

Command Target / Mode Description
pnpm dev Development Server Starts Vite dev server and precompiles public PDF variants to public/pdf/.
pnpm dev:public Dev Server (Public) Forces public profile isolation in development mode.
pnpm build Production Build Runs TypeScript typecheck (tsc -b), compiles Typst public PDFs, and bundles Vite web app.
pnpm build:private Private Build Bundles production distribution using private unredacted profile adapter and assets.
pnpm generate:pdf Standalone CLI Compiles 4 public Typst PDF variants directly using the headless NodeCompiler.
pnpm generate:pdf:private Standalone CLI Compiles 4 private Typst PDF variants using unredacted private data.
pnpm lint Code Quality Executes Oxlint for ultra-fast Rust-based static analysis.
pnpm format:check Code Quality Validates code formatting compliance using Oxfmt.
pnpm preview Production Preview Locally serves the optimized production build (dist/).

πŸš€ Getting Started

Prerequisites

  • Node.js: >= 26.13.1 (Node.js 26 runtime recommended)
  • pnpm: >= 11.21.0
  • Operating System: Linux, macOS, or Windows with support for Node.js N-API native bindings.

Installation

# Clone the repository
git clone https://github.com/fabogit/showcase-react-vector-cv.git
cd showcase-react-vector-cv

# Install dependencies using pnpm
pnpm install

Environment Configuration

Create a local environment file based on .env.example:

cp .env.example .env.local

Configure target build profile variables:

# Profile selector: "public" (default) or "private"
VITE_CV_PROFILE=public

# Optional custom JSON data file for private profile (located in src/assets/data/)
VITE_CV_DATA_FILE=cvData.revised.json

Running the Application

# Start development server with live reload and automatic PDF precompilation
pnpm dev

# Generate standalone PDF variants without starting dev server
pnpm generate:pdf

# Run production build
pnpm build

# Preview production build locally
pnpm preview

Quality & Linting

# Run ultra-fast Oxlint checks
pnpm lint

# Verify formatting with Oxfmt
pnpm format:check

πŸ“„ License & Author

Developed by @fabogit. Released under the MIT License.

About

Dual-engine React 19 & Typst Rust vector CV with deterministic A4 PDF precompilation, profile isolation adapters, and Node.js 26.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages