Update readmes and imporve UI

This commit is contained in:
Urtzi Alfaro
2025-12-19 09:28:36 +01:00
parent a6ae730ef0
commit 71ee2976a2
10 changed files with 1035 additions and 155 deletions

View File

@@ -11,7 +11,7 @@ Bakery-IA is an **AI-powered SaaS platform** designed specifically for the Spani
## Platform Architecture Overview
### System Design
- **Architecture Pattern**: Microservices (18 independent services)
- **Architecture Pattern**: Microservices (21 independent services)
- **API Gateway**: Centralized routing with JWT authentication
- **Frontend**: React 18 + TypeScript progressive web application
- **Database Strategy**: PostgreSQL 17 per service (database-per-service pattern)
@@ -45,7 +45,24 @@ Bakery-IA is an **AI-powered SaaS platform** designed specifically for the Spani
## Service Documentation Index
### 📚 Comprehensive READMEs Created (7/20)
### 📚 Comprehensive READMEs Created (15/21)
**Fully Documented Services:**
1. API Gateway (700+ lines)
2. Frontend Dashboard (800+ lines)
3. Forecasting Service (1,095+ lines)
4. Training Service (850+ lines)
5. AI Insights Service (enhanced)
6. Sales Service (493+ lines)
7. Inventory Service (1,120+ lines)
8. Production Service (394+ lines)
9. Orders Service (833+ lines)
10. Procurement Service (1,343+ lines)
11. Distribution Service (961+ lines)
12. Alert Processor Service (1,800+ lines)
13. Orchestrator Service (enhanced)
14. Demo Session Service (708+ lines)
15. Alert System Architecture (2,800+ lines standalone doc)
### 🎯 **New: Alert System Architecture** ([docs/ALERT-SYSTEM-ARCHITECTURE.md](./ALERT-SYSTEM-ARCHITECTURE.md))
**2,800+ lines | Complete Alert System Documentation**
@@ -85,7 +102,7 @@ Bakery-IA is an **AI-powered SaaS platform** designed specifically for the Spani
**700+ lines | Centralized Entry Point**
**Key Features:**
- Single API endpoint for 18+ microservices
- Single API endpoint for 21 microservices
- JWT authentication with 15-minute token cache
- Rate limiting (300 req/min per client)
- Server-Sent Events (SSE) for real-time alerts
@@ -149,6 +166,38 @@ Bakery-IA is an **AI-powered SaaS platform** designed specifically for the Spani
---
#### 2b. **Demo Onboarding System** ([frontend/src/features/demo-onboarding/README.md](../frontend/src/features/demo-onboarding/README.md))
**210+ lines | Interactive Demo Tour & Conversion**
**Key Features:**
- **Interactive guided tour** - 12-step desktop, 8-step mobile (Driver.js)
- **Demo banner** with live session countdown and time remaining
- **Exit modal** with benefits reminder and conversion messaging
- **State persistence** - Auto-resume tour with sessionStorage
- **Analytics tracking** - Google Analytics & Plausible integration
- **Full localization** - Spanish and English translations
- **Mobile-responsive** - Optimized for thumb zone navigation
**Tour Steps Coverage:**
- Welcome Metrics Dashboard Pending Approvals System Actions
- Production Plan Database Nav Operations Analytics Multi-Bakery
- Demo Limitations Final CTA
**Tracked Events:**
- `tour_started`, `tour_step_completed`, `tour_dismissed`
- `tour_completed`, `conversion_cta_clicked`
**Business Value:**
- Guided onboarding reduces setup friction
- Auto-resume increases completion rates
- Conversion CTAs throughout demo journey
- Session countdown creates urgency
- 3-second comprehension with progressive disclosure
**Technology:** Driver.js, React, TypeScript, SessionStorage
---
#### 3. **Forecasting Service** ([services/forecasting/README.md](../services/forecasting/README.md))
**850+ lines | AI Demand Prediction Core**
@@ -297,54 +346,120 @@ Data Collection → Feature Engineering → Prophet Training
### Core Business Services
**7. Inventory Service** ([services/inventory/README.md](../services/inventory/README.md))
**Enhanced | Stock Management & Receipt System**
**1,120+ lines | Stock Management & Food Safety Compliance**
**Key Features:**
- Stock tracking with FIFO (First-In-First-Out)
- Expiration management and alerts
- Low stock alerts with intelligent thresholds
- Food safety compliance (HACCP)
- Barcode support
- **Stock Receipt System (NEW)**:
- Comprehensive ingredient management with FIFO consumption and batch tracking
- Automatic stock updates from delivery events with batch/expiry tracking
- HACCP-compliant food safety monitoring with temperature logging
- Expiration management with automated FIFO rotation and waste tracking
- Multi-location inventory tracking across storage locations
- Enterprise: Automatic inventory transfer processing for internal shipments
- **Stock Receipt System**:
- Lot-level tracking with expiration dates (food safety requirement)
- Purchase order integration with discrepancy tracking
- Draft/Confirmed receipt workflow
- Line item validation (sum of lots must equal actual quantity)
- Alert integration (DELIVERY_ARRIVING_SOON, STOCK_RECEIPT_INCOMPLETE)
- HACCP compliance enforcement (expiration dates required for perishables)
- Atomic transaction on confirmation (stock updates, lot creation, PO status update, alert resolution)
- Draft/Confirmed receipt workflow with line item validation
- Alert integration and automatic resolution on confirmation
- Atomic transactions for stock updates and PO status changes
**Alert Types Published:**
- Low stock alerts (below reorder point)
- Expiring soon alerts (within threshold days)
- Food safety alerts (temperature violations)
**Business Value:**
- 100% food safety compliance (lot traceability)
- 95% delivery discrepancy detection
- 30% faster receiving process
- Automatic alert resolution on receipt confirmation
- Waste Reduction: 20-40% through FIFO and expiry management
- Cost Savings: 200-600/month from reduced waste
- Time Savings: 8-12 hours/week on manual tracking
- Compliance: 100% HACCP compliance (avoid 5,000+ fines)
- Inventory Accuracy: 95%+ vs. 70-80% manual
**Technology:** FastAPI, PostgreSQL, Redis, RabbitMQ
**Technology:** FastAPI, PostgreSQL, Redis, RabbitMQ, SQLAlchemy
**8. Production Service**
- Production scheduling
- Batch tracking
- Quality control
- Equipment management
- Capacity planning
**8. Production Service** ([services/production/README.md](../services/production/README.md))
**394+ lines | Manufacturing Operations Core**
**Key Features:**
- Automated forecast-driven scheduling (7-day advance planning)
- Real-time batch tracking with FIFO stock deduction and yield monitoring
- Digital quality control with standardized templates and metrics
- Equipment management with preventive maintenance tracking
- Production analytics with OEE and cost analysis
- Multi-day scheduling with automatic equipment allocation
**Alert Types Published (8 types):**
- Production delays, equipment failures, capacity overload
- Quality issues, missing ingredients, maintenance due
- Batch start delays, production start notifications
**Business Value:**
- Time Savings: 10-15 hours/week on planning
- Waste Reduction: 15-25% through optimization
- Quality Improvement: 20-30% fewer defects
- Capacity Utilization: 85%+ vs 65-70% manual
**Technology:** FastAPI, PostgreSQL, Redis, RabbitMQ, SQLAlchemy
---
**9. Recipes Service**
- Recipe management
- Ingredient quantities
- Batch scaling
- Cost calculation
- Recipe management with versioning
- Ingredient quantities and scaling
- Batch size calculation
- Cost estimation and margin analysis
- Production instructions
**10. Orders Service**
- Customer order management
- Order lifecycle tracking
- Customer database
---
**11. Procurement Service**
- Automated procurement planning
- Purchase order management
- Supplier integration
- Replenishment planning
**10. Orders Service** ([services/orders/README.md](../services/orders/README.md))
**833+ lines | Customer Order Management**
**Key Features:**
- Multi-channel order management (in-store, phone, online, wholesale)
- Comprehensive customer database with RFM analysis
- B2B wholesale management with custom pricing
- Automated invoicing with payment tracking
- Order fulfillment integration with production and inventory
- Customer analytics and segmentation
**Alert Types Published (5 types):**
- POs pending approval, approval reminders
- Critical PO escalation, auto-approval summaries
- PO approval confirmations
**Business Value:**
- Revenue Growth: 10-20% through improved B2B
- Time Savings: 5-8 hours/week on management
- Order Accuracy: 99%+ vs. 85-90% manual
- Payment Collection: 30% faster with reminders
**Technology:** FastAPI, PostgreSQL, Redis, RabbitMQ, Pydantic
---
**11. Procurement Service** ([services/procurement/README.md](../services/procurement/README.md))
**1,343+ lines | Intelligent Purchasing Automation**
**Key Features:**
- Intelligent forecast-driven replenishment (7-30 day projections)
- Automated PO generation with smart supplier selection
- Dashboard-integrated approval workflow with email notifications
- Delivery tracking with automatic stock updates
- EOQ and reorder point calculation
- Enterprise: Internal transfers with cost-based pricing
**Alert Types Published (7 types):**
- Stock shortages, delivery overdue, supplier performance issues
- Price increases, partial deliveries, quality issues
- Low supplier ratings
**Business Value:**
- Stockout Prevention: 85-95% reduction
- Cost Savings: 5-15% through optimized ordering
- Time Savings: 8-12 hours/week
- Inventory Reduction: 20-30% lower levels
**Technology:** FastAPI, PostgreSQL, Redis, RabbitMQ, Pydantic
**12. Suppliers Service**
- Supplier database
@@ -454,9 +569,61 @@ Data Collection → Feature Engineering → Prophet Training
**Technology:** FastAPI, PostgreSQL, RabbitMQ, Kubernetes CronJobs
**20. Demo Session Service**
- Ephemeral demo environments
- Isolated demo accounts
**20. Demo Session Service** ([services/demo_session/README.md](../services/demo_session/README.md))
**708+ lines | Demo Environment Management**
**Key Features:**
- Direct database loading approach (eliminates Kubernetes Jobs)
- XOR-based deterministic ID transformation for tenant isolation
- Temporal determinism with dynamic date adjustment
- Per-service cloning progress tracking with JSONB metadata
- Session lifecycle management (PENDING READY EXPIRED DESTROYED)
- Professional (~40s) and Enterprise (~75s) demo profiles
- Frontend polling mechanism for status updates
- Session extension and retry capabilities
**Session Statuses:**
- PENDING: Data cloning in progress
- READY: All data loaded, ready to use
- PARTIAL: Some services failed, others succeeded
- FAILED: Cloning failed
- EXPIRED: Session TTL exceeded
- DESTROYED: Session terminated
**Business Value:**
- 60-70% performance improvement (5-15s vs 30-40s)
- 100% reduction in Kubernetes Jobs (30+ 0)
- Deterministic data loading with zero ID collisions
- Complete session isolation for demo accounts
**Technology:** FastAPI, PostgreSQL, Redis, Async background tasks
---
**21. Distribution Service** ([services/distribution/README.md](../services/distribution/README.md))
**961+ lines | Enterprise Fleet Management & Route Optimization**
**Key Features:**
- VRP-based route optimization using Google OR-Tools
- Real-time shipment tracking with GPS and proof of delivery
- Delivery scheduling with recurring patterns
- Haversine distance calculation for accurate routing
- Parent-child tenant hierarchy integration
- Enterprise subscription gating with tier validation
**Event Types Published:**
- Distribution plan created
- Shipment status updated
- Delivery completed with proof
**Business Value:**
- Route Efficiency: 20-30% distance reduction
- Fuel Savings: 200-500/month per vehicle
- Delivery Success Rate: 95-98% on-time delivery
- Time Savings: 10-15 hours/week on route planning
- ROI: 250-400% within 12 months for 5+ locations
**Technology:** FastAPI, PostgreSQL, Google OR-Tools, RabbitMQ, NumPy
---
@@ -794,8 +961,8 @@ Bakery-IA represents a **complete, production-ready AI-powered SaaS platform** s
---
**Document Version**: 2.0
**Last Updated**: November 26, 2025
**Document Version**: 3.0
**Last Updated**: December 19, 2025
**Prepared For**: VUE Madrid (Ventanilla Única Empresarial)
**Company**: Bakery-IA