- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
1.4 KiB
1.4 KiB
Product Search Engine Architecture
Decoupled SearchService Abstraction
The application interacts with search via a strict SearchService interface to decouple business logic from OpenSearch cluster topology.
Backend Routers / Services
│
▼
SearchService Interface
│
├─────► OpenSearch Cluster (Normal Production Mode)
│
└─────► Restricted MySQL Fallback (Circuit Breaker Mode)
OpenSearch Outage Circuit Breaker Strategy
flowchart TD
Req["Incoming Search Request"] --> CBCheck{"Circuit Breaker State"}
CBCheck -->|Closed / Healthy| OpenSearch["Execute OpenSearch Faceted Search"]
CBCheck -->|Open / Tripped| FallbackChoice{"Query Type Check"}
FallbackChoice -->|Exact ID / SKU / Category| DirectMySQL["Execute Simple Indexed MySQL Query"]
FallbackChoice -->|Complex Multi-Filter Query| RejectGracefully["Reject Gracefully\n(429 / 503 Basic Mode Notification)"]
Out-of-Order Event Protection
Every search indexing event contains aggregate_id and aggregate_version.
Consumer Logic:
IF incoming.aggregate_version <= current_index.aggregate_version THEN
IGNORE (Stale Event)
ELSE IF incoming.aggregate_version == current_index.aggregate_version + 1 THEN
APPLY UPDATE
ELSE
RE-QUEUE FOR SEQUENTIAL PROCESSING
END IF