Skip to content

Latest commit

 

History

History
119 lines (92 loc) · 5.84 KB

File metadata and controls

119 lines (92 loc) · 5.84 KB

PrintFX Workspace

Overview

PrintFX is a print-effects processing tool for DTF/DTG/screen-print workflows. Users upload artwork, select a curated effect preset, adjust controls, preview the result, and download a print-ready PNG.

Architecture

pnpm monorepo with:

  • Frontend: React + Vite (artifacts/printfx/) — 5-step workflow UI
  • API Server: Express 5 TypeScript (artifacts/api-server/) — REST endpoints for uploads, presets, jobs
  • Core Presets: JSON preset definitions (core/presets/) — modular, audit-friendly
  • Temp Storage: Ephemeral file storage (storage/tmp/) — no permanent storage
  • Docs: Architecture/implementation docs (docs/) — per architecture spec

Stack

  • Monorepo tool: pnpm workspaces
  • Node.js version: 24
  • Package manager: pnpm
  • Frontend: React + Vite + Tailwind CSS + Framer Motion
  • API framework: Express 5
  • Database: PostgreSQL + Drizzle ORM (lib/db — for future use)
  • Validation: Zod (zod/v4), drizzle-zod
  • API codegen: Orval (from OpenAPI spec in lib/api-spec/openapi.yaml)
  • Build: esbuild (CJS bundle)

PrintFX Preset System

7 curated presets in core/presets/:

Production repair:

  1. descreen_cleanup.json — Removes halftone screen patterns from scanned printed artwork. Controls: screenFrequency (2–20), detailRecovery (0–100). Uses -blur <freq/2> -unsharp 1,<amt>. transparencyMode: preserve.

Stylization: 2. halftone_print.json — Classic dot-based halftone. transparencyMode: preserve. 3. distressed_grunge.json — Gaussian noise film-grain. transparencyMode: preserve. 4. vintage_poster.json — Retro quantized poster look. transparencyMode: flatten. 5. ink_bleed.json — DTF/DTG ink bleed. transparencyMode: preserve. 6. mono_stencil.json — High-contrast monochrome stencil. transparencyMode: preserve.

Production separation: 7. spot_color_prep.json — Reduces to 2/3/4 discrete tonal zones for screen separation/stencil. Controls: zones (select: "2"/"3"/"4"), crispness (0–100). Pipeline: -normalize 0,255 -quantize <n>,0 -unsharp 1,<crispAmt> -quantize <n>,0 -normalize 0,255. Uses keep_values=0 for evenly-spaced levels; re-quantize after crispness unsharp guarantees exactly N distinct tonal levels. transparencyMode: flatten.

select control type: Preset JSONs may use "type": "select" with "options": ["2","3","4"]. The ControlsPanel renders these as a button group (pill buttons). Default value is a string. Values are sent as strings in job controls; gmicService converts to Number as needed.

gmicCommand field: All jobs now store gmicCommand: string | null — the exact G'MIC command used (with input.png / output.png path placeholders). Available after preview_ready or completed. Displayed in the right rail's collapsible "G'MIC Recipe" panel with a Copy button.

API Endpoints

  • GET /api/healthz — Health check
  • GET /api/presets — List all active presets
  • GET /api/presets/:code — Get specific preset
  • POST /api/uploads — Upload image (multipart/form-data)
  • GET /api/uploads/:id/preview — Get uploaded image
  • POST /api/jobs/preview — Create preview processing job
  • POST /api/jobs/final — Create final render job
  • GET /api/jobs/:jobId — Get job status
  • GET /api/jobs/:jobId/preview — Get job preview image
  • GET /api/jobs/:jobId/download — Download final output

Job States

queuedvalidatingpreview_processingpreview_ready (for preview jobs) queuedvalidatingfinal_processingcompleted (for final jobs) Also: failed, expired

G'MIC Filter Reference

Full catalog: docs/implementation/gmic-filter-catalog.md

  • 521 production-grade filters across 20 categories (excluding 694 Testing + 9 About)
  • Print-critical categories (Tier 1, add presets from these first): Patterns (53), Colors (50), Artistic (38), Repair (38), Degradations (37), Details (32), Black & White (20), Contours (18), Layers (17), Lights & Shadows (16)
  • Advanced/Tier 2: Deformations (41), Rendering (41), Arrays & Tiles (27), Silhouettes (22), Frames (14), Various (11), Frequencies (4)
  • Never expose: Testing (694), About (9)

Suggested next presets: Risograph Print, Screen Print, Etching/Engraving, Glitch Art, VHS Retro, Linocut, Charcoal Sketch, Cyanotype, Blueprint, Light Leak Film — all mapped to specific CLI commands in the catalog.

V1 Scope (No permanent storage)

  • Uploads and renders are temporary (in-memory job store + local filesystem)
  • No user accounts or billing
  • No persistent cloud storage
  • No G'MIC CLI (simulated processing for V1 on Replit)
  • Files expire after 2 hours (enforced by TTL logic)

Key Commands

  • pnpm run typecheck — full typecheck across all packages
  • pnpm run build — typecheck + build all packages
  • pnpm --filter @workspace/api-spec run codegen — regenerate API hooks and Zod schemas from OpenAPI spec
  • pnpm --filter @workspace/api-server run dev — run API server locally
  • pnpm --filter @workspace/printfx run dev — run frontend locally

Folder Structure

/artifacts
  /printfx      — React+Vite frontend (5-step workflow UI)
  /api-server   — Express API server
/core
  /presets      — JSON preset definitions (audit-friendly)
  /pipelines    — Pipeline assembly logic (future)
/docs
  /architecture — System architecture docs
  /presets      — Per-preset documentation
  /api          — API endpoint docs
  /implementation — Setup and deployment guides
/storage
  /tmp          — Ephemeral file storage
    /uploads    — Uploaded originals (2h TTL)
    /previews   — Preview renders (2h TTL)
    /finals     — Final renders (3h TTL)
/lib
  /api-spec     — OpenAPI spec + codegen config
  /api-client-react — Generated React Query hooks
  /api-zod      — Generated Zod schemas
  /db           — Drizzle ORM schema (for future DB use)