projects

amboras

Description: The Shopify of the AI Era — brand brief to live store in under 5 minutes

README

Amboras

Brand brief → live Shopify storefront in under 5 minutes.

Amboras lets a founder describe their product in plain English and receive a fully generated, Shopify-backed storefront — brand identity, copy, products, and checkout — with no design or development work.

---

Generation Flow

User types a brand brief
        │
        ▼
┌───────────────────┐
│  /api/generate    │  SSE stream opens — progress events sent to browser
│                   │
│  1. Call AI       │──► OpenRouter → GPT-4o-mini
│                   │    Structured tool call forces a typed StoreConfig:
│                   │    brand, colors, hero copy, products, testimonials, FAQ
│                   │
│  2. Sync Shopify  │──► Shopify Admin REST API (2025-01)
│                   │    Creates real products + variants in the connected store
│                   │    Returns variantIds used for cart checkout later
│                   │
│  3. Save store    │──► File (.stores/id.json) locally
│                   │    Upstash Redis (store:id key + store:index set) in prod
└───────────────────┘
        │
        ▼
  Dashboard /dashboard/[storeId]
        │
        ├── Overview      real order count + revenue from Shopify
        ├── Analytics     daily revenue/orders chart, per-product sales (7/14/30d)
        ├── AI Editor     describe a change → AI patches StoreConfig in place
        └── Settings      Shopify connection status, danger zone

---

System Architecture

┌─────────────────────────────────────────────────────────────────┐
│                          Browser                                │
│                                                                 │
│   /               /store/[id]          /dashboard/[storeId]    │
│   Landing +        Branded storefront   Analytics, editor,      │
│   brief form       (client-rendered)    settings                │
│       │                  │                      │               │
└───────┼──────────────────┼──────────────────────┼───────────────┘
        │                  │                      │
        │ POST (SSE)        │ GET /api/stores/[id] │ GET /api/shopify/stats
        │                  │                      │ POST /api/stores/[id]/edit (SSE)
        ▼                  ▼                      ▼
┌─────────────────────────────────────────────────────────────────┐
│                     Next.js API Routes                          │
│                    (Node.js · Vercel serverless)                │
│                                                                 │
│  /api/generate          /api/stores/[id]    /api/shopify/stats  │
│  ─────────────          ────────────────    ───────────────     │
│  Orchestrates AI        GET  → store JSON   Fetch orders from   │
│  + Shopify sync         DELETE → remove     Shopify, group by   │
│  Returns SSE stream                         date + product      │
│                                                                 │
│  /api/stores/[id]/edit  /api/cart                               │
│  ──────────────────     ──────────                              │
│  AI patches existing    Build cart permalink                    │
│  StoreConfig via SSE    → { checkoutUrl }                       │
└──────────┬──────────────────────────────────────┬──────────────┘
           │                                      │
           ▼                                      ▼
┌─────────────────────┐              ┌────────────────────────────┐
│  OpenRouter         │              │  Shopify Admin REST API     │
│  → GPT-4o-mini      │              │                            │
│                     │              │  POST /products            │
│  Structured output  │              │  GET  /orders              │
│  via tool_choice    │              │  Cart permalink checkout    │
│  forces typed JSON  │              │                            │
│  (no parsing risk)  │              └────────────────────────────┘
└─────────────────────┘
           │
           ▼
┌─────────────────────────────────────────────────────────────────┐
│                       Persistence Layer                         │
│                                                                 │
│   Local dev                        Production                   │
│   ─────────                        ──────────                   │
│   .stores/[id].json                Upstash Redis                │
│   One file per store               store:[id]  → JSON blob      │
│                                    store:index → ID set         │
│                                                                 │
│   Same interface: getStore / saveStore / deleteStore            │
│   lib/store-cache.ts detects env and routes accordingly         │
└─────────────────────────────────────────────────────────────────┘

---

Data Model

GeneratedStore
├── id                string
├── brief             BrandBrief       (product, audience, vibe, competitors)
├── createdAt         Date
├── editHistory[]     { prompt, appliedAt }
│
├── config            StoreConfig
│   ├── brand         { name, tagline, colors ×4, fontStyle }
│   ├── hero          { headline, subheadline, ctaText × 2 }
│   ├── products[]    { name, description, price, features, emoji, imageQuery }
│   ├── stats[]       { value, label }
│   ├── testimonials[]{ name, role, review, rating }
│   ├── about         { title, body, values[] }
│   ├── faq[]         { question, answer }
│   └── seo           { title, description, keywords }
│
├── shopifyStoreUrl   string           (mystore.myshopify.com)
└── shopifyProducts[] { id, handle, title, variantId }
                       └── variantId used in cart permalink

---

Key Design Decisions

DecisionWhy
SSE instead of WebSocketsWorks with Vercel's streaming response model; no persistent connection needed
Single AI call with structured tool outputForces a valid typed config — no free-form text to parse, no partial failures
Shopify as the commerce layerReal inventory, real payments, real checkout; Amboras only handles storefront + AI
File storage locally, Redis in productionZero infrastructure for development; same interface both ways
Client-side cart stateAvoids a cart DB entirely — Shopify checkout is built from variant IDs at checkout time