ZeusInLabs PRD Made by ZeusInLabs
B2B SaaS Platform

ClearYields

A comprehensive platform for growers and agricultural companies to automate harvest data collection, track inventory, generate reports, and forecast yields. Replace manual paper-based workflows with OCR-powered data ingestion, automated email parsing, and a unified dashboard.

01

Tech Stack

⚑
Next.js 14+
App Router, SSR, RSC
🐘
PostgreSQL
Self-hosted, JSONB
πŸ”
Better Auth
OAuth, Magic Links, RBAC
πŸ’³
Stripe
Subscriptions & Billing
πŸ“¦
S3-Compatible
MinIO / Cloudflare R2
πŸ”
OCR Engine
Cloud or Self-hosted
πŸ“§
ForwardEmail
Email Ingestion
βš™οΈ
Trigger.dev
Background Jobs
02

Multi-Crop Architecture

Flexible, crop-agnostic data model supporting apples, pears, stone fruit, soft fruit, hops, and more. Configurable terminology, units, defect types, and grade classes per tenant.

Concept Apple Example Soft Fruit Example DB Approach
Production Unit Orchard Polytunnel production_units table with type field
Container Bin (333kg) Crate (20kg) container_types table, per tenant
Product Variety (Gala) Variety (Elsanta) product_variants linked to crop_types
Defects Scab, Russet, Rot Mould, Bruise defect_types table, per crop
Grades Class 1/2/Juice Grade A/B/Processing grade_classes table, per crop
03

Feedback Module

Central hub for all data entering the system. Multiple ingestion methods for different workflows.

Structured Forms P0

Web forms for dispatch notes, grading reports, returns, and remittances

OCR Upload P0

Photo/PDF upload with field extraction and user confirmation

AI Chat Assistant P1

Natural language to structured records conversion

Email Parsing P1

Inbound webhook parses grader PDFs automatically

OCR Pipeline

πŸ“€
Upload
Photo or PDF document
↓
πŸ”§
Pre-processing
Deskew, contrast adjustment, crop
↓
πŸ”
OCR + Field Extraction
Regex + LLM for ambiguous fields
↓
πŸ“Š
Confidence Scoring
Highlight low-confidence extractions
↓
βœ…
User Review & Confirm
Pre-filled form, write to database
04

Stores Module

Real-time produce inventory tracking across all locations with ledger-based movement tracking.

Locations

Production units, stores (CA/ambient), processors, virtual holds

Movement Types

Harvest in, dispatch out, graded, returns, sales, transfers, adjustments

Derived Views

Stock at location, to be graded, awaiting return, days in store

Shrinkage Tracking

Configurable rates: 0.5%/week (CA), 1.5%/week (ambient)

05

Reports Module

Generate all operational and financial reports with global filters and branded output.

Report Description Output
Dispatch Summary All dispatches by unit/variant/processor PDF, CSV
Grading Breakdown Class splits, defect analysis, yield % PDF, CSV
Grower Return Per-unit P&L: gross - costs = net PDF
Storage Report Stock in store, days stored, shrinkage PDF, CSV
Cash Reconciliation Expected vs received, overdue remittances PDF, CSV
Season Pack Complete season summary with KPIs PDF (multi-page)
06

Feedforward Module

Predictive analytics for yield forecasting, revenue estimation, and risk assessment.

Data Inputs

Historical yields, weather API, unit metadata, manual observations

Yield Prediction

Historical average + weather adjustment + observation blend

Revenue Forecast

Yield Γ— class Γ— Β£/kg from prior year data

Scenario Planning

Simulate unit changes, weather impacts, processor switches

07

Constants Module

Tenant-level settings and master data configuration with full audit trail.

🏒
Tenant Settings
Branding, defaults, seasons
🌱
Crop Types
Apples, strawberries, etc.
πŸ“¦
Container Types
Bins, crates, pallets
πŸ—ΊοΈ
Production Units
Orchards, fields, tunnels
🍎
Product Variants
Varieties per crop
🏭
Processors
Graders & packhouses
08

Authentication & Permissions

Better Auth integration with email/password, OAuth, magic links, and tenant isolation.

ROLE
Feedback Stores Reports Forecast Constants
Admin
Full Full Full Full Full
Finance
View/Edit View Full View View
Field
Full View View View View
Read-Only
View View View View β€”
09

Implementation Phases

Phase 1: Foundation (MVP)
Core functionality and data entry
Β£7,500
50% of budget
Next.js setup with Better Auth
PostgreSQL + Drizzle ORM
Tenant onboarding wizard
CRUD operations (all entities)
Dispatch Notes entry
Grading Reports entry
Inventory ledger
Basic reports
Stripe integration
Mobile-responsive UI
Phase 2: Automation
OCR, email parsing, and integrations
Β£4,500
30% of budget
OCR upload pipeline
Email ingestion webhook
Auto-matching logic
Notification system
PDF generation with branding
CSV exports
Cash reconciliation
Phase 3: Scale & Forecasting
Predictions, scenarios, and polish
Β£3,000
20% of budget
Weather API integration
Basic yield forecasting
Scenario planning UI
Season pack report
Full RBAC
Audit trail UI
Performance tuning
10

Budget Summary

Total Project Budget
Β£15,000
Phase Scope Cost %
Phase 1 Foundation (MVP) Β£7,500 50%
Phase 2 Automation Β£4,500 30%
Phase 3 Scale & Forecasting Β£3,000 20%

Hosting Estimate: Production VPS (8 vCPU, 16GB RAM) ~€14.99/mo on Hetzner with managed backups and EU data residency.

Payment Terms: Each phase is paid upfront before development begins. Phase 1 (Β£7,500) β†’ Phase 2 (Β£4,500) β†’ Phase 3 (Β£3,000). Next phase payment is due upon completion of the previous phase.