Current State Analysis
Repository structure
Section titled “Repository structure”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 siteTechnology stack
Section titled “Technology stack”| Layer | Technology | Notes |
|---|---|---|
| Frontend | React 18.3, Vite 5.4, Wouter, React Query 5, shadcn/ui, Recharts | Standard modern React stack |
| Backend | Express 4.21, TypeScript, tsx | Runs on port 5000 |
| ORM | Drizzle 0.39 (Postgres dialect) | Schema defines types for in-memory Map; not used for DB queries (Supabase client used directly) |
| Database | Supabase PostgreSQL | Real data lives here, accessed via Supabase client SDK |
| Auth | Passport.js (backend) + Supabase Auth (frontend) | Two incompatible systems |
| Storage | Cloudflare R2 via @aws-sdk/client-s3 | S3-compatible API with credentials |
| Edge Functions | 6 Deno functions on Supabase | shopify sync, tag sync, CSV gen, asset ingest, order lookup, repair |
| Deployment | Vercel (frontend) + Replit (dev server) | vercel.json builds client only |
Feature surface
Section titled “Feature surface”The platform serves 4 operational teams (Ops, Creative, Fulfillment, Design) with 10 dashboard pages:
| Feature | Route | Primary data source |
|---|---|---|
| Performance tracking | /performance-tracking | mart.performance_metrics (materialized view) |
| Tag analytics | /performance-tracking/tag-analytics | mart.tag_performance_aggregate (materialized view) |
| Tag manager | /performance-tracking/tag-manager | tag_classifications, RPCs |
| Designer management | (tab within tag manager) | designer_assignments |
| Combo logs | /combo-logs | combo_logs table |
| Combo templates | /combo-templates | combo_templates table |
| Combo suggestions | /combo-suggestions | combo_suggestions table |
| Product assets | /product-assets | assets, product_asset_mappings |
| CSV generator | /csv-generator | Shopify API + product_assets |
| Fulfillment monitoring | /fulfillment-monitoring | fulfillment_daily_summary view |
| Home | / | Summary dashboard |
Database schema
Section titled “Database schema”Three migration eras define the schema:
- Ad performance tables (Dec 2024) —
performance_metrics,classification_settings,combo_logs,combo_suggestions - Warehouse schemas (Dec 2024) —
raw.shopify_orders,raw.shopify_line_items,core.dim_products,core.fact_sales_daily - Asset redundancy (Jan 2025) —
assets(with SHA-256 checksum),product_asset_mappings
See Schema Design for the full target schema.
Environment variables
Section titled “Environment variables”The system uses ~17 distinct environment variable names across 4 services (some are aliased with VITE_/NEXT_PUBLIC_ prefixes for frontend access):
| Service | Variables |
|---|---|
| Supabase | VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY |
| Shopify | SHOPIFY_STORE_DOMAIN, SHOPIFY_ACCESS_TOKEN / SHOPIFY_ADMIN_ACCESS_TOKEN, SHOPIFY_CLIENT_ID, SHOPIFY_CLIENT_SECRET |
| Cloudflare R2 | CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_R2_ACCESS_KEY_ID, CLOUDFLARE_R2_SECRET_ACCESS_KEY, CLOUDFLARE_R2_BUCKET_NAME, CLOUDFLARE_R2_PUBLIC_URL |
| Session | SESSION_SECRET |
In the target architecture, most of these become Wrangler secrets and bindings.