Gemstone Trading ERP
The Problem
Thousands of precious stones, three currencies, clients who take stones home “on approval” for weeks before deciding. Every stone needs traceability from purchase to sale, every transaction needs accurate margins after exchange rate conversions, and the business needs real-time analytics across all of it. Spreadsheets stopped being an option a long time ago.
I joined this project mid-development and became the primary contributor, taking ownership of major features across both frontend and backend.
The Solution
A full-stack ERP application managing the complete gemstone lifecycle, built as a modern SPA with a REST API backend.
Statistics and Analytics Module (built from scratch)
Designed and implemented the complete business intelligence layer:
- Sales statistics: yearly/quarterly revenue breakdown by sale type, material, weight class, region, country, city, and top clients, with multi-currency CHF conversion using per-year exchange rates
- Margin analysis: profit margin calculations by year and lot type, tracking purchase cost vs. sale price with weighted averages
- Purchase tracking: stock purchased by year with current inventory status (sold, in stock, on consignment)
- Stock valuation: total inventory value with IC tax rate filtering
- 15+ interactive chart components using ApexCharts (bar, line, scatter, pie) with reusable base components and composables
Multi-Currency Exchange Rate System
Implemented end-to-end exchange rate handling across the entire application in a single PR touching 49 files. All financial document flows (customer/supplier invoices, credits, consignments, logistics imports/exports) now use nullable exchange rates with proper fallback handling. When automated rates are unavailable, a modal prompts users to enter manual rates.
Logistics and Customs Module
Built the full logistics module for international gemstone shipments: Swiss customs (AFC) report generation with quarterly totals, shipment lifecycle management with auto-closing, AI-assisted customs declaration autofill using OpenAI, scheduled alert emails for pending shipments, pro-forma date calculations, and stock loan balance tracking.
Customer Presentations
Built a complete presentation workflow for showcasing gemstone selections: sublot selection UI within consignment views with initial/current state toggling, PDF generation with paired stone layouts and single-image exports, Excel table export for email distribution, and automatic pairing suggestions when confiding paired stones.
Jewelry Cases, Loan Invoices, and Commissions
- Jewelry cases: stone pairing functionality, sale/consignment price propagation to sub-elements, color-coded visual indicators, and case-level financial balance calculations
- Loan invoices: specialized invoice type for stock loans (always USD-denominated), with own PDF template showing CHF conversion, strict validation rules, credit notes, and traceability linking to customer invoices
- Commission tracking: commissions on customer invoices, withdrawals module for retrocessions and deductions, dedicated dashboards with totals and breakdowns
Settings, PDFs, and Label Printing
- Settings panel: 25+ configuration pages across gemstone settings (materials, colors, shapes, qualities, origins, treatments, certificates), document settings (bank accounts, customs procedures, tax rates), and contact settings (categories, countries, regions)
- PDF system: templates for all document types (consignments, invoices, credits, presentations, logistics, loan invoices) with Imagick-based thumbnail generation for gallery previews
- Label printing: configurable margins, bold text, auto portrait/landscape orientation, A4 and label-size formats, printable from sublots, lots, boxes, and contacts
Other Contributions
- Supplier consignment workflows: code prefix conversion, weight correction transactions for stone recutting, bulk element type updates, and consignment duplication
- Stock security: password-locked stock changes with unified modal for creating, correcting, or transferring sublots
- Inventory exports: batched styling for large datasets, Swiss VAT rounding compliance, paired stone exports
- Navigation and UX: extracted navigation ID logic to separate endpoints to prevent page load delays, consistent search filtering across entity types
- Infrastructure: Docker deployment (Nginx + PHP-FPM), automated backups, multi-storage filesystem (local, S3, Cloudflare R2, SFTP), application monitoring with Laravel Nightwatch
Tech Stack
- Backend: Laravel (PHP), Action pattern (lorisleiva/laravel-actions), Repository pattern
- Frontend: Nuxt, Vue.js, TypeScript, Pinia, Quasar UI, ApexCharts
- Database: MySQL
- PDF/Excel: DomPDF, Imagick, Maatwebsite Excel, League CSV
- Storage: AWS S3, Cloudflare R2, Infomaniak SFTP
- Auth: Laravel Sanctum
- Monitoring: Sentry, Laravel Nightwatch
Outcomes
- Complete business intelligence layer with 15+ interactive charts covering sales, margins, purchases, and stock valuation across 3 currencies
- End-to-end multi-currency system (49-file PR) with nullable exchange rates, manual entry fallback, and per-year CHF conversion across all financial documents
- Logistics and customs module with Swiss AFC reports, AI-assisted autofill, scheduled alerts, and automated shipment lifecycle management
- Customer presentation workflows with PDF/Excel generation, paired stone layouts, and automatic pairing suggestions
- Jewelry case management, loan invoicing (USD-denominated), and commission/withdrawal tracking with dedicated dashboards
- 25+ settings pages, PDF templates across all document types with thumbnail previews, and configurable label printing
- 50% of all commits (563 of 1,120) across both frontend and backend repos