Skip to content

Current State Analysis

The codebase has three package.json files (root + client + docs) but does not use npm/pnpm workspaces — effectively a monolith with a nested frontend package and a separate documentation site:

bluntdashboard/
├── client/ # React 18 + Vite + shadcn/ui (own package.json)
├── server/ # Express.js API
│ ├── routes/ # 9 route modules
│ ├── services/ # shopify-sync, asset-ingest
│ └── lib/ # supabase client
├── shared/ # Drizzle schema (users, orders, integrations, notifications — types only)
├── supabase/
│ ├── migrations/ # 34 SQL migrations
│ └── functions/ # 6 Deno Edge Functions
├── scripts/ # 8 backfill, diagnostic, and repair utilities
└── docs/ # this site
LayerTechnologyNotes
FrontendReact 18.3, Vite 5.4, Wouter, React Query 5, shadcn/ui, RechartsStandard modern React stack
BackendExpress 4.21, TypeScript, tsxRuns on port 5000
ORMDrizzle 0.39 (Postgres dialect)Schema defines types for in-memory Map; not used for DB queries (Supabase client used directly)
DatabaseSupabase PostgreSQLReal data lives here, accessed via Supabase client SDK
AuthPassport.js (backend) + Supabase Auth (frontend)Two incompatible systems
StorageCloudflare R2 via @aws-sdk/client-s3S3-compatible API with credentials
Edge Functions6 Deno functions on Supabaseshopify sync, tag sync, CSV gen, asset ingest, order lookup, repair
DeploymentVercel (frontend) + Replit (dev server)vercel.json builds client only

The platform serves 4 operational teams (Ops, Creative, Fulfillment, Design) with 10 dashboard pages:

FeatureRoutePrimary data source
Performance tracking/performance-trackingmart.performance_metrics (materialized view)
Tag analytics/performance-tracking/tag-analyticsmart.tag_performance_aggregate (materialized view)
Tag manager/performance-tracking/tag-managertag_classifications, RPCs
Designer management(tab within tag manager)designer_assignments
Combo logs/combo-logscombo_logs table
Combo templates/combo-templatescombo_templates table
Combo suggestions/combo-suggestionscombo_suggestions table
Product assets/product-assetsassets, product_asset_mappings
CSV generator/csv-generatorShopify API + product_assets
Fulfillment monitoring/fulfillment-monitoringfulfillment_daily_summary view
Home/Summary dashboard

Three migration eras define the schema:

  1. Ad performance tables (Dec 2024) — performance_metrics, classification_settings, combo_logs, combo_suggestions
  2. Warehouse schemas (Dec 2024) — raw.shopify_orders, raw.shopify_line_items, core.dim_products, core.fact_sales_daily
  3. Asset redundancy (Jan 2025) — assets (with SHA-256 checksum), product_asset_mappings

See Schema Design for the full target schema.

The system uses ~17 distinct environment variable names across 4 services (some are aliased with VITE_/NEXT_PUBLIC_ prefixes for frontend access):

ServiceVariables
SupabaseVITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY
ShopifySHOPIFY_STORE_DOMAIN, SHOPIFY_ACCESS_TOKEN / SHOPIFY_ADMIN_ACCESS_TOKEN, SHOPIFY_CLIENT_ID, SHOPIFY_CLIENT_SECRET
Cloudflare R2CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_R2_ACCESS_KEY_ID, CLOUDFLARE_R2_SECRET_ACCESS_KEY, CLOUDFLARE_R2_BUCKET_NAME, CLOUDFLARE_R2_PUBLIC_URL
SessionSESSION_SECRET

In the target architecture, most of these become Wrangler secrets and bindings.