ARCHITECTURE
Markdown file
docs/ARCHITECTURE.md
Architecture
High-level overview of how the system fits together.
Components
- Remix app (
app/)- Embedded Shopify admin UI (Polaris/App Bridge)
- API routes / webhooks
- Auth and session storage via Prisma
- Worker (
worker/)- Background job processing (BullMQ + Redis)
- AI analysis/generation work that shouldn’t block web requests
- Database (Postgres via Prisma)
- Stores shops, products, suggestions, audit logs, automation settings
- Stores billing state + metered usage events
- Staging recommendation: Neon Postgres (usage-based)
- Queue / cache (Redis)
- BullMQ backing store
- Staging recommendation: Upstash Redis (usage-based)
- Hosting
- Render runs the web and worker processes from
render.yaml
Data flow (typical)
- Merchant installs app → auth flow completes → shop record upserted (token persisted).
- App triggers analysis/generation work → worker jobs run.
- Results are stored (suggestions/audit trail) and optionally applied to Shopify.
- Usage events are recorded in DB and (when wired) reported to Shopify usage billing.
Billing (in progress)
- Plan is defined as a line-item billing plan in
app/shopify.server.ts(recurring + usage cap). - Billing state is synced into DB via
app/lib/billing.server.ts.