Chapter 22: Phase 2 - Full Product

Goal

Complete the feature set required for the Growth tier ($79/mo). Phase 2 transforms the basic Phase 1 app into a product that merchants can configure, customize, and rely on without manual intervention. By the end of Phase 2, AdPriority supports seasonal automation, a configurable rules engine, bulk operations, a dashboard with analytics, and reliable error handling.

Timeline: 3-4 weeks


Feature Set

Seasonal Automation

The seasonal automation system is the primary differentiator between the Starter and Growth tiers. It automatically adjusts product priorities when the calendar crosses a season boundary.

Components:

ComponentDescriptionImplementation
Season definitionsStart/end dates for each seasonseasons table, configurable per store
Category-season matrixPriority for each category group in each seasonseason_rules table
Transition schedulerCron job that detects boundary crossingsBull queue, runs hourly
Transition previewShows what will change before it happensAPI endpoint computing diff
Transition executionRecalculates all affected productsBatch update with audit trail
Transition notificationEmail alert when a transition occursNotification service

Transition process:

SEASONAL TRANSITION
===================

  Hourly cron job checks:
    Is today's date in a different season than yesterday?
         |
    NO --+--> No action
         |
    YES -+--> Begin transition
              |
              v
         1. Log transition event
              |
              v
         2. Fetch all products for this store
              |
              v
         3. For each product (not manually locked):
            a. Look up new seasonal priority
            b. Compare with current priority
            c. If different: update, log change
              |
              v
         4. Queue Google Sheet sync
              |
              v
         5. Send notification email
              |
              v
         6. Log completion to sync_logs

Transition safeguards:

  • Manually locked products are never changed
  • A dry-run mode previews changes without applying them
  • Transitions log every individual product change to audit_logs
  • A rollback option reverts the transition within 24 hours

Configurable Rules Engine

Phase 1 delivers hardcoded category rules based on the Nexus Clothing mapping. Phase 2 replaces these with a merchant-configurable rules engine accessible through the UI.

Rule types:

TypeDescriptionExample
Category ruleMatch product type to base priority*Puffer Jackets* -> Priority 5
Tag modifierAdjust priority based on product tagsNAME BRAND -> +1
Vendor ruleSet priority by vendorNew Era -> Priority 4
Collection rulePriority for products in a collection“Holiday Sale” collection -> Priority 5
Time-limited ruleRule active only during a date rangeFeb 1-14: Valentine’s items Priority 5

Rule builder UI:

The rule builder uses Polaris form components within a modal or dedicated page:

