Quality Studio Demo Deployment - Phased Approach
This document outlines the phased approach for deploying a demo version of the Baselinr Quality Studio to Cloudflare Pages with mock data mode.
Overview
The demo will be a fully functional version of the Quality Studio that runs entirely on Cloudflare Pages using pre-generated mock data. This approach eliminates the need for a database backend while providing a realistic demonstration of all Quality Studio features.
Demo URL: https://demo.baselinr.io (or your chosen subdomain)
Goals
- ✅ Zero-cost hosting (Cloudflare Pages free tier)
- ✅ Fast load times (static assets + edge functions)
- ✅ Realistic demo data showcasing all features
- ✅ No database dependencies
- ✅ Easy to maintain and update
Architecture
┌─────────────────────────────────────────────────────────┐
│ Cloudflare Pages (Frontend) │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Next.js Static Export + Pages Functions │ │
│ │ - Static HTML/CSS/JS assets │ │
│ │ - API routes as Cloudflare Pages Functions │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Cloudflare Pages Functions (Backend) │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Demo Data Service │ │
│ │ - Serves pre-generated JSON data │ │
│ │ - Filters/sorts data in-memory │ │
│ │ - No database queries │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Pre-generated Demo Data (JSON) │
│ - runs.json (100+ profiling runs) │
│ - metrics.json (column-level metrics) │
│ - drift_events.json (drift detection events) │
│ - tables.json (table metadata) │
│ - validation_results.json (validation outcomes) │
│ - lineage.json (lineage relationships) │
└─────────────────────────────────────────────────────────┘
Phase 1: Demo Data Generation & Export
Goal: Create a script that generates realistic demo data and exports it to JSON files.
Tasks
-
Create demo data generator script
- Location:
baselinr/dashboard/backend/generate_demo_data.py - Extend existing
sample_data_generator.pyto export to JSON - Generate comprehensive dataset:
- 100+ profiling runs across multiple warehouses
- Column-level metrics for all runs
- 30+ drift events with varying severity
- Table metadata and relationships
- Validation results (pass/fail)
- Lineage relationships (if applicable)
- Location:
-
Create demo data directory structure
dashboard/backend/demo_data/
├── runs.json
├── metrics.json
├── drift_events.json
├── tables.json
├── validation_results.json
├── lineage.json
└── metadata.json (generation timestamp, version, etc.) -
Data requirements
- Runs: Mix of successful, failed, and in-progress runs
- Metrics: Realistic distributions (null rates, distinct counts, etc.)
- Drift Events: Mix of low/medium/high severity
- Tables: Multiple schemas and warehouses
- Time Range: Data spanning last 30-60 days
Deliverables
- ✅
generate_demo_data.pyscript - ✅
demo_data/directory with JSON files - ✅ Documentation on data structure
Estimated Time: 4-6 hours
Phase 2: Demo Data Service Implementation
Goal: Create a service that loads and serves demo data with filtering/sorting capabilities.
Tasks
-
Create DemoDataService class
- Location:
baselinr/dashboard/backend/demo_data.py - Load all JSON files on initialization
- Implement filtering methods:
get_runs()- with warehouse, schema, table, date filtersget_drift_alerts()- with severity, table filtersget_table_metrics()- table-specific metricsget_validation_results()- validation filteringget_lineage_graph()- lineage relationships
- Location:
-
Implement in-memory filtering
- Date range filtering
- Text search (table names, schemas)
- Sorting and pagination
- Aggregations (counts, summaries)
-
Add demo mode detection
- Environment variable:
DEMO_MODE=true - Feature flag in code
- Environment variable:
Deliverables
- ✅
demo_data.pywith DemoDataService class - ✅ Unit tests for filtering logic
- ✅ Performance benchmarks (should be <100ms for most queries)
Estimated Time: 6-8 hours
Phase 3: Backend Integration
Goal: Modify backend to support demo mode alongside normal database mode.
Tasks
-
Update DatabaseClient
- Location:
baselinr/dashboard/backend/database.py - Add demo mode detection
- Route to DemoDataService when in demo mode
- Maintain backward compatibility
- Location:
-
Update main.py
- Add demo mode environment variable check
- Configure CORS for demo domain
- Add demo mode indicator endpoint
-
Create demo-specific routes (optional)
/api/demo/info- demo metadata/api/demo/reset- reset demo state (if needed)
Deliverables
- ✅ Updated
database.pywith demo mode support - ✅ Updated
main.pywith demo configuration - ✅ Backward compatibility maintained
Estimated Time: 4-6 hours
Phase 4: Cloudflare Pages Functions Setup
Goal: Convert FastAPI routes to Cloudflare Pages Functions.
Tasks
-
Create Pages Functions structure
dashboard/frontend/functions/
├── api/
│ ├── runs.ts
│ ├── drift.ts
│ ├── tables.ts
│ ├── metrics.ts
│ ├── validation.ts
│ ├── lineage.ts
│ └── ...
└── demo/
└── info.ts -
Convert API routes
- Each FastAPI endpoint → Cloudflare Pages Function
- Use DemoDataService (ported to TypeScript or call Python)
- Maintain same response format
-
Handle demo data loading
- Option A: Bundle JSON files with deployment
- Option B: Load from Cloudflare KV/R2 (if needed)
- Option C: Inline in function (for small datasets)
Deliverables
- ✅ Cloudflare Pages Functions for all API endpoints
- ✅ Demo data accessible to functions
- ✅ Same API contract as FastAPI version
Estimated Time: 8-12 hours
Phase 5: Frontend Configuration
Goal: Configure Next.js for Cloudflare Pages deployment.
Tasks
-
Update next.config.js
- Configure for static export OR serverless
- Set up API URL rewrites for demo mode
- Add demo mode environment variable
-
Update API client
- Location:
dashboard/frontend/lib/api.ts - Detect demo mode
- Use relative API paths for Pages Functions
- Location:
-
Add demo mode indicator
- Banner/notice in UI showing "Demo Mode"
- Disable write operations (if any)
- Add link to production docs
Deliverables
- ✅ Updated Next.js configuration
- ✅ Demo mode UI indicators
- ✅ API client working with Pages Functions
Estimated Time: 4-6 hours
Phase 6: Cloudflare Deployment Setup
Goal: Set up Cloudflare Pages project and deployment pipeline.
Tasks
-
Create wrangler.toml
- Configure Pages project
- Set environment variables
- Configure build settings
-
Create deployment scripts
- Build script for frontend
- Deploy script using Wrangler CLI
- CI/CD integration (GitHub Actions)
-
Set up subdomain
- Configure
demo.baselinr.io(or chosen subdomain) - SSL certificate (automatic with Cloudflare)
- Custom domain routing
- Configure
Deliverables
- ✅
wrangler.tomlconfiguration - ✅ Deployment scripts
- ✅ CI/CD pipeline (optional)
- ✅ Demo accessible at subdomain
Estimated Time: 4-6 hours
Phase 7: Documentation & Website Integration
Goal: Add demo links and documentation to the website.
Tasks
-
Update website navbar
- Add "Try Demo" button/link
- Link to demo subdomain
-
Update website footer
- Add demo link in Resources section
-
Create demo documentation page
- Location:
docs/dashboard/DEMO.md - Explain demo features
- Link to demo
- Note limitations
- Location:
-
Update README
- Add demo link in main README
- Add demo section in Quality Studio docs
-
Add demo badge/banner
- Optional: Add to homepage
- Link to demo
Deliverables
- ✅ Demo links in navbar and footer
- ✅ Demo documentation page
- ✅ Updated README with demo info
Estimated Time: 2-4 hours
Phase 8: Testing & Polish
Goal: Test demo thoroughly and add polish.
Tasks
-
End-to-end testing
- Test all pages load correctly
- Test all API endpoints
- Test filtering and search
- Test on mobile devices
-
Performance optimization
- Optimize JSON file sizes
- Add caching headers
- Optimize bundle sizes
-
UI polish
- Add demo mode indicators
- Add helpful tooltips
- Ensure responsive design
-
Error handling
- Graceful error messages
- Fallback UI states
- Loading states
Deliverables
- ✅ Fully tested demo
- ✅ Performance optimized
- ✅ Polished UI
Estimated Time: 6-8 hours
Total Estimated Time: 38-56 hours
Quick Start Commands
Generate Demo Data
cd baselinr/dashboard/backend
python generate_demo_data.py
Build Frontend
cd baselinr/dashboard/frontend
npm run build
Deploy to Cloudflare
wrangler pages deploy dashboard/frontend/out --project-name=baselinr-demo
Environment Variables
# Demo mode flag
DEMO_MODE=true
# API URL (for frontend)
NEXT_PUBLIC_API_URL=/api
# Cloudflare Pages
CF_PAGES_PROJECT=baselinr-demo
CF_PAGES_BRANCH=main
Maintenance
Updating Demo Data
- Regenerate demo data:
python generate_demo_data.py - Commit updated JSON files
- Redeploy to Cloudflare Pages
Monitoring
- Cloudflare Analytics (built-in)
- Error tracking (optional: Sentry)
- Performance monitoring (Cloudflare Web Analytics)
Future Enhancements
- Add interactive demo scenarios
- Add demo data refresh mechanism
- Add demo tour/walkthrough
- Add demo feedback form
- Add analytics to track demo usage