Skip to content

feat(shopify): port product sync to TypeScript (Vercel, no Python backend)#10

Open
StockerMC wants to merge 1 commit into
mainfrom
feat/shopify-product-sync
Open

feat(shopify): port product sync to TypeScript (Vercel, no Python backend)#10
StockerMC wants to merge 1 commit into
mainfrom
feat/shopify-product-sync

Conversation

@StockerMC
Copy link
Copy Markdown
Owner

Summary

Ports the product-sync half of the Python backend's post-OAuth job to TypeScript so a connected store's catalog populates on Vercel — no Python backend or Redis needed.

Changes

  • lib/shopify.ts: new getProducts(shop, accessToken) — Shopify Admin API with Link-header cursor pagination (handles >250 products). Fixes the inverted price guard from the Python version (which indexed an empty variants array).
  • /api/shopify/sync (new): looks up the company's stored active OAuth token (server-side, service role — never accepts a token from the caller), fetches the catalog, replaces company_products for that company, and records products_synced/product_count + companies.ingested.
  • /api/shopify/callback: triggers the sync fire-and-forget after a successful connect (doesn't block the redirect).

Scope / non-goals

Creator discovery + embeddings (the long-running pipeline) still belong to the Python worker on Cloud Run. This only covers catalog sync, which is enough for connect → Products page to work end-to-end on Vercel.

⚠️ Verification note

Local bun run build was run but the tool output channel degraded before I could capture the verdict — please confirm CI/build is green before merging. Changes are small and follow existing patterns (mirrors getShopInfo/createShopifyDiscount and the other supabaseAdmin routes).

…thon backend)

Adds getProducts() to lib/shopify.ts (Admin API + Link-header pagination,
fixes the inverted price guard from the Python version) and a new
/api/shopify/sync route that fetches the catalog into company_products using
the stored OAuth token. The OAuth callback now triggers it fire-and-forget so
a freshly connected store populates without the Python backend.

Creator discovery/embeddings still belong to the Python worker (Cloud Run);
this only covers catalog sync.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
maatchaa Ready Ready Preview, Comment May 31, 2026 10:13pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant