Skip to content

Introduction

BluntDashboard is an internal operations platform for Blunt Cases — a phone-case brand that manages product performance tracking, creative ad testing (combos), asset redundancy pipelines, supplier CSV automation, and Shopify data analytics.

The current system has accumulated enough technical debt that incremental fixes are no longer cost-effective. The three critical issues are:

  1. Dual storage with volatile auth — Real business data (performance metrics, combos, tags, assets) is persisted in Supabase, but the Express server uses an in-memory Map<number, T> for auth users, sample orders, integrations, and notifications. Auth state is lost on restart. The Drizzle schema in shared/schema.ts defines tables that are never connected to a database — it’s used only for TypeScript types.

  2. Security gaps — A hardcoded password bypass (admin123) exists in server/auth.ts. Over 40 API endpoints (performance metrics, combo logs, tag classifications, designers, tag analytics, asset ingest) have zero authentication middleware. Two incompatible auth systems (Passport.js sessions + Supabase JWT) create a split-brain identity model where neither can verify the other’s tokens.

  3. Operational fragility — Shopify data sync runs only when manually triggered via a UI button — there is no cron scheduling. Six Supabase Edge Functions duplicate Shopify client logic across isolated Deno runtimes with no shared configuration (three near-identical shopifyRest() helpers plus three inline fetch() calls). Note: the system does have run tracking (raw.ingest_runs table) and idempotency via ON CONFLICT upserts and SHA-256 checksum deduplication — but these are implemented inconsistently and only in some code paths.

The rewrite preserves what works:

CurrentTarget
Express.js on Vercel/ReplitCloudflare Workers (Hono)
Supabase PostgreSQLPlanetScale PostgreSQL via Hyperdrive
Supabase Auth + Passport.jsCloudflare Access (Google SSO)
Supabase Edge FunctionsCF Workers + Queues + Cron
Supabase StorageCloudflare R2 (native bindings)
@aws-sdk/client-s3R2 Worker binding API
Manual sync triggersScheduled Cron Triggers
Drizzle + Postgres dialect (Supabase)Drizzle + Postgres dialect (PlanetScale)
Ad-hoc naming conventionsOntology-first naming grounded in BFO/IAO/CCO/IOF/PKO

This specification is organized using viewpoints adapted from the Arcadia method, with an Ontological Foundation that grounds every entity, relation, and process in formal categories: