Infrastructure & Deployment Architecture
High-Level Infrastructure Map
graph TB
subgraph "DNS & Edge — Cloudflare"
CF_DNS["☁️ Cloudflare DNS\nwearfits.com + all subdomains"]
CF_W["⚡ Cloudflare Workers"]
end
subgraph "Google Cloud Platform"
GAE["🖥️ App Engine (Flexible)\nnodejs-server\ndev.wearfits.com"]
GCS["🪣 GCP Storage\n3D objects, configs,\nmodel files"]
end
subgraph "Vercel"
V_SAAS["▲ Vercel\nsaas\ndash.wearfits.com"]
V_SHOP["▲ Vercel\nshopify-wearfits\ntryon-shop.wearfits.com"]
V_DB_SAAS[("🗄️ Prisma (Vercel)\nSaaS DB\nusers, plans, billing")]
V_DB_SHOP[("🗄️ Prisma (Vercel)\nShopify DB\nshops, products, jobs")]
end
subgraph "Modal.com"
M_CPU["🐍 Modal App (CPU)\nwearfits-genai-api\nPython endpoints"]
M_GPU["🎮 Modal App (GPU)\nwearfits-genai-api\nML inference"]
end
subgraph "External Services"
STRIPE["💳 Stripe\nPayments"]
SHOPIFY["🛍️ Shopify\nApp Platform"]
HUBSPOT["📧 HubSpot\nCRM"]
end
CF_DNS --> CF_W
CF_DNS --> GAE
CF_DNS --> V_SAAS
CF_DNS --> V_SHOP
CF_W -->|"api.wearfits.com\ntryon.wearfits.com\nwearfits.com/*"| CF_W
CF_W -->|proxy to Modal| M_CPU
CF_W -->|proxy to Modal| M_GPU
GAE --> GCS
V_SAAS --> V_DB_SAAS
V_SHOP --> V_DB_SHOP
V_SAAS --> STRIPE
V_SHOP --> SHOPIFY
GAE -.->|"3D models\nfor try-on"| CF_W
M_GPU -.->|"generated 3D\nmodels"| GCS
Provider → Service Matrix
| Provider |
Service |
Repo |
Domain |
What runs there |
| GCP App Engine (Flexible) |
Compute |
nodejs-server |
dev.wearfits.com |
AR try-on backend, 3D model management, product API, legacy demos |
| GCP Storage |
Object storage |
nodejs-server |
— |
All 3D objects (GLB), model configs, textures, positioning data |
| Vercel |
Serverless + DB |
saas |
dash.wearfits.com |
Admin dashboard, account management, billing |
| Vercel |
Serverless + DB |
shopify-wearfits |
tryon-shop.wearfits.com |
Shopify app backend (used by Shopify) |
| Vercel Prisma |
Database |
saas |
— |
Users, API keys, plans, payments, usage |
| Vercel Prisma |
Database |
shopify-wearfits |
— |
Shops, products, images, processing jobs, wizard state |
| Modal.com |
CPU App |
wearfits-genai-api |
— |
Python endpoints (non-GPU tasks) |
| Modal.com |
GPU App |
wearfits-genai-api |
— |
ML inference (shoe3d, digital-twin, virtual-fitting) |
| Cloudflare Workers |
Edge compute |
multiple |
api.wearfits.com |
API gateway, routing, GenAI endpoints |
| Cloudflare Workers |
Edge compute |
wearfits-genai-app |
tryon.wearfits.com |
GenAI try-on frontend app |
| Cloudflare Workers |
Edge compute |
website2026 |
wearfits.com |
Main website |
| Cloudflare Workers |
Edge compute |
wearfits-marketing |
wearfits.com/* |
Landing pages |
| Cloudflare Workers |
Edge compute |
hubspot-api |
— |
Contact form → HubSpot |
| Cloudflare Workers |
Edge compute |
various small apps |
subdomains / routes |
Misc micro-services |
| Cloudflare |
DNS |
— |
wearfits.com |
DNS for all domains and subdomains |
Database Architecture
erDiagram
SaaS_DB {
string "Provider: Vercel Prisma"
string "Used by: saas (dash.wearfits.com)"
}
SaaS_DB ||--o{ Users : contains
SaaS_DB ||--o{ ApiKeys : contains
SaaS_DB ||--o{ Plans : contains
SaaS_DB ||--o{ Payments : contains
SaaS_DB ||--o{ Usage : contains
Shopify_DB {
string "Provider: Vercel Prisma"
string "Used by: shopify-wearfits (tryon-shop.wearfits.com)"
}
Shopify_DB ||--o{ Shops : contains
Shopify_DB ||--o{ Products : contains
Shopify_DB ||--o{ ProcessingJobs : contains
Shopify_DB ||--o{ WizardState : contains
GCP_Storage {
string "Provider: GCP Storage"
string "Used by: nodejs-server"
}
GCP_Storage ||--o{ GLB_Models : contains
GCP_Storage ||--o{ Textures : contains
GCP_Storage ||--o{ Configs : contains
Note: nodejs-server (GCP App Engine) does not use Prisma — it uses GCP Storage for object/model data. The two Prisma databases (SaaS and Shopify) are completely separate and do not share data.
Authentication & Payments
graph LR
subgraph "Dashboard Auth"
USER[Client] -->|magic link email| SAAS[dash.wearfits.com]
SAAS -->|no passwords\nno OAuth| SAAS
end
subgraph "Payments"
SAAS -->|subscriptions| STRIPE[Stripe]
STRIPE -->|webhooks| SAAS
end
subgraph "Shopify Auth"
MERCHANT[Shopify Merchant] -->|Shopify OAuth| SHOP[shopify-wearfits]
SHOP -->|billing via| SHOPIFY_BILLING[Shopify Managed Pricing]
end
subgraph "API Auth"
CLIENT[API Client] -->|API key from Dashboard| API[api.wearfits.com]
end
| Service |
Auth method |
Payments |
| Dashboard (dash.wearfits.com) |
Magic link (email only, no passwords, no OAuth) |
Stripe subscriptions |
| Shopify App |
Shopify OAuth (native) |
Shopify Managed Pricing |
| API (api.wearfits.com) |
API key (generated in Dashboard) |
Via Dashboard subscription |
| AR Try-On (dev.wearfits.com) |
API key / session from Dashboard |
Via Dashboard subscription |
Request Flow: API Call
sequenceDiagram
participant Client as API Client
participant CF as Cloudflare Workers<br/>api.wearfits.com
participant Modal_CPU as Modal (CPU)<br/>Python
participant Modal_GPU as Modal (GPU)<br/>ML Inference
participant GCS as GCP Storage
Client->>CF: POST /shoe3d (API key + photos)
CF->>CF: Auth check (API key validation)
CF->>Modal_CPU: Forward request
Modal_CPU->>Modal_GPU: ML inference job
Modal_GPU-->>Modal_CPU: 3D model result
Modal_CPU->>GCS: Store generated GLB
Modal_CPU-->>CF: Response (model URL + try-on link)
CF-->>Client: JSON response
Domain Routing
All DNS is managed in Cloudflare. Routing:
| Domain |
Points to |
Notes |
wearfits.com |
Cloudflare Workers |
Main website + marketing landing pages |
dev.wearfits.com |
GCP App Engine |
AR try-on, product management, legacy |
api.wearfits.com |
Cloudflare Workers |
API gateway → proxies to Modal for ML |
tryon.wearfits.com |
Cloudflare Workers |
GenAI try-on frontend app |
dash.wearfits.com |
Vercel |
SaaS admin dashboard |
tryon-shop.wearfits.com |
Vercel |
Shopify app backend |
*.wearfits.com |
Cloudflare Workers |
Various micro-services and small apps |
Future / Planned
- Fly.io — potential migration for some services (under consideration)