API-HUB is a modular monolith made up of four distinct systems: a FastAPI backend, a Next.js 15 admin frontend, an n8n automation engine, and a TypeScript custom n8n node (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/VisualGraphxLLC/API-HUB/llms.txt
Use this file to discover all available pages before exploring further.
n8n-nodes-onprintshop). Each system has a clearly defined role, and the boundaries between them are enforced at the network level — not just by convention.
System overview
The admin UI and n8n both talk exclusively to FastAPI. Neither service touches the database directly. FastAPI is the only writer to PostgreSQL, which means audit logging, encryption, and validation happen in one place.FastAPI backend
The backend is organized into domain modules. Each module owns its own router, models, and service layer. There are no cross-module database calls — modules communicate through the service layer or via the catalog schema.API routes
/api/suppliers — Supplier CRUD and import
/api/suppliers — Supplier CRUD and import
adapter_class, encrypted auth_config, enabled status, and PromoStandards directory metadata.POST /api/suppliers/{id}/import triggers a catalog import job. The request body specifies a discovery mode:| Mode | Behavior |
|---|---|
full_sellable | Fetches the supplier’s entire sellable catalog |
delta | Fetches only products changed since the last sync timestamp |
closeouts | Fetches discontinued/clearance items |
first_n | Fetches the first N products — useful for testing |
/api/products — Catalog browse and PDP
/api/products — Catalog browse and PDP
/api/products/{id}) returns full variant data including size matrix, colors, and pricing tiers — the data needed to render a product detail page (PDP)./api/customers — OPS authentication
/api/customers — OPS authentication
/api/markup-rules — Pricing rule configuration
/api/markup-rules — Pricing rule configuration
/api/pricing/quote — Live price calculation
/api/pricing/quote — Live price calculation
/api/sync-jobs/health — Per-supplier sync monitoring
/api/sync-jobs/health — Per-supplier sync monitoring
/api/push-log — Audit trail
/api/push-log — Audit trail
Backend modules
The backend contains 22 domain modules. Key modules and their responsibilities:suppliers + ps_directory
catalog
product_type field and all variant data including size matrices and color maps.markup + pricing
ops_push + push_mappings
push_log. Works in tandem with the n8n ops-push workflow.n8n_proxy
auth + audit_log
Adapter registry
The adapter registry is the core of API-HUB’s supplier-agnostic design. When an import is triggered, the registry reads the supplier’sadapter_class field and instantiates the corresponding Python class at runtime.
Built-in adapters
| Adapter | Protocol | Notes |
|---|---|---|
PromoStandardsAdapter | SOAP (zeep) | Base class for all PromoStandards-compliant suppliers |
SanMarAdapter | SOAP (zeep) | Subclass of PromoStandardsAdapter with SanMar-specific overrides |
FourOverAdapter | REST + HMAC | Signs requests with HMAC-SHA256; handles FourOver’s print catalog schema |
OPSAdapter | GraphQL inbound | Handles product data incoming from OPS storefront events |
BaseAdapter interface
Every adapter implements theBaseAdapter abstract base class:
Polymorphic catalog
All products share one catalog schema, but the pricing and variant model differs byproduct_type.
- Apparel
- Print
product_type = "apparel") use a tiered variant model. Each variant is keyed by color and size, with quantity break pricing:n8n automation pipeline
n8n owns all external API calls — to supplier endpoints and to OPS storefronts. This is a deliberate architectural choice: it keeps external network calls auditable, retryable, and configurable without redeploying the FastAPI backend.Scheduled workflows
| Workflow | Schedule | Mode |
|---|---|---|
catalog-sync-weekly | Sunday 1:00 AM | full_sellable |
pricing-sync-daily | Daily | delta |
inventory-sync-hourly | Every hour | delta |
closeouts-monthly | 1st of each month | closeouts |
ops-push | Triggered | Runs after import or on demand |
POST /api/suppliers/{id}/import with the appropriate mode. FastAPI processes the response, writes to PostgreSQL, and returns enriched data. n8n then pushes any updated products to OPS storefronts via the n8n-nodes-onprintshop GraphQL node.
ops-push workflow is trigger-based, not scheduled. It runs automatically after a successful import or can be invoked manually from the n8n UI for a specific customer.Key design decisions
Suppliers are DB rows, not code
Suppliers are DB rows, not code
adapter_class field tells the registry which Python class to instantiate; the encrypted auth_config JSONB blob holds all credentials. This makes supplier management an operator task, not a developer task.n8n owns external API calls
n8n owns external API calls
All credentials encrypted at rest
All credentials encrypted at rest
EncryptedJSON SQLAlchemy field type transparently encrypts and decrypts JSONB columns using Fernet AES-128. The encryption key is derived from SECRET_KEY. Credentials are managed through the admin UI — operators never interact with raw JSON or environment-variable credential files per supplier.Modular monolith over microservices
Modular monolith over microservices
Polymorphic catalog with one API surface
Polymorphic catalog with one API surface
product_type discriminator field drives pricing logic internally. This simplifies the frontend and any downstream integrations — callers do not need to know which endpoint to call based on product category.PostgreSQL 16 with asyncpg and JSONB
PostgreSQL 16 with asyncpg and JSONB
auth_config, product attributes, and decoration options are all stored as JSONB, indexed where queried.