- π Overview & Vision
- β¨ Key Features
- π System Architecture & Diagrams
- π Mathematical Formulation & Cost Logic
- π‘ Artisan Rules of Thumb
- π Tech Stack & Libraries
- π Project Architecture
- π Getting Started & Local Development
- π§ͺ Testing & Quality Assurance
- π§ CI/CD & DevOps Automation
- π± Progressive Web App (PWA) Capabilities
- π€ Contributing & Community
- π License
Vitralis is a zero-latency, offline-first Progressive Web App (PWA) specifically engineered for stained glass artisans, Tiffany lamp creators, and architectural leaded glass studios.
Crafting stained glass involves layered and volatile material costs (colored cathedral/opal sheets, copper foil rolls, high-grade tin-lead solders, toxic patina chemicals), high-wear diamond tools (grinders, cutter heads, soldering tips), intensive electrical consumption, and meticulous multi-stage labor.
Vitralis replaces guesswork and spreadsheets with:
- Exact Mathematical Cost Modeling: Instant recalculation across glass geometries, consumables, tool wear, and kWh electricity.
- Craftsman Ergonomics: Anti-AI-slop atelier design language, 8-state tactile inputs, and responsive dark/light themes.
- Client-Ready Commercial Outputs: Formal print/PDF quotation sheets, WhatsApp text summaries, and JSON backup portability.
- 100% Client-Side Privacy: No external backend required; all project and studio records are securely stored locally
via schema-versioned
LocalStorage.
| Category | Highlights |
|---|---|
| π¨ Multi-Glass Geometry Engine | Rectangles ( |
| π§΅ Consumables Accounting | Black/Copper/Silver backed foils, 60/40 & 50/50 solder alloys, flux, black/copper patina, zinc came, brass rods, hanging rings & chains. |
| β³ 8-Stage Artisan Labor | Cartooning/design, scoring/breaking, grinding/fitting, foiling, soldering & beading, patina/waxing, framing, shockproof packaging. |
| βοΈ Tool Depreciation | Proportional wear on grinder machines, diamond cutter heads, soldering stations, running pliers, and LED workbenches. |
| β‘ Energy & Power Metering | Aggregates active tool wattages and calculates exact kilowatt-hour (kWh) utility expenses based on regional studio rates. |
| π‘οΈ Waste & Breakage Insurance | Configurable glass breakage risk factor (%) applied to materials or entire base cost. |
| π Commercial Margin & Analytics | Target profit markup (%), discount deduction, VAT/Sales tax toggle, effective hourly studio yield ( |
| π Quotation & Export Engine | Formal printable certificate/quote document (@media print), PDF generation, one-click WhatsApp text format, JSON import/export. |
| π§° Artisan Utility Modals | Solder weight estimator based on linear foil and bead profile, circular area calculator, glass piece perimeter estimator. |
| π Localization & Currencies | Full Turkish (TR) and English (EN) translations with native support for TRY (βΊ), USD ($), EUR (β¬), GBP (Β£), CAD (CA$), AUD (A$), CHF. |
| π± Offline PWA Architecture | Standalone home screen installation, service worker precaching, and instant offline boot. |
graph TB
subgraph Client_App ["Vitralis PWA Application (Client-Side)"]
direction TB
UI["Atelier UI Layer (React 19 + Tailwind CSS v4)"]
subgraph State_Management ["State Management Layer"]
StudioCtx["StudioContext<br/>(Profile, Currency, Theme, Defaults)"]
ProjectCtx["ProjectContext<br/>(Active Project, Saved Projects, Mutations)"]
end
subgraph Core_Engine ["Pure Mathematical Calculation Engine"]
CalcGlass["Glass Geometry & Area Calculator"]
CalcConsumables["Consumables & Chemical Aggregator"]
CalcLabor["8-Stage Labor Matrix"]
CalcWear["Equipment Depreciation & kWh Electricity"]
CalcWaterfall["Waterfall Commercial Profit & Tax Engine"]
end
subgraph Persistence_Layer ["Local Storage & Cache"]
LS[("Browser LocalStorage<br/>(Schema Versioned JSON)")]
SW["Service Worker (Workbox)<br/>Precached App Shell & Assets"]
end
subgraph Output_Adapters ["Export & Presentation Adapters"]
PrintDoc["Formal Print / PDF Quotation Sheet"]
WhatsApp["Formatted Text Messenger Generator"]
JSONExport["JSON Project Backup / Restore"]
end
end
UI --> State_Management
State_Management --> Core_Engine
State_Management <--> Persistence_Layer
Core_Engine --> Output_Adapters
flowchart TD
G["1. Total Glass Cost<br/>Area Γ Unit Price"] --> RawBase["Raw Base Cost"]
C["2. Total Consumables<br/>Foil + Solder + Flux + Patina + Came"] --> RawBase
L["3. Artisan Labor Cost<br/>8 Stages Γ Hourly Rate"] --> RawBase
E["4. Tool Depreciation<br/>Hourly Wear Rate Γ Usage"] --> RawBase
P["5. Electricity Cost<br/>Total kWh Γ Energy Rate"] --> RawBase
RawBase --> WasteCalc{"Waste Mode"}
WasteCalc -->|Materials Only| W1["Waste Amount = Materials Γ Waste%"]
WasteCalc -->|Entire Base Cost| W2["Waste Amount = RawBase Γ Waste%"]
W1 --> CostWaste["Cost with Waste Risk"]
W2 --> CostWaste
CostWaste --> Profit["+ Target Profit Margin %"]
Profit --> Subtotal["Subtotal Selling Price"]
Subtotal --> Disc["- Special Client Discount %"]
Disc --> NetPrice["Net Price After Discount"]
NetPrice --> Tax["+ VAT / Sales Tax %"]
Tax --> Final["π― Final Selling Price"]
Final --> Analytics["Studio Analytics: Hourly Yield, Piece Cost, Material Ratio"]
sequenceDiagram
autonumber
actor Artisan as Artisan / User
participant Header as UI Header / TabNav
participant Comp as Calculator Sections
participant PCtx as ProjectContext
participant Engine as calculations.ts
participant LS as LocalStorage
Artisan ->> Header: Selects Currency / Theme / Tab
Artisan ->> Comp: Inputs Glass Dimensions or Solder Grams
Comp ->> PCtx: Dispatches updateGlassItem() / updateConsumables()
PCtx ->> Engine: Calls calculateProjectCostBreakdown(project)
Engine -->> PCtx: Returns updated immutable CostBreakdown
PCtx ->> LS: Auto-persists active project state
PCtx -->> Comp: Re-renders reactive QuickCostSummary & Charts
Artisan ->> Header: Clicks "Print Quotation"
Header ->> Comp: Displays PrintableQuote & triggers Window.print()
Vitralis executes calculations using strict floating-point math verified with automated unit tests:
Vitralis incorporates real-world workshop benchmarks collected from experienced stained glass artists:
-
Solder to Foil Ratio:
- For standard
$7/32''$ ($5.5\text{mm}$ ) copper foil with balanced front and back bead lines:$$\text{Estimated Solder (g)} \approx \text{Foil Length (m)} \times 18\text{g to } 22\text{g}$$
- For standard
-
Foil Length Approximation from Piece Count:
- For decorative organic panels with average piece perimeters of
$18\text{cm}-24\text{cm}$ :$$\text{Estimated Foil (m)} \approx \frac{\text{Piece Count} \times \text{Avg Perimeter (cm)}}{175}$$
- For decorative organic panels with average piece perimeters of
-
Glass Cutting Scrap & Breakage Margin:
- Standard geometric designs:
$10% - 12%$ - Intricate curves, deep concave cuts, or mouth-blown antique glass:
$20% - 25%$
- Standard geometric designs:
- Core Framework: React 19.2 (Functional Components, Hooks, Context API)
- Type System: TypeScript 6.0 (Strict mode, full interface coverage)
- Build Tool: Vite 8.2 (Lightning fast HMR, Rollup production bundles)
- Styling & Design System: Tailwind CSS v4.3 with custom glassmorphism tokens and
@custom-variant dark - Icons: Lucide React
- Test Runner: Vitest 4.1 (Fast unit test suite)
- PWA & Service Worker:
vite-plugin-pwa+ Google Workbox - Visual Effects: Canvas Confetti for project save celebrations
vitralis/
βββ .github/
β βββ dependabot.yml # Automated weekly dependency updates
β βββ workflows/
β βββ ci.yml # CI: Lint, Typecheck, Test, Build
β βββ deploy.yml # CD: Automated deployment to GitHub Pages
β βββ release-please.yml # Release Please: Semantic release & CHANGELOG
β βββ dependabot-auto-merge.yml# Auto-merge for non-major dependabot PRs
βββ public/
β βββ favicon.svg # SVG vector favicon
β βββ favicon-96x96.png # High-res desktop favicon
β βββ favicon.ico # Legacy browser favicon
β βββ apple-touch-icon.png # iOS touch icon
β βββ web-app-manifest-192x192.png # PWA 192x192 icon
β βββ web-app-manifest-512x512.png # PWA 512x512 icon
β βββ site.webmanifest # Web application manifest
βββ src/
β βββ types/
β β βββ project.ts # Stained glass data models & cost structures
β β βββ studio.ts # Studio profile, currencies & defaults
β βββ constants/
β β βββ defaults.ts # Currencies, default tools, fallback project
β β βββ templates.ts # Pre-configured templates (Suncatcher, Lamp, Panel)
β βββ context/
β β βββ StudioContext.tsx # Studio settings, theme & language state
β β βββ ProjectContext.tsx # Live calculations, storage & project actions
β βββ utils/
β β βββ calculations.ts # Pure mathematical cost engine
β β βββ calculations.test.ts # Automated unit test suite
β β βββ formatters.ts # Currency, area, time, and percentage formatters
β β βββ exportUtils.ts # JSON export/import & WhatsApp quote copy
β βββ i18n/
β β βββ tr.ts # Turkish localization dictionary
β β βββ en.ts # English localization dictionary
β β βββ index.ts # Translation helper
β βββ components/
β β βββ common/
β β β βββ Header.tsx # Atelier header, currency/language selectors
β β β βββ TabNavigation.tsx # Responsive segmented navigation
β β β βββ QuickCostSummary.tsx # Sticky live calculation ledger
β β β βββ CustomSelect.tsx # Custom accessible tactile dropdown popover
β β β βββ GlassCard.tsx # Accordion-enabled glass container
β β β βββ NumberInput.tsx # Spinner-free number input with units
β β β βββ Modal.tsx # Accessible modal dialog
β β βββ calculator/
β β β βββ GlassSection.tsx # Multi-glass items & shape calculators
β β β βββ ConsumablesSection.tsx # Foil, solder, chemicals & came
β β β βββ LaborSection.tsx # 8-stage artisan labor breakdown
β β β βββ EquipmentSection.tsx # Tool wear & machine depreciation
β β β βββ ElectricitySection.tsx # Wattage & kWh electricity consumption
β β β βββ MarginWasteSection.tsx # Waste risk, profit margin & taxes
β β β βββ CostBreakdownChart.tsx # SVG donut visualization & studio KPIs
β β βββ projects/
β β β βββ ProjectManager.tsx # Saved project search, filter & backup
β β β βββ TemplateSelector.tsx # Pre-built stained glass starter presets
β β βββ quote/
β β β βββ PrintableQuote.tsx # Formal print/PDF quotation document
β β βββ studio/
β β β βββ StudioSettings.tsx # Workshop hourly rates & default prices
β β βββ tools/
β β β βββ ArtisanToolsModal.tsx# Solder estimator & geometry helpers
β β βββ pwa/
β β βββ PWAInstallBanner.tsx # PWA install prompt & offline status
β βββ App.tsx # Root workbench view & layout
β βββ index.css # Tailwind CSS v4 & custom design tokens
β βββ main.tsx # Application bootstrapping
βββ .release-please-manifest.json # Release Please version manifest
βββ release-please-config.json # Release Please configuration
βββ eslint.config.js # ESLint flat config
βββ package.json # Scripts & project dependencies
βββ tsconfig.json # TypeScript compiler options
βββ vite.config.ts # Vite & PWA bundler configuration
βββ README.md # Documentation
- Node.js: v18.0.0 or newer (v22 recommended)
- Package Manager: npm, pnpm, or yarn
# 1. Clone the repository
git clone https://github.com/your-username/vitralis.git
cd vitralis
# 2. Install dependencies
npm ci
# 3. Start local development server
npm run devOpen http://localhost:5173 in your browser.
Vitralis includes a full suite of automated unit tests covering all core calculation formulas and formatting utilities:
| Command | Description |
|---|---|
npm test |
Runs the Vitest automated test suite |
npm run lint |
Performs static code analysis with ESLint |
npm run typecheck |
Validates TypeScript types (tsc -b --noEmit) |
npm run validate |
Runs Lint + Typecheck + Tests + Build in one step |
npm run build |
Builds the production bundle & PWA service worker |
$ npm run validate
β ESLint: 0 errors
β TypeScript: Clean type check
β Vitest: 4/4 calculation unit tests passed
β Vite: Production bundle generated (dist/)Vitralis utilizes fully automated GitHub Actions workflows for continuous integration, zero-downtime deployment, and automated semantic releases:
- Workflow:
.github/workflows/ci.yml - Triggers: Push & Pull Request on
main,master,develop. - Checks:
npm ciβnpm run lintβnpm run typecheckβnpm testβnpm run buildβ Artifact Verification.
- Workflow:
.github/workflows/deploy.yml - Target: GitHub Pages (
actions/deploy-pages@v4). - Triggers: Pushes to
mainbranch.
- Config:
.github/dependabot.yml - Schedule: Weekly dependency vulnerability & version auditing.
- Auto-Merge:
.github/workflows/dependabot-auto-merge.ymlautomatically merges passing minor/patch dependency PRs.
- Workflow:
.github/workflows/release-please.yml - Powered by: Google's
release-please-action. - Automatically analyzes Conventional Commits, maintains
CHANGELOG.md, bumpspackage.jsonsemver, and tags GitHub Releases.
Vitralis is engineered as a modern Progressive Web App:
- Offline Reliability: Service Worker precaches all HTML, CSS, JavaScript, web fonts, and manifest assets.
- App Installation: Native "Add to Home Screen" prompt for iOS Safari, Android Chrome, macOS, and Windows.
- Fast Startup: Sub-100ms startup times without network roundtrips.
Contributions are warmly welcome! Please read our guidelines before submitting pull requests:
- π Contribution Guidelines: Development setup, workflow, and coding standards.
- π Code of Conduct: Our pledge to a welcoming and inclusive community.
- π Security Policy: Reporting vulnerabilities and client-side security standards.
- π Changelog: Full record of releases and version history.
- π Calculation Formulas Guide: In-depth mathematical breakdowns and artisan heuristics.
This project is licensed under the MIT License β feel free to use, modify, and distribute for personal, studio, or commercial purposes.