Why CBT? Why JavaScript?
Cognitive Behavioral Therapy (CBT) is the most evidence-backed treatment for anxiety and depression. The core insight: your thoughts are not facts — they are patterns that can be identified and reframed.
As developers, we think in deterministic transformation pipelines:
Input (automatic thought) → Pattern match (cognitive distortion) → Reframe (alternative thought) → Output (behavior change) This is essentially a debugging pipeline for your brain:
- Debug mode: Identify which line of code is wrong (identify cognitive distortions)
- Refactor: Rewrite that logic (cognitive reframing)
- Test: Verify the new logic holds (behavioral experiment)
I built 806 free CBT tools — all vanilla HTML/CSS/JavaScript, zero dependencies, no backend, no signup.
Why NOT use NLP/ML?
People ask: "Why not use LLMs for cognitive restructuring?"
Answer: precision, latency, cost, privacy.
| Scheme | Precision | Latency | Cost | Privacy |
|---|---|---|---|---|
| Pattern matching | Deterministic (same input → same output) | 0ms | $0 | Data stays in browser |
| LLM API | Stochastic (temperature > 0) | 500-3000ms | $0.01/call | Data goes to server |
CBT output space is finite:
- 11 cognitive distortions
- 13 core beliefs
- 6 technique paths
Using an LLM for this is like using a nuclear power plant to power a flashlight.
Deterministic = explainable. Each match chain IS an intervention.
Code Sample: Distortion Detector
// Core matching logic — deterministic pattern matching const distortions = { 'mindReading': { patterns: ['他们觉得', '别人会笑话', '所有人都在看'], reframe: '读心术:你无法知道别人的想法。证据是什么?' }, 'fortuneTelling': { patterns: ['肯定会失败', '一定会', '绝对会'], reframe: '预言家:你预测了负面未来。这个预测的证据是什么?' }, 'labeling': { patterns: ['我是个失败者', '我太笨了', '我没用'], reframe: '贴标签:用一个词定义自己不准确。具体行为是什么?' }, 'catastrophizing': { patterns: ['完了', '一切都毁了', '这辈子完了'], reframe: '灾难化:你在想最坏情况。最坏情况发生的概率是多少?' } }; function detectDistortions(thought) { const found = []; for (const [key, config] of Object.entries(distortions)) { if (config.patterns.some(p => thought.includes(p))) { found.push({ id: key, reframe: config.reframe }); } } return found; } // Example const thought = "我肯定会搞砸这次演示,所有人都会觉得我是个骗子"; const result = detectDistortions(thought); // → [ // { id: 'fortuneTelling', reframe: '预言家:你预测了负面未来...' }, // { id: 'mindReading', reframe: '读心术:你无法知道别人的想法...' }, // { id: 'labeling', reframe: '贴标签:用一个词定义自己...' } // ] The Tools (All Free)
| Tool | Function | Link |
|---|---|---|
| Thought Record | 7-step CBT + distortion detector | Use free |
| Distortion Checker | Paste thought → identify 11 traps | Use free |
| Mood Tracker | Daily trends + activation suggestions | Use free |
| Anxiety Toolkit | 6 techniques + 5-4-3-2-1 grounding | Use free |
| Depression Toolkit | 6 techniques + activity scheduler | Use free |
| OCD Toolkit | 6 techniques + ERP tracker | Use free |
| Social Anxiety Toolkit | 6 techniques + exposure builder | Use free |
| Imposter Syndrome | 6 techniques + evidence log | Use free |
| Burnout Detector | 6 techniques + burnout log | Use free |
All tools: pure frontend, zero dependencies, offline-ready.
Data (Honest)
- 806 free pages
- 226 developers cloned the toolkit
- $0 revenue (by design)
- 3,681 Dev.to reactions
- 3 GitHub stars
Free is a feature, not a bug. People who can't afford $150/therapy session deserve these tools.
For Developers Reading This
If you're experiencing:
- Imposter syndrome ("I don't belong in this role")
- Burnout ("I hate coding now")
- Anxiety ("I'll mess up this deployment")
- Perfectionism ("This PR isn't good enough to submit")
Try these tools. They won't replace therapy, but they're the first line of defense when you're alone at 2am facing a panic attack.
Links:
- Toolkit: https://473185670.github.io/cbt-toolkit/
- GitHub: https://github.com/473185670/cbt-toolkit
- Support (optional): https://4043969836017.gumroad.com/l/yyzll ($1-7)
Disclaimer: These tools are for self-help and education. They don't replace professional mental health services. If you're in crisis, please call a hotline or seek medical help.
If these tools helped you, consider starring the repo ⭐ or sharing with someone who might need it.