LabTrack Pro

Operations

Original Idea

Lab Inventory for Schools A web app with barcode checkouts, alerts, and simple reorder lists.

Product Requirements Document (PRD): LabTrack Pro

1. Executive Summary

LabTrack Pro is a specialized laboratory inventory management system designed for school science departments. It streamlines the tracking of chemical reagents, glassware, and expensive equipment through a barcode-driven web interface and a local-first mobile companion app. By centralizing storage location hierarchy and automating safety compliance (SDS and expiration tracking), LabTrack Pro ensures that science educators spend less time on logistics and more time on instruction, while significantly reducing the risk of chemical safety incidents.

2. Problem Statement

School science departments currently rely on fragmented spreadsheets or manual paper logs, which lead to:

  • Safety Hazards: Expired or improperly stored chemicals going unnoticed.
  • Instructional Delays: Teachers planning experiments only to find necessary reagents are out of stock.
  • Budget Inefficiency: Double-ordering of items already present in different storage rooms.
  • Audit Failures: Difficulty in providing accurate inventory reports for safety inspections.

3. Goals & Success Metrics

  • Goal 1: Reduce the time required for a full inventory audit by 70%.
  • Goal 2: Eliminate "stock-out" incidents for scheduled curriculum experiments.
  • Goal 3: Ensure 100% compliance with Safety Data Sheet (SDS) accessibility.
  • Success Metrics:
    • Average time per check-out/check-in < 10 seconds.
    • Zero recorded instances of using expired hazardous chemicals.
    • System uptime of 99.9% during school hours.

4. User Personas

| Persona | Role | Primary Goal | | :--- | :--- | :--- | | Lab Technician | Primary Operator | Manage stock levels, prepare experiment "kits," and perform audits. | | Science Teacher | End User | Locate equipment and report low supplies. | | Department Head | Approver | Review budget reports and approve reorder lists. | | Safety Officer | Compliance | Monitor hazardous material locations and SDS documentation. |

5. User Stories

  • As a Lab Technician, I want to scan a barcode on a chemical bottle so that I can instantly deduct the used amount from the inventory.
  • As a Science Teacher, I want to search for "Microscopes" and see their exact storage hierarchy (Bldg A > Room 101 > Cabinet 3) so I don't waste time searching.
  • As a Department Head, I want to receive an automated weekly email of all items below their minimum threshold so I can consolidate a single purchase order.
  • As a Safety Officer, I want to filter the inventory for "Flammables" so that I can ensure they are stored in the correct fire-rated cabinets.

6. Functional Requirements

6.1 Inventory & Barcode Management

  • Barcode Scanning: Support for webcam-based scanning and external USB/Bluetooth scanners.
  • Transaction Ledger: Immutable log of every movement (IN, OUT, ADJUST, WASTE).
  • Unit Conversion: Support for different units (ml, g, units, packs) with automatic conversion (e.g., 1 pack = 50 pipettes).

6.2 Storage Hierarchy

  • Ltree Implementation: Support for deep nesting (Building > Room > Cabinet > Shelf > Bin).
  • Visual Map: A breadcrumb-style navigation for finding items.

6.3 Safety & Compliance

  • SDS Repository: Integrated PDF viewer with metadata for CAS numbers and hazard levels.
  • Expiration Alerts: System-wide notifications for chemicals approaching shelf-life limits.

6.4 Kitting & Curriculum Planning

  • Experiment Bundling: Group multiple items into a single "Kit" for a specific lesson (e.g., "Intro to Titration Kit").
  • Scaling Logic: Automatically calculate needed quantities based on class size (e.g., 1 beaker per 2 students).

7. Technical Requirements

7.1 Tech Stack (2026 Standards)

  • Frontend: React 19.2.3 (using React Compiler, RSC, and Actions).
  • Styling: Tailwind CSS 4.1.18 (Oxide engine, CSS-native config).
  • Backend: NestJS 11.1.12 (running on Fastify v5).
  • Database: PostgreSQL (with ltree extension enabled) via Prisma 7.2.0 (Rust-free client).
  • Authentication: Clerk (using Clerk Organizations for school-level isolation).
  • Mobile Sync: PowerSync for local-first SQLite sync in storage basements.

7.2 Integrations

  • Barcode Detection API: Native browser API with zbar.wasm polyfill.
  • Email: Postmark for transactional alerts.
  • PDF: react-pdf for SDS rendering using Web Workers.

