metatroncubeswdev 0303eba07a feat: scaffold Phase 0 — Remix app template, CI, Redis/BullMQ, test harness
Bootstraps from Shopify's official shopify-app-template-remix (cloned
directly rather than via `shopify app init`, which requires an interactive
Partner login unavailable in this session):

- Prisma (SQLite dev / Postgres-ready) with baseline Session model + migration
- Vitest configured for unit tests, Playwright configured for E2E
- Redis client + BullMQ worker skeleton (app/lib/redis.server.ts, jobs/worker.ts)
- shopify.app.toml: minimal scopes, GDPR + orders webhooks wired (stub handlers),
  app proxy config for the future storefront widget
- Stripped template-repo-only meta files (CLA, issue templates, demo product
  page) and replaced CI with a lint+typecheck+test workflow
- Bumped @shopify/shopify-app-session-storage-prisma to resolve a duplicate
  @shopify/shopify-api install that broke typecheck
- Dropped the Jest-only ESLint config (template default) since the project
  standardizes on Vitest per IMPLEMENTATION_PLAN.md

Verified: npm install, lint, typecheck, unit tests, prisma migrate dev, and
npm run build all pass on Node 22 LTS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 15:45:28 -04:00

28 lines
979 B
TypeScript

import { Worker } from "bullmq";
import { Redis } from "ioredis";
// BullMQ needs its own connection (can't share one used for pub/sub or with
// maxRetriesPerRequest set to a finite value in some modes) — kept separate
// from app/lib/redis.server.ts for that reason.
const connection = new Redis(process.env.REDIS_URL || "redis://127.0.0.1:6379", {
maxRetriesPerRequest: null,
});
// TODO (Phase 4): hold-expiry — release a SlotHold whose TTL has passed.
// TODO (Phase 9): notifications — send queued reminder/ETA messages.
// TODO (Phase 5+): capacity-recompute — recalculate denormalized capacity
// snapshots after config changes.
const holdExpiryWorker = new Worker(
"hold-expiry",
async (job) => {
console.log("Processing hold-expiry job", job.id, job.data);
},
{ connection },
);
holdExpiryWorker.on("failed", (job, err) => {
console.error(`hold-expiry job ${job?.id} failed:`, err);
});
console.log("Worker started, listening for jobs...");