🏛️ Sammoho C4 Architecture Hub

C4 Architectural Blueprints

Interactive System Context, Container Decomposition, and Structurizr DSL models for the Sammoho Amazon FBA Automator Suite.

C4 Level 1: System Context Diagram

Maps the high-level boundary of the FBA Supply Chain Automator software system, showing how the Founder/Operator interacts with the platform alongside external Amazon, Keepa, 3PL, and AI integrations.

flowchart TB
    Operator["👤 Operator / Founder
[Person]
Oversees FBA inventory, PO escrow, PPC, & legal IP"] subgraph Boundaries ["Enterprise Trust Boundary"] Cloudflare["🔒 Cloudflare Zero Trust Tunnel
[External Service]
ops.sammoho.com with Email PIN Wall"] FBA["⚙️ FBA Supply Chain Automator
[Software System]
Autonomous Amazon FBA operations & compliance engine"] end subgraph External ["External Services & APIs"] SPAPI["🛒 Amazon SP-API
[External REST API]
Catalog, Inbound, Orders, FBA Stock"] AdsAPI["📈 Amazon Advertising API
[External REST API]
Sponsored Products & Dayparting"] Keepa["📊 Keepa Data API
[External REST API]
BSR, Price History, Buy Box"] ShipBob["🏭 ShipBob 3PL WMS
[External Service]
MCF fulfillment & carrier tracking"] Discord["🔔 Discord Operations Matrix
[Webhooks]
Real-time milestone & exception alerts"] Gemini["✨ Google Gemini 2.5 Flash AI
[AI REST API]
VOC sentiment & bilingual CAPA tickets"] end Operator -->|"HTTPS (Port 443)"| Cloudflare Cloudflare -->|"Encrypted Tunnel"| FBA FBA -->|"LWA OAuth 2.0"| SPAPI FBA -->|"REST Bidding"| AdsAPI FBA -->|"HTTPS Telemetry"| Keepa FBA -->|"REST / HMAC Webhooks"| ShipBob FBA -->|"HTTPS Webhooks"| Discord FBA -->|"Generative AI"| Gemini style FBA fill:#0369a1,stroke:#38bdf8,stroke-width:2px,color:#fff style Operator fill:#0284c7,stroke:#38bdf8,color:#fff style Cloudflare fill:#1e293b,stroke:#64748b,color:#fff style SPAPI fill:#334155,stroke:#64748b,color:#fff style AdsAPI fill:#334155,stroke:#64748b,color:#fff style Keepa fill:#334155,stroke:#64748b,color:#fff style ShipBob fill:#334155,stroke:#64748b,color:#fff style Discord fill:#334155,stroke:#64748b,color:#fff style Gemini fill:#334155,stroke:#64748b,color:#fff

C4 Level 2: Container Decomposition

Decomposes the internal containers powering the system: the Web UI console, the Spring Boot 4.1.x microservices backend, and the PostgreSQL 17 relational database.

flowchart TB
    Operator["👤 Operator / Founder
[Browser User]"] subgraph FBA ["FBA Automator Architecture Containers"] direction TB WebApp["💻 Web Operations Console
[HTML5 / Vanilla JS / React Components]
Single-page interface with 145+ module panels"] Backend["☕ Spring Boot Backend Application
[Java 25 LTS / Spring Boot 4.1.x]
Financial math (BigDecimal), schedulers, REST controllers"] Database[("🗄️ PostgreSQL Master Database
[PostgreSQL 17]
Persists state across 145+ relational tables")] end subgraph ExtIntegrations ["External Cloud APIs"] SPAPI2["Amazon SP-API"] AdsAPI2["Amazon Ads API"] Keepa2["Keepa Data API"] Discord2["Discord Symmetrical Webhooks"] end Operator -->|"Interacts via UI"| WebApp WebApp -->|"JSON / REST APIs (Port 8080)"| Backend Backend -->|"JPA / Hibernate (Port 5432)"| Database Backend -->|"SP-API Orders & Inbound"| SPAPI2 Backend -->|"Hourly Bid Multipliers"| AdsAPI2 Backend -->|"Historical BSR / Prices"| Keepa2 Backend -->|"Webhooks"| Discord2 style WebApp fill:#0369a1,stroke:#38bdf8,stroke-width:2px,color:#fff style Backend fill:#047857,stroke:#34d399,stroke-width:2px,color:#fff style Database fill:#4338ca,stroke:#818cf8,stroke-width:2px,color:#fff

1. Web Operations Console

Hosts 145+ operational panels, P&L cash runways, AWD replenishments, and live action triggers.

Port 8080 / Static SPA

2. Spring Boot Backend

Java 25 LTS service layer, strict BigDecimal math, REST controllers, and webhook dispatchers.

Spring Boot 4.1.x

3. PostgreSQL Master DB

145+ independent schema tables with zero-cross-table foreign-key locks for seamless migrations.

PostgreSQL 17

Structurizr DSL Specification

Source of truth definition stored in architecture/workspace.dsl:

workspace "Sammoho FBA Automator" "Enterprise Architecture C4 Model for the Sammoho Amazon FBA Automator Suite." {

    model {
        operator = person "Operator / Founder" "Manages Amazon FBA inventory, procurement, PPC, pricing, and brand protection operations." "Founder"

        fbaSystem = softwareSystem "FBA Supply Chain Automator" "Autonomous enterprise Amazon FBA operations, procurement, multi-channel velocity, and compliance platform." {
            webApp = container "Web Operations Console" "Delivers single-page responsive dashboards, 145+ module control panels, and interactive operational studios." "HTML5 / Vanilla JS / React UI Components" "Web App"
            backendApp = container "Spring Boot Backend Application" "Executes financial math, deterministic fee tier algorithms, automated schedulers, and RESTful API endpoints." "Java 25 LTS / Spring Boot 4.1.x / Jakarta EE 11" "Backend Service"
            database = container "PostgreSQL Master Database" "Persists transactional and relational state across 145+ operational tables (procurement, inventory, pricing, brand protection)." "PostgreSQL 17 Relational Database" "Database"
        }

        cloudflareTunnel = softwareSystem "Cloudflare Zero Trust Tunnel" "Secure encrypted reverse proxy and email PIN authentication wall protecting ops.sammoho.com." "External Service"
        amazonSpApi = softwareSystem "Amazon Selling Partner API (SP-API)" "Official Amazon REST API for catalog items, inbound shipments, FBA inventory, and orders." "External Service"
        amazonAdsApi = softwareSystem "Amazon Advertising API" "Programmatic Sponsored Products campaigns, dayparting bid multipliers, and ad group metrics." "External Service"
        keepaApi = softwareSystem "Keepa Data API" "Historical Best Seller Rank (BSR), Buy Box price tracking, and competitor sales velocity data." "External Service"
        shipbobWms = softwareSystem "ShipBob 3PL WMS" "Omnichannel warehouse fulfillment, carrier tracking, and external pallet receiving." "External Service"
        discordWebhooks = softwareSystem "Discord Operations Server" "Real-time symmetrical notification channels for procurement milestones, stockouts, and legal notices." "External Service"
        geminiAi = softwareSystem "Google Gemini 2.5 Flash AI" "Voice-of-Customer review sentiment extraction, bilingual factory translation, and listing copy optimization." "External Service"

        # Relationships
        operator -> cloudflareTunnel "Accesses ops.sammoho.com with Email PIN verification" "HTTPS / TLS 1.3"
        cloudflareTunnel -> webApp "Routes authenticated HTTP requests to front-end assets" "HTTP / Port 8080"
        operator -> webApp "Navigates module panels, submits operational actions, reviews P&L" "Browser"
        webApp -> backendApp "Dispatches REST API requests with X-Operator-Key auth" "JSON / REST"
        backendApp -> database "Reads and writes transactional entities via Hibernate / JPA" "JDBC / PostgreSQL Driver"

        backendApp -> amazonSpApi "Syncs inventory levels, submits inbound plans, tracks FBA shipments" "REST / LWA OAuth 2.0"
        backendApp -> amazonAdsApi "Pushes hourly dayparting bids and target ACOS rules" "REST / Amazon Ads API"
        backendApp -> keepaApi "Queries ASIN price history and competitor Buy Box rotation" "REST / HTTPS"
        backendApp -> shipbobWms "Dispatches MCF fulfillment orders and ingests tracking webhooks" "REST / HMAC Webhooks"
        backendApp -> discordWebhooks "Dispatches automated operational embeds to live/sandbox channels" "HTTPS Webhooks"
        backendApp -> geminiAi "Sends review text and prompts for sentiment analysis and CAPA drafts" "REST / Gemini API"
    }

    views {
        systemContext fbaSystem "SystemContext" "High-level System Context diagram for the FBA Automator platform." {
            include *
            autoLayout lr
        }

        container fbaSystem "Containers" "Container architecture diagram illustrating internal Spring Boot, React/HTML, and PostgreSQL components." {
            include *
            autoLayout tb
        }
    }
}