A React web app that helps users identify cognitive distortions in their negative thoughts, based on David Burns' CBT framework. Type a thought, get an AI-powered analysis identifying which of the 10 distortions are present, and receive a compassionate reframe.
- Analyzes thoughts against the 10 Burns cognitive distortions
- Warm, friendly UI — feels like a kind journal, not a medical tool
- Session history saved to localStorage
- Review My Patterns — analyzes your history to surface recurring distortions, identifies a theme, and generates a personalized practice prompt with AI feedback on your attempt
- Distortion reference browser with clickable detail cards
- Basic Auth protected API
- Node.js 18+
- An Anthropic API key
# Install all dependencies
npm run install:all
# Copy and fill in environment variables
cp server/.env.example server/.env
# Edit server/.env and set ANTHROPIC_API_KEY, BASIC_AUTH_USER, BASIC_AUTH_PASSWORDDev mode (Vite + Express with live reload):
npm run devClient at https://localhost:5173, server at https://localhost:3001. Both use HTTPS via https-localhost/mkcert. The first run may prompt for sudo to install the local CA.
Production build:
npm run build
node server/index.jsVisit https://localhost:3001. Express serves the built client directly.
# Server tests
npm test --prefix server
# Client tests
npm test --prefix clientSet in server/.env (dev) or your hosting dashboard (production):
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Anthropic API key |
BASIC_AUTH_USER |
Basic Auth username |
BASIC_AUTH_PASSWORD |
Basic Auth password |
- Push to GitHub
- Create a new Railway project → Deploy from GitHub repo
- Set the three environment variables above in Railway's dashboard
- Railway runs
npm run buildthennpm startautomatically and provides a public HTTPS URL
- Frontend: React (Vite), Tailwind CSS
- Backend: Express.js
- AI: Anthropic claude-sonnet-4-20250514
- Security: Helmet (CSP), Basic Auth, rate limiting (20 req/IP/hour on
/api/analyze, 10 on/api/reflect, 15 on/api/practice)
This tool is for self-reflection only and is not a substitute for support from a qualified mental health professional. Developed using Claude Code.