8. Data Model

8.1 InventoryItem

  • id: UUID
  • sku: String (Unique)
  • name: String
  • hazardClass: Enum (Flammable, Corrosive, etc.)
  • locationPath: Ltree (e.g., ScienceBldg.Room202.Cab1)
  • currentQuantity: Decimal
  • minThreshold: Decimal
  • expiryDate: DateTime

8.2 InventoryTransaction (Ledger Pattern)

  • id: BigInt
  • itemId: FK -> InventoryItem
  • userId: String (Clerk ID)
  • delta: Decimal (Positive/Negative)
  • reason: String (Checkout, Restock, Audit)

8.3 SDS_Document

  • id: UUID
  • itemId: FK -> InventoryItem
  • fileUrl: String (S3 Signed URL)
  • revisionDate: DateTime

9. API Specification

POST /v1/inventory/checkout

Description: Deducts stock from an item via barcode scan. Request Body:

{
  "barcode": "CHEM-12345",
  "quantity": 500,
  "unit": "ml",
  "locationId": 101
}

Response: 201 Created with updated currentQuantity.

GET /v1/inventory/alerts

Description: Returns all items where currentQuantity <= minThreshold.

10. UI/UX Requirements

  • Scan-First Design: The dashboard should have a prominent "Quick Scan" button accessible within one tap.
  • Offline Indicator: A visual status bar showing sync status for mobile users in basements.
  • Skeleton States: Use skeleton loaders for PDF previews and large inventory tables.
  • Accessibility: High-contrast labels for hazardous materials; WCAG 2.1 Level AA compliance.

11. Non-Functional Requirements

  • Performance: All search queries must return in < 200ms using GiST indexing on ltree paths.
  • Security: Role-Based Access Control (RBAC). Only "Lab Technicians" and "Safety Officers" can edit chemical metadata.
  • Reliability: Transactions must be ACID compliant to prevent inventory "drifting."

12. Out of Scope

  • Integration with school finance/payroll systems.
  • Tracking of student grades or attendance.
  • Direct purchasing/payment gateway (only generates reorder lists).

13. Risks & Mitigations

| Risk | Mitigation | | :--- | :--- | | Connectivity: No Wi-Fi in chemical basements. | Implementation of PowerSync for offline-first data entry. | | Data Integrity: Users forgetting to scan items out. | Weekly "Quick Audits" prompted by the system for high-value items. | | Complexity: Teachers finding the system too hard to use. | Simplified "Teacher View" that only shows search and "Report Low" buttons. |

14. Implementation Tasks

Phase 1: Project Setup & Auth

  • [ ] Initialize NestJS 11.1.12 with Fastify and React 19.2.3.
  • [ ] Configure Tailwind CSS 4.1.18 with Oxide engine.
  • [ ] Set up Clerk Organizations and define roles: ADMIN, TECHNICIAN, TEACHER.
  • [ ] Provision AWS RDS PostgreSQL instance and enable ltree extension.

Phase 2: Core Inventory & Database

  • [ ] Define Prisma 7.2.0 schema with InventoryItem and Transaction models.
  • [ ] Implement Ledger-based stock updates with PostgreSQL Triggers for threshold checks.
  • [ ] Create ltree migration for hierarchical locations.
  • [ ] Build API endpoints for basic CRUD on inventory items.

Phase 3: Barcode & Hierarchy UI

  • [ ] Implement react-barcode-scanner with Barcode Detection API fallback.
  • [ ] Build "Location Browser" component using tree-view navigation.
  • [ ] Create "Quick Scan" mobile-responsive interface.
  • [ ] Implement debounce logic on scanner input to prevent duplicate entries.

Phase 4: Safety & Advanced Features

  • [ ] Integrate S3 for SDS PDF storage with CloudFront Signed URLs.
  • [ ] Build SDS Previewer using react-pdf and Web Workers.
  • [ ] Develop "Experiment Kitting" logic with student-count scaling.
  • [ ] Set up BullMQ for automated weekly reorder email alerts.

Phase 5: Offline & Optimization

  • [ ] Integrate PowerSync for local-first synchronization.
  • [ ] Implement react-window for virtualization of large inventory lists.
  • [ ] Set up JSON logging in NestJS for audit trails.
  • [ ] Final QA audit for WCAG 2.1 compliance.