Loading...
ā ļø PRELIMINARY DOCUMENTATION - NEEDS REVIEW
Note: This documentation was created with assumptions about the project architecture and technology stack. It requires review and correction based on the actual implementation.
This document will be reworked once the project is closer to final release.
If you notice inaccuracies, please flag them so this can be updated with actual project details.
Complete data flow diagrams for Flash Turbo CMS operations.
graph LR
subgraph Customer["š„ Customer"]
C1["Browse Store"]
C2["Add to Cart"]
C3["Checkout"]
end
subgraph Admin["šØāš¼ Admin"]
A1["Create Product"]
A2["Update Inventory"]
A3["Process Order"]
end
subgraph Frontend["š„ļø Frontend Apps"]
Store["Storefront"]
Manager["Manager"]
end
subgraph Backend["āļø Payload CMS"]
API["REST API"]
Auth["Authentication"]
Business["Business Logic"]
end
subgraph Data["š¾ Data Storage"]
DB["MongoDB"]
Cache["Redis"]
Files["AWS S3"]
end
C1 --> Store
C2 --> Store
C3 --> Store
A1 --> Manager
A2 --> Manager
A3 --> Manager
Store --> API
Manager --> API
API --> Auth
API --> Business
Auth --> DB
Business --> DB
Business --> Cache
Business --> Files
sequenceDiagram
Admin->>Manager: Click "+ New Product"
Manager->>Manager: Display form
Admin->>Manager: Fill product details
Manager->>API: POST /collections/products
Note over API: Validate data
API->>DB: Insert product document
Note over DB: Store with tenantId
DB->>Cache: Invalidate cache
API->>API: Generate cache tags
API->>Files: Process images (if any)
Files->>S3: Upload to S3
DB->>Cache: Store cache entry
API->>Manager: Return product ID
Manager->>Admin: Show success
Admin->>Admin: Redirected to product
sequenceDiagram
Admin->>Manager: Click "Publish"
Manager->>API: PATCH /collections/products/123
Note over API: Set status=published
API->>DB: Update product
DB->>Cache: Clear product cache
API->>Revalidation: Trigger revalidation
Revalidation->>CDN: Purge product page
Revalidation->>CDN: Clear product list
API->>Manager: Return updated product
Manager->>Admin: Show published
Note over Admin: Changes live in 5-30 sec
sequenceDiagram
Customer->>Store: View cart
Customer->>Store: Click "Checkout"
Store->>API: GET /api/checkout/init
API->>DB: Get products (verify in stock)
API->>Store: Return checkout session
Store->>Razorpay: Create payment order
Razorpay->>Customer: Show payment modal
Customer->>Razorpay: Enter card details
Razorpay->>Razorpay: Process payment
Razorpay->>API: POST webhook (payment_success)
API->>DB: Create Order document
API->>DB: Decrease product inventory
API->>DB: Create Transaction record
API->>Cache: Clear inventory cache
API->>Email: Send confirmation email
Email->>Customer: Confirmation email
API->>Store: Return success
Store->>Customer: Show order confirmation
sequenceDiagram
Admin->>Manager: View order #12345
Manager->>API: GET /collections/orders/12345
API->>DB: Fetch order + items
API->>Manager: Display order details
Admin->>Manager: Click "Mark Shipped"
Manager->>API: PATCH /collections/orders/12345
Note over API: Set status=shipped
API->>DB: Update order
API->>Email: Send shipping email
Email->>Customer: Shipping notification
API->>Cache: Invalidate order cache
API->>Manager: Show updated
Admin->>Admin: Order marked shipped
sequenceDiagram
Customer->>Store: Type search query
Store->>Store: Debounce 300ms
Store->>API: GET /api/products?search=coffee
Note over API: Resolve tenant
API->>Cache: Check cache key
Cache-->>API: Cache hit or miss
alt Cache Hit
Cache->>API: Return cached results
else Cache Miss
API->>DB: Query products
Note over DB: WHERE tenantId=ABC AND name LIKE coffee
DB->>API: Return results
API->>Cache: Store results (30 min TTL)
end
API->>Store: Return products
Store->>Store: Filter by price/rating
Store->>Customer: Display results
graph TB
subgraph Update["Update Inventory"]
Admin["Admin Update"]
System["Automatic Decrease"]
end
subgraph Processing["Processing"]
Validate["Validate Quantity"]
Check["Check Min Stock"]
Notify["Check Alert"]
end
subgraph Storage["Storage Update"]
DB["Update MongoDB"]
Cache["Clear Cache"]
Webhook["Trigger Event"]
end
subgraph Alert["Alerting"]
Email["Send Email"]
Dashboard["Update Dashboard"]
System2["System Alert"]
end
Admin --> Validate
System --> Validate
Validate --> Check
Check --> Notify
Notify --> DB
Notify --> Cache
Notify --> Webhook
DB --> Email
DB --> Dashboard
DB --> System2
sequenceDiagram
Admin->>Auth: Enter email & password
Auth->>Auth: Hash password
Auth->>DB: Query user by email
DB->>Auth: Return user
Auth->>Auth: Compare password hash
alt Credentials Valid
Auth->>Auth: Create JWT token
Auth->>Store: Set secure cookie
Auth->>Admin: Redirect to dashboard
else Credentials Invalid
Auth->>Admin: Show error
end
sequenceDiagram
Admin->>API: Request with JWT token
API->>Auth: Validate token
Auth->>Auth: Verify signature
Auth->>Auth: Check expiration
alt Token Valid
Auth->>DB: Load user & permissions
DB->>Auth: Return user data
Auth->>Auth: Verify user is admin
Auth->>Auth: Verify product belongs to tenant
Auth->>API: Allow request
API->>Endpoint: Execute operation
else Token Invalid/Expired
Auth->>API: Deny request
API->>Admin: Return 401
Admin->>Login: Redirect to login
end
sequenceDiagram
Admin->>API: Update product
API->>DB: Save to MongoDB
DB->>Event: Emit product.updated
Event->>Cache: Invalidate pattern
Note over Cache: Clear tenant_abc_products_*
Cache->>Revalidation: Pattern invalidated
Revalidation->>Queue: Add revalidation job
Queue->>Worker: Process revalidation
Worker->>CDN: Purge affected URLs
CDN->>CDN: Clear cache entries
Note over CDN: Next request fetches fresh
graph TB
Request["š¤ User Request"]
Middleware["Middleware: Identify Tenant"]
Query["Build Query"]
Execute["Execute Query"]
Results["Filter Results"]
Request --> Middleware
Middleware -->|Extract tenant from| URL["Domain"]
Middleware -->|Or| Session["Session"]
Middleware -->|Or| Token["JWT Token"]
URL --> Middleware
Session --> Middleware
Token --> Middleware
Middleware -->|Set tenantId| Query
Query -->|WHERE tenantId = ABC| Execute
Execute -->|MongoDB| Results
Results -->|Only tenant ABC data| Response["Response to User"]
sequenceDiagram
Customer->>CDN: Request product page
alt Page Cached
CDN->>Customer: Return cached HTML (instant)
Note over Customer: < 100ms response
else Cache Miss
CDN->>API: Forward request
API->>Cache: Check Redis
alt Data in Redis
Cache->>API: Return data
Note over API: < 50ms lookup
else Redis Miss
API->>DB: Query MongoDB
Note over DB: < 200ms query
DB->>Cache: Store result
DB->>API: Return data
end
API->>CDN: Return HTML + cache headers
CDN->>CDN: Cache for next requests
CDN->>Customer: Return HTML
end
sequenceDiagram
Admin->>Chat: Ask "Show all products"
Chat->>API: POST /api/ai/chat
API->>MCP: Create MCP client
MCP->>Tools: Load available tools
Tools->>API: Return tool definitions
API->>LLM: Send message + tools
LLM->>LLM: Decide to call find_products
LLM->>API: Tool call: find_products({limit: 10})
API->>DB: Query products
DB->>API: Return 10 products
API->>LLM: Tool result: [products...]
LLM->>LLM: Generate response
LLM->>API: "Found 10 products..."
API->>Chat: Stream response
Chat->>Admin: Display in real-time
Last Updated: October 27, 2025 Version: 1.0