Architecture Documentation

Complete technical overview of the Mapp Size Allocation Intelligence platform

System Architecture

DATA SOURCESLoft CSV CataloguePython GeneratorsCSV / Excel Import3,665 ProductsBACKEND (FastAPI + DuckDB)Ingestion PipelineCSV → 50k chunks → DBDuckDB17 tables · thread-safeSize Curve Engine4 modifier types · 5 archetypes35+ attribute modifiersAnalysis EnginesStores · Categories · AttributesClustering · Pre-Break · EconomicProduct Health · Customers · CampaignsDecision EngineReallocate · Rebalance · Alert · CampaignConfiguration SystemPresets · Runtime · ThresholdsREST API (8 routers)/api/brands · /api/analysis/api/decisions · /api/simulation/api/customers · /api/export · /api/configSimulation EngineAllocation vs. Demand · What-IfSecurity & MiddlewareCORS · Rate Limit · API Key · HeadersFRONTENDNext.js 15 · React 19 · RechartsDashboardExecutive SummaryStores & Store DetailOnline ChannelCategories & StylesProduct HealthCustomersPre-Break AnalysisBuy TemplatesPrediction EngineAttributes & ImpactClustering (PCA)RecommendationsCampaignsImpact ModellerSettings & ImportConfiguration & DocsReact Query · Custom HooksTailwind CSS · Lucide IconsToast Notifications · Error Boundaries

Data Flow Pipeline

Loft CSVCatalogueProductGeneratorTransactionGeneratorCSV Files(data/)DuckDBImportMetricComputationDecisionGenerationREST APIResponseEnd-to-end data flow: source catalogue → generated data → analytics → actionable decisions

Mapp Size Allocation Intelligence is a full-stack analytics platform that optimises size-level stock allocation for fashion retailers. It combines a FastAPI backend with DuckDB analytical storage, a Next.js 15 frontend, and a suite of Python data generators that produce realistic synthetic retail data from real Loft (Ann Taylor) catalogue attributes.

Three-Layer Architecture

LayerTechnologyPurpose
Data PipelinePython generators + CSV + DuckDBGenerate, validate, and store 3,665 products across 62 stores (60 physical + 2 online DC) with 4 seasons of transactions
Intelligence BackendFastAPI + 8 API routersAnalysis engines, decision generation, simulation, prediction, customer analytics, campaigns, and configuration management
PresentationNext.js 15 + React 19 + Recharts20 interactive pages with React Query data fetching and real-time chart visualisation

Key Numbers

MetricValue
Products3,665 (from Loft catalogue)
Stores62 (60 physical across 15 US states + 2 online DC)
Allocations~2.4M records
Sales~11.6M records
Stockouts~1.8M records
Markdowns~1.7M records
Returns~323K records
Customers4.7M (supply-side assignment from sales)
Customer Transactions11.6M records
Size Systems3 (US Numeric, UK Numeric, Letter)
Product Attributes15+ (fit, texture, occasion, colour, pattern, wardrobe, range, neckline, sleeve length, length, waist, etc.)
Store Archetypes5 (Urban, Family, Mature, Student, Online)
Mapp Size Allocation Intelligence v0.9.0 — Architecture Documentation