* migrate: Vercel → Cloudflare Pages + Workers para reducir costos ($110 → ~$0-5/mes)
- Cambia adaptador Astro de @astrojs/vercel a @astrojs/cloudflare (mode: 'directory')
- Agrega dashboard/wrangler.toml con nodejs_compat para compatibilidad total
- Crea cloudflare-workers/crons/ Worker que reemplaza los cron jobs de Vercel
(claude-code-check cada 30min, health-check cada 1h en vez de cada 15min)
- Actualiza CI/CD: Vercel CLI → wrangler pages deploy (requiere CLOUDFLARE_API_TOKEN y CLOUDFLARE_ACCOUNT_ID en GitHub Secrets)
- Elimina crons duplicados del proyecto legacy aitmpl (root vercel.json)
- Quick win: agrega Cache-Control headers a components.json (86400s), plugins.json,
trending-data.json y claude-jobs.json para cortar el costo de bandwidth de $53
Próximos pasos manuales (ver PR description):
1. Crear proyecto en Cloudflare Pages
2. Agregar secrets de Cloudflare en GitHub
3. Migrar env vars de Vercel a Cloudflare Dashboard
4. Deployar cloudflare-workers/crons con wrangler
5. Apuntar dominios a Cloudflare Pages
* fix: nodejs_compat_v2 + react-dom/server.node alias para Cloudflare Workers
- Cambia compatibility_flags de nodejs_compat a nodejs_compat_v2
- Agrega alias vite react-dom/server → react-dom/server.node para evitar
MessageChannel error en module init time en Cloudflare Workers runtime
- Agrega ssr.noExternal para bundlear react-dom y aplicar el alias
* fix: revert compatibility_flags a nodejs_compat (estándar)
nodejs_compat_v2 no es el flag primario. El fix real del MessageChannel
error fue el alias vite react-dom/server → react-dom/server.node,
no el cambio de flag.
* fix: inject Cloudflare Pages runtime env into process.env via middleware
Add Astro middleware that copies context.locals.runtime.env (Cloudflare
Pages secrets) into process.env before each request, so API routes can
use process.env.X as a unified pattern without changing the call sites.
Also add || process.env.X fallbacks to all API routes/libs that were
using import.meta.env exclusively (build-time only in Vite).
Verified on staging: track-download-supabase, health-check,
claude-code-check, collections, github/token all return correct responses.
Allows app.aitmpl.com dashboard to fetch data cross-origin from
www.aitmpl.com without the bare domain 307 redirect issue.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create 3 Neon tables: installation_outcomes, website_events, api_health_logs
- Add API endpoints: track-installation-outcome, track-website-events, health-check
- Track CLI installation success/failure with timing and error classification
- Add website event tracker (search, cart, component views) with batched sendBeacon
- Add health-check cron every 15min with Discord alerts on failure
- Integrate tracking in all 6 installIndividual* functions with batchId support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Database schema for tracking Claude Code versions in Neon
- Automated parser for CHANGELOG.md with change classification
- Discord webhook integration with formatted embeds
- Vercel Cron job running every 4 hours
- Supports detection of features, fixes, improvements, and breaking changes
Endpoints:
- /api/claude-code-check - Main endpoint for version checking and notification
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add plugin marketplace system with 10 curated plugins
- Create plugin detail pages with installation instructions
- Add component installation modal with copy functionality
- Update Python script to extract plugin data with category/folder paths
- Add category filters that load correctly based on URL
- Update footer across all pages for consistency
- Fix install commands to use folder/name format
Features:
- Plugin cards with View Details button
- Individual component installation with proper paths
- Related plugins based on shared keywords
- Dynamic category loading for all filter types
- URL-based filter detection and category display
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Vercel doesn't allow mixing 'routes' with 'rewrites'. Changed to use
only rewrites with named parameters for cleaner syntax.
Changes:
- Remove 'routes' section (incompatible with 'rewrites')
- Use named parameters (:type/:name) instead of regex capture groups
- Add JSON Content-Type headers for all .json files
- Add 5-minute cache for JSON files
This ensures components.json and other JSON files are served correctly
with proper MIME types instead of HTML.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The component rewrite was intercepting /components.json requests,
returning HTML instead of JSON, causing "<!DOCTYPE... is not valid JSON" errors.
Changes:
- Add $ anchor to component rewrite pattern for exact matching
- Add explicit routes for .json files to ensure proper serving
- Add cache headers for JSON files (5 minute cache)
- Prevent rewrites from intercepting static JSON resources
This ensures /components.json returns actual JSON instead of HTML.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Disable cleanUrls to prevent conflicts with rewrites
- Remove unnecessary JS/CSS rewrites (using absolute paths instead)
- Fix header paths from /docs/* to /* for proper MIME types
- Add explicit Content-Type headers for JS and CSS files
This should resolve the rewrite issue where /component/agent/name
was serving index.html instead of component.html.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Reorder Vercel rewrites to prioritize component routes
- Add explicit JS and CSS route handling for SEO-friendly URLs
- Fix environment-specific resource loading in component.html
- Add debug logging for troubleshooting script loading issues
This resolves MIME type errors and ensures component.html loads
correctly for URLs like /component/agent/name in production.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replace pool-based connection with @vercel/postgres sql template
- Use Vercel's auto-detection instead of explicit runtime config
- Convert all database queries to sql template literals
- Simplify table creation with proper error handling
- Maintain all functionality while ensuring Vercel compatibility
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix runtime configuration to use @vercel/node instead of nodejs18.x
- Convert API to ES modules for Vercel compatibility
- Add package.json for API function dependencies
- Ensure proper module handling for @vercel/postgres
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements a comprehensive download tracking system inspired by npm analytics
to monitor component usage and improve popular components.
Key features:
• Anonymous download tracking for all component types (agents, commands, mcps, settings, hooks)
• Vercel + PostgreSQL backend with dual endpoint strategy
• Privacy-first design with complete opt-out support
• Fire-and-forget tracking that never blocks user experience
• Comprehensive test suite and documentation
Backend changes:
• Created API endpoint /api/track-download.js with PostgreSQL integration
• Implemented proper database schema with download_stats aggregation
• Added request validation, rate limiting, and security measures
• Configured Vercel deployment with database functions
CLI changes:
• Enhanced TrackingService to support database + telemetry endpoints
• Added automatic tracking for all installation types
• Implemented graceful fallback when database is unavailable
• Maintains existing privacy and opt-out mechanisms
Testing & Documentation:
• Added comprehensive test suite (test-download-tracking.js)
• Created detailed documentation (DOWNLOAD_TRACKING.md)
• Included deployment instructions and troubleshooting guide
• Added security and compliance information
The system respects user privacy by:
- Only collecting anonymous usage metrics
- Providing multiple opt-out mechanisms (CCT_NO_TRACKING, CCT_NO_ANALYTICS, CI=true)
- Never storing personally identifiable information
- Using fire-and-forget requests with timeout limits
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Critical Issues Resolved:
- **Lazy loading**: Components.json now loads in 50-item batches instead of 1.6MB at once
- **Timeouts**: Added 8-second timeouts to prevent hanging fetches
- **Loading states**: Visual progress indicators for better UX
- **MutationObserver**: Optimized with debouncing and selective monitoring
- **Background loading**: Non-blocking progressive loading
- **Error handling**: Comprehensive fallbacks and user-friendly error messages
## Technical Improvements:
- RequestAnimationFrame instead of setTimeout for smoother animations
- Debounced DOM updates to prevent excessive reflows
- Intelligent caching with cache-friendly timestamps
- Progressive enhancement with fallback data
- Memory-efficient pagination system
- Performance-optimized CSS animations
## Mobile-Specific Fixes:
- Reduced initial payload from 1.6MB to ~200KB
- Prevented UI thread blocking during data parsing
- Added mobile-optimized loading states
- Improved error handling for slow connections
This should resolve the mobile freezing issues completely.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Configure static site deployment for docs/ folder
- Set up proper routing for SPA functionality
- Add security headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection)
- Configure caching for static assets (JS/CSS)
- Enable filesystem routing with fallback to index.html
- Set project name as claude-code-templates-cart
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>