β οΈ Critical Timeline: Shopify sunsets Thank-You/Order-Status scripts for Plus merchants on August 28, 2025 and non-Plus on August 26, 2026ΒΉ.
A comprehensive solution for migrating tracking pixels from legacy Shopify Thank You/Order Status pages to the modern Customer Events API and Checkout UI Extensions. This Windows-safe monorepo achieves 100% automation rate for major advertising platforms.
Agencies charge $1.3kβ$2.5k for manual migrations while tracking apps cost $10β$150/monthΒ². Our automated solution provides instant migration at a fraction of the cost.
# Automated setup for new developers
pnpm setup:devThis will:
- Check Node.js version (β₯22 required)
- Install dependencies
- Set up development environment
- Create necessary directories
- Provide next steps
# Install dependencies
pnpm install
# Copy development environment config
cp .env.development .env
# Run migration scan on fixtures
pnpm migrate:scan
# Generate migrated pixel code
pnpm migrate:emit
# Run critical path tests
pnpm test:critical
# Start development server
pnpm dev:api # API server (port 3001)
pnpm dev:landing # Landing page (port 3000)- 8 Major Platforms Supported: Google Ads, GA4, Meta Pixel, TikTok, Pinterest, Snap, Klaviyo, Bing UET
- 100% Automation Rate: Fully automated conversion from legacy tracking to Customer Events API
- Server-Side Deduplication: Unique event IDs prevent duplicate conversion reporting
- Dynamic Configuration: Merchant-specific conversion IDs via
vendor-config.json
- Shopify OAuth 2.0: Secure merchant authentication with Admin API access
- Consent Mode v2: Full compliance with Google's consent requirementsΒ³
- OAuth Authentication: Google SSO integration for improved conversion (20-40% boost)
- SQLite Database: Scalable storage with automatic migration from JSON
- WCAG Accessibility: Full compliance with modern accessibility standards
- Security Hardened: HMAC validation, CSRF protection, input validation, encrypted tokens
- Production Ready: Docker containers, Fly.io deployment, Prometheus metrics
- Monitoring: Pino logging, Sentry integration, health checks
- Backup System: Automated SQLite backups with Litestream to S3/B2
- Session Management: Redis-backed sessions with 24-hour TTL
- Claude Code Ready: Optimized for AI-assisted development
- Comprehensive Testing: E2E tests with Playwright, QA harness for validation
- Modular Architecture: pnpm workspaces with clear separation of concerns
- Windows Compatible: No special characters in filenames
shopify-tyos-migrator/
βββ apps/ # Application servers
β βββ api/ # Production API with metrics & monitoring
β βββ landing/ # Sign-up page with OAuth & SQLite
βββ extensions/ # Shopify extensions
β βββ thank-you-ui/ # Checkout UI extension template
β βββ web-pixel/ # Customer Events pixel implementations
βββ packages/ # Shared packages
β βββ consent/ # Consent management utilities
β βββ e2e/ # Playwright end-to-end tests
β βββ migrator/ # CLI tool for code migration
β βββ patterns/ # Pattern matching utilities
β βββ qa-harness/ # QA testing framework
β βββ reporting/ # Analytics and reporting tools
βββ fixtures/ # Sample tracking code for testing
Need help testing? See the Testing Guide for step-by-step instructions.
- Manual Testing:
docs/test-plans/manual-test-checklist.md- 130-point checklist - Quick Start: Focus on P0 tests (OAuth, Detection, Migration, Consent Mode)
- Report Issues: Use
gh issue create --label bug
# Prerequisites: Node.js >=22.0.0, pnpm
# Install dependencies (also sets up Git hooks)
pnpm i
pnpm --filter @pkg/e2e exec playwright install chromium
# Run migration workflow
pnpm migrate:scan # Analyze tracking code in fixtures/
pnpm migrate:emit # Generate Customer Events API code
# Run tests
pnpm test # Run QA harness
pnpm e2e # Run Playwright E2E tests
# Start services
pnpm dev:landing # Start sign-up page (port 3000)
pnpm dev:api # Start API server (port 3001)
pnpm dev # Start API server (default)This project uses Git hooks for quality assurance instead of CI/CD:
- Pre-commit: Runs tests, linting, and security checks automatically
- Pre-push: Comprehensive validation before pushing to remote
- No external CI/CD dependencies - everything runs locally
See Local Development Guide for details.
Create vendor-config.json from the sample:
cp vendor-config.sample.json vendor-config.jsonEdit with your actual vendor IDs. See docs/VENDOR_SETUP.md for detailed instructions on where to find each vendor's IDs and how to configure them via environment variables.
Create .env in apps/landing/:
cp apps/landing/.env.example apps/landing/.envConfigure Google OAuth:
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-secret
SESSION_SECRET=change-this-in-production
ADMIN_API_KEY=secure-api-key-for-admin-endpointsThe landing page uses SQLite by default. Data is stored in apps/landing/signups.db.
- Automatic migration from existing
signups.jsonfiles - Prepared statements prevent SQL injection
- Indexes on email and timestamp for performance
The API server uses Redis caching for improved performance with graceful fallback if unavailable.
- Provider: Upstash Redis (serverless, TLS-encrypted)
- Free Tier: 500K commands/month, 256MB storage
- Health Monitoring: Available at
/healthzendpoint
For detailed setup instructions and configuration options, see docs/REDIS_SETUP.md.
| Variable | Description | Default | Required |
|---|---|---|---|
API_PORT |
API server port | 3001 |
No |
NODE_ENV |
Environment (development/production) | development |
No |
DATABASE_URL |
SQLite database path | ./data/api.db |
No |
ALLOWED_ORIGINS |
CORS allowed origins (comma-separated) | * in dev |
Yes in prod |
REDIS_URL |
Redis connection URL | - | No |
SESSION_SECRET |
Session encryption key | - | Yes |
LOG_LEVEL |
Logging level (error/warn/info/debug) | info |
No |
SENTRY_DSN |
Sentry error tracking DSN | - | No |
| Variable | Description | Default | Required |
|---|---|---|---|
PORT |
Server port | 3000 |
No |
NODE_ENV |
Environment (development/production) | development |
No |
ALLOWED_ORIGINS |
CORS allowed origins (comma-separated) | - | Yes in prod |
GOOGLE_CLIENT_ID |
Google OAuth client ID | - | Yes |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret | - | Yes |
SESSION_SECRET |
Session encryption key | - | Yes |
DATABASE_PATH |
SQLite database path | ./data/signups.db |
No |
ADMIN_API_KEY |
Admin API authentication key | - | Recommended |
When deploying to production (e.g., Fly.io), ensure these are set:
NODE_ENV=productionALLOWED_ORIGINSwith your actual domains- Strong
SESSION_SECRETvalues (useopenssl rand -hex 32) REDIS_URLfor distributed caching (Upstash Redis configured)SENTRY_DSNfor error tracking (optional but recommended)
Fly.io CLI Setup:
# Setup Fly.io CLI path (if not in PATH)
./scripts/setup-fly-path.sh
# Or use full path directly:
/home/bryce/.fly/bin/fly status --app tyos-migrator-api
/home/bryce/.fly/bin/fly secrets list --app tyos-migrator-api| Command | Description |
|---|---|
pnpm dev:api |
Start API server |
pnpm dev:landing |
Start sign-up page with OAuth |
pnpm migrate:scan |
Scan fixtures for tracking patterns |
pnpm migrate:emit |
Generate migrated pixel code |
pnpm test |
Run QA harness tests |
pnpm e2e |
Run all Playwright E2E tests |
pnpm report |
Generate migration reports |
The project includes comprehensive testing:
# Unit/Integration Tests
pnpm test # QA harness - validates migration parity
# E2E Tests
pnpm e2e # All E2E tests
pnpm --filter @pkg/e2e test deduplication.spec.js # Specific test file
# Manual Testing
pnpm dev:landing # Test sign-up flow at http://localhost:3000
curl http://localhost:3000/api/admin/stats # Check statistics (dev mode)Pull requests automatically capture screenshots of your changes for visual review:
- Automatic PR Screenshots: Every PR builds and runs your code locally, capturing screenshots
- Visual Comparison: Compare PR changes against production site
- Embedded in PR Comments: Screenshots appear directly in PR comments (small images embedded, large images linked)
- Production-like Environment: Services run with production configuration for accurate testing
The visual validation workflow triggers on PRs that modify frontend code and posts results as a sticky comment.
- Automatic: Opens a PR β workflow runs β screenshots posted
- Manual Trigger: Run workflow manually from Actions tab
- Local Testing:
# Test screenshot capture with custom URLs LANDING_URL=http://localhost:3000 \ API_URL=http://localhost:3001 \ node scripts/capture-screenshots.js
- Input Validation: Comprehensive sanitization of all user inputs
- CSRF Protection: State parameter validation in OAuth flow
- SQL Injection Prevention: Prepared statements in SQLite
- Authentication: OAuth 2.0 with Google, API key for admin endpoints
- Secure Sessions: HTTPOnly cookies, secure flag in production
- Content Security: XSS protection through proper encoding
-
Scan Phase: Analyzes tracking code in
fixtures/directorypnpm migrate:scan # Output: packages/migrator/out/scan.json -
Configuration: Set up vendor IDs in
vendor-config.json -
Emit Phase: Generates Customer Events API code
pnpm migrate:emit # Output: extensions/web-pixel/src/generated/*.js -
Validation: Run QA harness to verify parity
pnpm test # Expected: 100% parity between baseline and migrated
| Vendor | Type | Consent Gating | Deduplication |
|---|---|---|---|
| Google Ads | Advertising | β | β |
| GA4 | Analytics | β | β |
| Meta Pixel | Advertising | β | β |
| TikTok | Advertising | β | β |
| Advertising | β | β | |
| Snap | Advertising | β | β |
| Klaviyo | Analytics | β | β |
| Bing UET | Advertising | β | β |
- Automation Rate: 100% (target: 50%)
- Vendor Coverage: 8 major platforms
- Conversion Boost: +20-40% with OAuth implementation
- Test Coverage: Comprehensive E2E and unit tests
- Accessibility: WCAG 2.1 Level AA compliant
β οΈ Important: Always run pre-deployment checks before deploying to production. See DEPLOYMENT-CHECKLIST.md for details.
Run the automated safety check before deploying:
./scripts/pre-deploy-check.shThis validates:
- CSP configuration (prevents broken styles/scripts)
- Security tests pass
- No hardcoded secrets
- Docker builds succeed
- Critical page elements exist
See CSP-CONFIGURATION.md for Content Security Policy details.
Both API and Landing services include production-ready Dockerfiles:
# Build images
docker build -f apps/api/Dockerfile -t tyos-api .
docker build -f apps/landing/Dockerfile -t tyos-landing .
# Run containers
docker run -p 3001:3001 tyos-api
docker run -p 3000:3000 tyos-landingDeploy to Fly.io with included configurations:
# Prerequisites
fly auth login # or use FLY_API_TOKEN env variable
# Deploy from monorepo root
fly deploy --app tyos-migrator-api --config apps/api/fly.toml --dockerfile apps/api/Dockerfile
fly deploy --app tyos-migrator-landing --config apps/landing/fly.toml --dockerfile apps/landing/DockerfileLive Deployments:
Automated backup with Litestream to S3/B2:
- Continuous replication (60s sync interval)
- Daily snapshots
- 7-day retention
- Nightly verification with
scripts/backup-verify.js
- Health Checks:
/healthzendpoints on both services - Metrics: Prometheus metrics at
/metrics - Logging: Structured logging with Pino
- Error Tracking: Optional Sentry integration
- Alerts: Slack webhook notifications for backup failures
- Pilot Onboarding Guide - Complete step-by-step onboarding for pilot merchants
- Onboarding Checklist - Printable checklist for migration tracking
- Merchant Runbook - Quick reference guide and best practices
- Troubleshooting Guide - Common issues and solutions
- CLAUDE.md - AI assistant guidance
- IMPLEMENTATION_SUMMARY.md - Feature details
- docs/SHOPIFY-SCRIPTS-TESTING.md - Script Tags and Web Pixels testing guide
- docs/LOCAL-DEVELOPMENT.md - Local development workflow and hooks
- docs/MIGRATOR_RULES.md - Vendor rule specifications
- docs/MIGRATION_CODE_EXAMPLES.md - Before/after migration code patterns
- docs/E2E.md - E2E testing guide
- Documentation Index - Complete guide to all documentation
This project uses pnpm workspaces and follows conventional commits. Please ensure all tests pass before submitting PRs.
MIT License - See LICENSE file for details
ΒΉ Shopify Checkout Liquid sunset dates - Plus: August 28, 2025; Non-Plus: August 26, 2026 (Source: Opportunity Radar)
Β² Agency and app pricing data from market research (Source: Assumption Validation Report)
Β³ Google Consent Mode v2 requirements and implementation (Source: Opportunity Radar)
β΄ Migration from order.* to checkout.* variables required (Source: Shopify documentation)