Wynn Fame avatar
Wynn Fame
Fort Worth, Texas
Home
About
Work
Resume
Skills
Journey
Gallery
Contact
AI Assistant

Lab Software

Lab Software

Test-lab platform for decoration (print) testing — requests, scheduling across two labs, per-color results, versioned PDF reports, billing export, client portal, and a built-in AI agent on Next.js, Drizzle, and PostgreSQL.

Project Overview

Lab Software is the internal platform a decoration test laboratory uses to run print-durability test jobs for apparel brands: a customer requests a test, the lab schedules it, technicians record results for every fabric color, a PDF report is issued, and the job is invoiced.

Before the platform, every job was typed into four or five places — email, a task board, a billing spreadsheet, a slide deck for the report, and the accounting system. The goal was simple: enter each job once.

Request → Samples received → Scheduled → Results per color → Review → PDF report → Invoice

Role & Delivery

Designed and built end to end as full-stack engineer and system architect — data model, access control, results editor, PDF pipeline, scheduling, client portal, AI agent, test suites, and production rollout on DigitalOcean with Cloudflare R2.

Core Capabilities

  • Requests — One request = one report number = one PDF report. Sample, fabric and fibre-composition data, fabric colors with swatch / CMYK, and one or more tests (Screen Print, Heat Transfer, DTG, Embroidery, Dye Migration…). Drafts, submission, and sample receipt drive the due date from business-day turnaround rules (standard / priority / rush).
  • Results editor — Each test copies its default layout (general or per-customer) into report pages → tables → columns. Every column × color is a searchable row: ratings in half steps, A/B/C grades, signed mm with automatic % change, red / red-star flags, row comments, and photos with in-app crop and rotate.
  • Result-driven rules — Low ratings can add stock recommendations automatically, and poor dye-migration results suggest skipping the discharge section (and re-price the test).
  • Two labs, one queue — Schedule overview, kanban board, calendar, due-date groups and run sheets; drag a card to change status, hand work off to the other lab with a note. Optimistic locking prevents silent overwrites when both labs edit the same job.
  • Customer reports — Server-rendered PDFs (headless Chrome) stored privately in R2 with full version history, download links, and optional customer email.
  • Search data — Query any individual result or request across tests, colors, fabrics and fibre %, with CSV export.
  • Billing — Invoice lines derived from tests × colors × price lists plus fees; accounting CSV export today, API integration ready.
  • Client portal — Customers submit requests, follow a simplified status (Submitted / In testing / Complete), and download finished reports — only for their own company.
  • Built-in AI agent — Every server action is exposed as a typed tool. Staff chat with the agent to do real work under their own permissions, with confirmation before risky steps and review / undo of each action. The same tool runner powers a documented HTTP API.

Foundation (Phase 1)

  • Accounts — Email / username sign-in, Google sign-in for existing accounts, magic links, 2FA (authenticator or email code, backup codes), sessions, “switch account” view-as
  • Access control — Users, roles, user groups, and a module × action permission matrix; root account; route and action guards
  • Settings — General, lab rules, notifications, email (Brevo + SMTP fallback) with branded templates and logs, storage, uploads, appearance — secrets AES-256-GCM encrypted
  • Media — Private-by-default R2 library with WebP optimisation and a picker
  • Operations — Scheduled database / media backups to R2 with restore, versioned SQL migrations with an admin Migrate page, activity log, health and cron endpoints
  • System map — Interactive diagrams of features, request journey, data structure, statuses, and who may do what

Technology Stack

LayerChoices
AppNext.js 16 (App Router), React 19, TypeScript, Tailwind CSS v4, Radix UI
DataPostgreSQL 18, Drizzle ORM + SQL migrations, zod v4
AuthAuth.js v5, TOTP 2FA, Google OAuth
StorageCloudflare R2 (S3 API), sharp
EmailBrevo transactional API, Nodemailer fallback
DocumentsHeadless Chrome PDF rendering, Plate rich text
DiagramsReact Flow (system map)
Qualitynode:test unit + integration tests, Playwright E2E and screenshot suite

Architecture Highlights

  • Strict layering: server-component pages → server actions (permission → zod → write → activity log → revalidate → result) → server-only reads
  • Lab results stored as relational rows, never JSON blobs — so search, export and reporting query them directly
  • Docs-first workflow: every behaviour change updates its spec and changelog in the same change
  • One code path for humans and AI: agent tools call the exact server actions the UI calls, and a test fails if any action lacks a tool
  • Consistent admin kit (list controls, drawers, vertical tabs, rail panels) and every page verified at 375 px

Outcome

One system replaces the email → task board → spreadsheet → slides → accounting chain: a job is entered once and flows from request to invoice, with searchable results, versioned reports, a self-service portal for customers, and an AI assistant that can do the clicking.

Explore
My WorkResume