Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
81 changes: 64 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# Cannabis Inventory Management System

A comprehensive React-based web application designed for cannabis inventory tracking, barcode scanning, and thermal label generation. The system supports multiple data sources, automatic allergen detection, and production-ready label printing optimized for Zebra ZT610 thermal printers.
[![React](https://img.shields.io/badge/React-18-61DAFB?logo=react&logoColor=white)](https://reactjs.org/)
[![Vite](https://img.shields.io/badge/Vite-5-646CFF?logo=vite&logoColor=white)](https://vitejs.dev/)
[![Tailwind](https://img.shields.io/badge/Tailwind-3.4-06B6D4?logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
[![Supabase](https://img.shields.io/badge/Supabase-PostgreSQL-3ECF8E?logo=supabase&logoColor=white)](https://supabase.com/)
[![CI](https://github.com/claygeo/cannabis-inventory-system/actions/workflows/ci.yml/badge.svg)](https://github.com/claygeo/cannabis-inventory-system/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)

A production React application for cannabis inventory tracking, barcode scanning, and thermal label generation. Handles multi-source CSV/Excel imports, automatic allergen detection, and Zebra ZT610-optimized label printing at 203 DPI. Cloud-synced master product list via Supabase with offline localStorage fallback.

Running in production since 2024. Currently at v7.4.1.

## Table of Contents

- [Features](#features)
- [Tech Stack](#tech-stack)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Environment Configuration](#environment-configuration)
Expand All @@ -13,6 +23,7 @@ A comprehensive React-based web application designed for cannabis inventory trac
- [Label Generation](#label-generation)
- [Thermal Printer Configuration](#thermal-printer-configuration)
- [Development](#development)
- [Build](#build)
- [Production Deployment](#production-deployment)
- [Security Notes](#security-notes)

Expand All @@ -29,12 +40,31 @@ A comprehensive React-based web application designed for cannabis inventory trac
- **Responsive Dark UI**: Modern dark theme optimized for warehouse environments
- **Label Preview**: Live preview of labels before printing
- **Calibration Tools**: Printer alignment testing and calibration utilities
- **Master List Cloud Sync**: Supabase-backed product list with 1000+ record pagination
- **Unmapped Product Admin**: Override system for unrecognized products with remap history
- **Multi-Location Support**: HSTD (horizontal) and MTD (vertical) label formats
- **Version-Aware State**: Automatic cache invalidation on app updates

---

## Tech Stack

| Layer | Technology |
|-------|------------|
| Frontend | React 18, React Router 6 |
| Build | Vite 5 |
| Styling | Tailwind CSS 3.4 (custom dark theme, 400+ lines) |
| Labels | jsPDF (PDF generation), JsBarcode (Code 39) |
| Data Import | PapaParse (CSV), SheetJS (Excel) |
| Cloud Sync | Supabase (PostgreSQL, master product list) |
| Printer | Zebra Browser Print SDK (ZPL generation) |
| Hosting | Netlify (SPA routing, security headers, asset caching) |

## Prerequisites

Before setting up the project, ensure you have the following:

- **Node.js (v16+) and npm**: Install from [nodejs.org](https://nodejs.org)
- **Node.js (v18+) and npm**: Install from [nodejs.org](https://nodejs.org)
- **Modern Web Browser**: Chrome, Firefox, Safari, or Edge
- **Zebra ZT610 Thermal Printer** (optional): For physical label printing
- **Label Stock**: 4" × 6" thermal labels compatible with Zebra ZT610
Expand All @@ -47,7 +77,7 @@ Follow these steps to set up the project locally:
### 1. Clone the Repository

```bash
git clone https://github.com/your-username/cannabis-inventory-system.git
git clone https://github.com/claygeo/cannabis-inventory-system.git
cd cannabis-inventory-system
```

Expand Down Expand Up @@ -209,16 +239,6 @@ src/
└── constants.js # Application constants
```

### Key Technologies

- **React 18+**: Modern React with hooks and context
- **Vite**: Fast build tool and dev server
- **Tailwind CSS**: Utility-first CSS framework
- **React Router**: Client-side routing
- **jsPDF**: PDF generation for labels
- **Papa Parse**: CSV processing
- **SheetJS**: Excel file processing

### Development Scripts

```bash
Expand All @@ -228,6 +248,26 @@ npm run preview # Preview production build
npm run lint # Run ESLint
```

---

## Build

Production build via Vite with manual chunk splitting for optimal caching.

| Chunk | Raw | Gzip |
|-------|-----|------|
| react | 141 KB | 45 KB |
| utils (papaparse, jsbarcode, jspdf, xlsx) | 872 KB | 281 KB |
| html2canvas | 201 KB | 48 KB |
| app code | 482 KB | 118 KB |
| router | 21 KB | 8 KB |
| ui (lucide, toast) | 22 KB | 8 KB |
| CSS | 101 KB | 14 KB |

CI pipeline runs on every push and PR to master: `npm ci` and `npm run build`.

---

## Production Deployment

### Environment Setup
Expand Down Expand Up @@ -329,8 +369,15 @@ For support and questions:

## Changelog

### Version 5.5.0
- Added environment variable configuration
- Improved security for credential management
### v7.4.1
- Unmapped products admin dashboard with remap history
- Fix dark theme consistency on admin pages

### v7.3.0
- Supabase cloud sync for master product list
- Pagination support for 1000+ products
- Auto-fix strain placeholder with actual strain data

### v5.5.0
- Environment variable configuration for credentials
- Enhanced documentation and setup process
- Updated authentication system with fallbacks
Loading