Menu

How I Built a Free CBT Thought Record Tool in Vanilla JS
📰

How I Built a Free CBT Thought Record Tool in Vanilla JS

DEV Community: javascript·CBT Tools·2 days ago
#ANGBLXmj
#devtojavascript#devto#dev#thought#record
Reading 0:00
15s threshold

I built a free CBT thought record tool that runs entirely in the browser - no signup, no backend, no frameworks.

Why Vanilla JS?

CBT tools handle sensitive mental health data. Every extra dependency is an attack surface. Vanilla JS means: zero dependencies, works offline, auditable, portable.

The Core: Thought Record State Machine

A CBT thought record is a 7-step process: Situation -> Emotions -> Thoughts -> Distortions -> Alternatives -> Re-rate -> Action.

Here's the state machine that drives it:

const ThoughtRecord = { state : { emotions : [ ] , thoughts : [ ] , distortions : new Set ( ) } , save ( ) { localStorage . setItem ( 'cbt-thought-record' , JSON . stringify ( this .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.