CREATE RULE
===========

  Name:        [Holiday Valentine Boost_______]
  Description: [Boost Valentine's products____]

  Conditions (ALL must match):
  +------------------------------------------+
  | Field         | Operator   | Value        |
  |---------------|------------|--------------|
  | tag           | contains   | valentine25  |
  | product_type  | starts_with| Men-Tops     |
  +------------------------------------------+
  [+ Add Condition]

  Priority:    [5 - Push Hard v]

  Schedule:
  ( ) Always active
  (*) Date range: [Feb 1] to [Feb 14]

  [Cancel]  [Preview (47 match)]  [Save]

Rule evaluation:

  • Rules are evaluated in the order specified by the merchant (drag-to-reorder)
  • The first matching rule wins (no cascading)
  • Tag modifiers are applied after the winning rule
  • Manual overrides always take precedence

Bulk Operations

Bulk operations allow merchants to act on many products at once from the Products list screen.

OperationDescriptionImplementation
Set priorityApply a specific priority to selected productsBatch update with reason
RecalculateRe-run scoring engine for selected productsQueue job per batch
Lock/UnlockSet or remove manual override for selected productsToggle priority_locked
ExportDownload selected products as CSVServer-side generation

Bulk operation flow:

BULK OPERATION
==============

  1. Merchant selects products (checkboxes in IndexTable)
         |
         v
  2. Clicks bulk action button (e.g., "Set Priority")
         |
         v
  3. Modal opens: select priority, enter reason
         |
         v
  4. Confirmation: "Update 47 products to Priority 5?"
         |
         v
  5. POST /api/products/bulk-update
     { productIds: [...], priority: 5, reason: "Holiday promo" }
         |
         v
  6. Backend processes in transaction:
     a. Update products table
     b. Write audit_logs entries
     c. Set needs_sync = true
         |
         v
  7. Queue Sheet sync job
         |
         v
  8. Return result: { updated: 47, errors: 0 }
         |
         v
  9. UI refreshes product list, shows success toast

For large selections (500+ products), the operation runs as a background job with a progress indicator rather than a blocking API call.

Dashboard Analytics

Phase 2 delivers the full dashboard described in Chapter 17, covering:

  • Priority distribution pie chart
  • Sync status indicators
  • Quick stats (total products, needs attention, new arrivals)
  • Activity feed (recent changes, syncs, errors)
  • Seasonal transition countdown

The Pro tier analytics (ROAS by priority, Google Ads performance) remain deferred to Phase 3.

Category Management UI

A dedicated screen for managing category groups, replacing the hardcoded JSON configuration from Phase 1.

Features:

  • List all category groups with member product types
  • Add, edit, and delete category groups
  • Assign product types to groups (autocomplete from the store’s actual types)
  • Set default priority per group
  • Visual indicator of ungrouped product types (types that exist in the catalog but do not belong to any group)

Sync Monitoring

An operational view showing the health and history of Google Sheet synchronization.

Components:

ComponentDescription
Sync history tableLast 50 syncs with status, timestamp, product counts
Error detail viewExpandable rows showing specific errors per sync
Manual sync buttonTrigger an immediate full sync
Sync settingsFrequency, auto-sync toggles

Error Handling

Phase 2 hardens error handling across all integration points.

Error CategoryHandling Strategy
Shopify API rate limitExponential backoff, retry up to 3 times, queue for later
Shopify webhook delivery failureShopify retries automatically (19 attempts over 48 hours)
Google Sheets API quotaQueue writes, batch updates, alert merchant if daily quota exceeded
Google Sheets write failureRetry 3 times, log error, surface in sync status
Database connection lossAuto-reconnect via Prisma connection pool, surface error in health check
Invalid product dataSkip product, log warning, continue processing batch
Season transition failureRoll back partial changes, alert via email, retry on next hour

Beta Testing

Beta Program

Phase 2 concludes with a beta program: 5 merchants test the app in a real-world setting.

Beta merchant criteria:

CriterionMinimum
Shopify storeActive, with Google Ads running
Product count100-10,000 products
Google Ads spend$500+/month
Product typesAt least 5 different types
Seasonal variationCatalog with seasonal demand patterns

Beta recruitment:

  • Approach through Shopify merchant communities
  • Offer free Growth tier access for 60 days
  • Require weekly feedback survey completion
  • Collect quantitative data (ROAS before/after)

Beta Feedback Areas

AreaQuestions
OnboardingHow long did setup take? What was confusing?
Priority accuracyDo the automated scores make sense for your catalog?
Rules engineWere you able to configure rules for your categories?
Seasonal calendarDo the season boundaries match your business?
Sync reliabilityDid all products sync correctly to GMC?
Missing featuresWhat do you need that is not available?
PricingWould you pay $79/mo for this? What price feels right?

Iteration Based on Feedback

Allow 1 week between beta start and App Store submission for iteration. Common adjustments based on beta feedback:

Feedback PatternLikely Response
“Setup was confusing”Add onboarding wizard with step-by-step guide
“Wrong priorities for my catalog”Improve default rules, add more templates
“My categories don’t match”Allow custom grouping, not just product type matching
“Sync failed for some products”Improve error messaging, add retry UI
“I need X feature”Evaluate for Phase 3 or Growth tier scope

Timeline

PHASE 2 TIMELINE
================

  Week 1:
    - Seasonal automation engine (backend)
    - Season transition scheduler
    - Season calendar UI

  Week 2:
    - Rules engine (backend CRUD + evaluation)
    - Rule builder UI
    - Category management UI

  Week 3:
    - Bulk operations (backend + UI)
    - Dashboard (distribution chart, sync status, stats, activity)
    - Sync monitoring UI
    - Error handling hardening

  Week 4:
    - Beta merchant onboarding (5 stores)
    - Bug fixes based on beta feedback
    - Performance optimization
    - Documentation for beta merchants

Deliverables

DeliverableAcceptance Criteria
Seasonal automationTransitions execute automatically, preview accurate, rollback works
Rules engineMerchants create/edit/delete rules, rules evaluate correctly
Bulk operationsSelect and update 500+ products without timeout
DashboardDistribution chart, sync status, stats, activity feed all populated
Category managementAll store product types assignable to groups
Sync monitoringHistory viewable, errors surfaced, manual sync works
Error handlingNo unhandled exceptions, all errors logged with context
Beta program5 merchants installed, using app for 1+ week, feedback collected