Architecture
High-level
Shopper (storefront) Merchant (Shopify admin)
│ │
Theme app extension Embedded app (App Bridge)
"Try it on" widget /merchant, /settings, /billing …
│ │
└──────────────► Next.js app (Vercel) ◄────┘
app.tryvio.ai
│
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
Supabase Shopify Admin API AI providers
(Postgres + Storage) (GraphQL, webhooks, (KIE.AI / fal.ai)
Billing, Web Pixel)Surfaces
- Storefront widget — a Shopify theme app extension injected into the merchant’s theme.
Calls the public storefront API routes (
/api/storefront/*) and the app proxy (/api/proxy). - Embedded merchant app — Next.js pages rendered inside Shopify admin via App Bridge
(
/merchant,/settings,/billing,/products,/brand,/discounts, …). Detected via thex-tryvio-shell: embeddedheader /hostparam. - Public marketing site — the landing page at
/(when no Shopifyhost/shop), plus/contact,/privacy,/terms, and the standalone live demo. - Admin/operator dashboard —
/admin, PIN-gated, for internal operations.
Request routing
src/app/page.tsx is the fork: Shopify traffic (has host or shopify=installed&shop)
redirects to /merchant; everyone else gets the public <LandingPage />.
Key external services
| Service | Purpose |
|---|---|
| Supabase | Postgres (all app data) + Storage (input/output/merchant image buckets) |
| Shopify Admin API | OAuth, product sync, orders, billing, discounts, Web Pixel |
| KIE.AI / fal.ai | AI try-on image generation |
| Vercel | Hosting, cron jobs, env management |
Cron jobs
Defined in apps/web/vercel.json:
/api/cron/billing-overage— daily 02:00, charges pending overage./api/cron/storage-cleanup— daily 03:00, expires old try-on images.