CCT is a Cloudflare Workers codebase for AI-assisted market intelligence: sentiment analysis, report generation, dashboards, and operational tooling. The core worker lives in src/, Durable Objects are in src/modules/, and the public UI is in public/.
Key characteristics:
- Dual-model sentiment pipeline (primary GPT-OSS 120B, secondary DeepSeek-R1 32B)
- Durable Objects cache as the primary fast path
- D1-backed job storage for reports and runs (with KV fallback)
- Multi-run tracking across scheduled job types
- Polling-based dashboards (SSE disabled)
src/- Worker handlers and route modulessrc/routes/- API v1 route handlers by domainsrc/modules/- Durable Objects and shared servicespublic/- Dashboard assets and static UIdocs/- Guides, architecture notes, and referencestests/- Playwright specs and test scriptsscripts/- Operational and utility scripts
Base path for APIs is /api/v1. Route groups are organized by domain:
- Sentiment:
/api/v1/sentiment/* - Reports:
/api/v1/reports/* - Data:
/api/v1/data/* - Jobs:
/api/v1/jobs/* - Sector rotation:
/api/v1/sector-rotation/*and/api/v1/sectors/* - Market intelligence:
/api/v1/market-intelligence/* - Market drivers:
/api/v1/market-drivers/* - Predictive analytics:
/api/v1/predictive/* - Technical analysis:
/api/v1/technical/* - Advanced analytics:
/api/v1/analytics/* - Realtime:
/api/v1/realtime/* - Backtesting:
/api/v1/backtesting/* - Portfolio:
/api/v1/portfolio/* - Risk management:
/api/v1/risk/* - Cache:
/api/v1/cache/* - Production guards:
/api/v1/guards/*
For a complete list, see src/routes/ and the API root response at /api/v1.
- If
X_API_KEYis configured in the environment, non-public/api/v1/*endpoints requireX-API-Key. - Dashboards use
public/js/cct-api.js, which looks for the key insessionStorage.cct_api_key, thenlocalStorage.cct_api_key, thenwindow.CCT_API_KEY. - Public endpoints include
/health,/model-health,/api/v1/data/health,/api/v1/reports/status,/api/v1/jobs/history, and/api/v1/jobs/runs.
npm install
npm run devDeployment and testing:
npm run deploynpm run deploy:frontendornpm run deploy:frontend:onlynpm run test:playwrightnpm run test:performanceornpm run test:workflows
Wrangler auth uses OAuth for this repo:
unset CLOUDFLARE_API_TOKEN && npx wrangler <command>Start with docs/INDEX.md, then follow the relevant guide:
docs/guides/USER_GUIDE.mddocs/guides/DEPLOYMENT_GUIDE.mddocs/guides/MAINTENANCE_GUIDE.mdAPI_DOCUMENTATION.md
scheduled_job_results.scheduled_dateis a write-time tag; the frontend?date=YYYY-MM-DDis passed through verbatim.- Multi-run tracking is used across job types with
startJobRun()andcompleteJobRun(). - Prediction job storage is in D1 (
job_executions,symbol_predictions,daily_analysis) with KV fallback.
- Primary model:
@cf/openai/gpt-oss-120b - Secondary model:
@cf/deepseek-ai/deepseek-r1-distill-qwen-32b - Deprecated:
@cf/openchat/openchat-3.5-0106,@cf/aisingapore/gemma-sea-lion-v4-27b-it
Last Updated: 2026-02-02