Skip to content

dangitbobbeh/watch-inventory

Repository files navigation

⌚ Watch Inventory

A full-stack inventory management system for luxury watch dealers, featuring AI-powered CSV import, trade tracking, profit analytics, and real-time business insights.

Live Demo: watch-inventory-two.vercel.app

Next.js TypeScript Prisma Tailwind CSS Tests

Screenshot 2025-12-08 at 2 26 12 PM

Features

AI-Powered CSV Import

Upload any CSV format and Claude automatically maps columns to the correct fields—no manual configuration required.

  • Smart column detection: "Price Paid" → purchasePrice, "S/N" → serial, "Sold For" → salePrice
  • Status normalization: Handles 15+ variations ("For Sale", "Listed", "Available" → in_stock)
  • Flexible date parsing: ISO, US (MM/DD/YYYY), European (DD-MM-YYYY), natural language
  • Currency formatting: Strips symbols and commas ($12,500.00 → 12500)
  • Custom fields: Columns that don't fit the schema are preserved as JSON
  • Two import modes: Create new inventory OR update existing watches with sale data

Trade Tracking

Record watch-for-watch trades with a guided wizard that handles the bookkeeping automatically.

  • 4-step trade flow: Select outgoing watch → Set trade value → Enter incoming watch details → Confirm
  • Cash difference support: Even trades, trades where you receive cash, or trades where you pay cash
  • Automatic cost basis: Calculates correct cost basis for the incoming watch
  • Linked records: Trade relationships are tracked—see what you traded for what
  • Profit attribution: Trade value counts as sale price for P&L calculations

Inventory Management

  • Track watches with detailed specs (brand, model, reference, serial, year, condition, accessories)
  • Record full purchase details (source, price, shipping, service costs)
  • Track sales with complete cost breakdown (platform fees, marketing, shipping, tax)
  • Automatic profit/loss calculation per watch
  • Auto-sold status: Adding a sale price automatically marks the watch as sold
  • Duplicate watch: One-click duplication for when you buy the same model again
  • Filter and search by brand, model, reference, status, source, or platform
  • Sortable columns with pagination

CSV Export

Export your inventory data for backup, analysis, or use in other tools.

  • All watch details and financials included
  • Calculated fields: total cost, total fees, profit, ROI %
  • Filter by status (all, in stock, sold)
  • Properly escaped CSV format

Financial Analytics

  • Real-time dashboard: inventory count, total sales, profit, average margin
  • Detailed P&L breakdown per transaction
  • ROI and margin calculations
  • Support for cents-level precision

Reports

  • Profit breakdown by brand, source, and sale platform
  • Monthly performance trends
  • Top and bottom performers
  • Inventory aging analysis (days in stock)
  • Average days to sell metrics

AI Assistant

A unified AI interface for all your business intelligence needs:

  • Quick Actions: One-click buttons for common tasks
    • Analyze Inventory
    • Help Price a Watch
    • Find Slow Movers
    • Performance Review
  • Business Chat: Natural language queries ("What's my best brand?", "How did Q3 compare to Q2?")
  • Context-aware: AI has access to your full inventory and sales history

Modern UI/UX

  • Dark mode with system preference detection
  • Keyboard shortcuts (press ? to view all)
  • Toast notifications for all actions
  • Form autocomplete from your historical data
  • Contextual empty states
  • Mobile-responsive design

Tech Stack

Category Technology
Framework Next.js 15 (App Router, Turbopack)
Language TypeScript
Database PostgreSQL (Neon)
ORM Prisma
Auth NextAuth.js v5 (Google OAuth)
AI Anthropic Claude API
Styling Tailwind CSS 4
Testing Jest, Testing Library
CI/CD GitHub Actions, Vercel

Testing

The project includes 120+ tests covering imports and calculations.

Tests run automatically on every push—failed tests block deployment.

Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • Google OAuth credentials
  • Anthropic API key

Installation

# Clone the repo
git clone https://github.com/dangitbobbeh/watch-inventory.git
cd watch-inventory

# Install dependencies
npm install

# Set up environment
cp .env.example .env
# Edit .env with your credentials

# Set up database
npx prisma migrate dev

# Start dev server
npm run dev

Environment Variables

DATABASE_URL="postgresql://user:password@localhost:5432/watch_inventory"
ANTHROPIC_API_KEY="sk-ant-..."
AUTH_SECRET="generate-with-openssl-rand-base64-32"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

Generate AUTH_SECRET:

openssl rand -base64 32

Google OAuth Setup

  1. Go to Google Cloud Console
  2. Create/select a project → APIs & ServicesCredentials
  3. Create CredentialsOAuth client IDWeb application
  4. Add redirect URIs:
    • http://localhost:3000/api/auth/callback/google (dev)
    • https://your-domain.vercel.app/api/auth/callback/google (prod)

Deployment

Vercel (Recommended)

  1. Push to GitHub
  2. Import project in Vercel
  3. Add Postgres via Vercel Storage (Neon)
  4. Set environment variables
  5. Deploy

Migrations run automatically via the build command.

CSV Import

The AI import handles any column naming, but here's what it looks for:

Watch Details

Brand, Model, Reference/Ref #, Serial/S/N, Year, Material, Dial Color, Diameter, Condition, Accessories

Purchase Info

Purchase Date, Source/Dealer/Bought From, Cost/Price Paid, Shipping, Service/Repair Costs

Sale Info

Sale Date, Sale Price/Sold For, Platform, Fees/Commission, Tax, Shipping Out, Marketing

Status

"For Sale", "Available", "Listed" → in_stock
"Sold", "Completed", "Closed" → sold
"Traded", "Trade" → traded
"Consigned", "Memo" → consigned

Unrecognized columns are stored as custom data and displayed on the watch detail page.

Contributing

Contributions welcome! Please open an issue first to discuss what you'd like to change.

License

MIT License - see LICENSE for details.


Built by David Bernstein

About

AI Watch Inventory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages