Skip to content

halluton/MindfulIDE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MindfulIDE πŸ§˜β€β™€οΈ

A mindful IDE extension that promotes wellbeing during AI coding downtime with guided breathing exercises.

Overview

MindfulIDE solves the problem of wasted downtime and mental fatigue during AI-assisted coding. Instead of context-switching to your phone during 1-5 minute inference gaps, MindfulIDE offers guided breathing exercises that help you stay focused, reduce stress, and return to coding with renewed energy.

Features

Two Science-Based Breathing Exercises

😌 Cyclic Sighing (Increase Relaxation)

  • Pattern: Two inhales β†’ Long exhale
  • Duration: ~6 minutes (6 cycles)
  • Purpose: Reduce stress and calm the nervous system
  • Research: Based on physiological sigh technique proven to activate parasympathetic response

⚑ Cyclic Hyperventilation (Increase Alertness)

  • Pattern: Rapid deep inhales β†’ Slower exhales
  • Duration: ~2 minutes (30 cycles)
  • Purpose: Boost energy and mental alertness
  • Similar to: Wim Hof breathing method

Key Capabilities

  • Beautiful Animations: Smooth, calming breathing visualizations with Framer Motion
  • Session Tracking: Automatic tracking of all mindfulness sessions
  • Statistics Dashboard: Track your mindfulness journey with detailed stats
    • Total sessions completed
    • Total time spent being mindful
    • Current and longest streaks
    • Sessions by exercise type
  • Downtime Detection: Smart idle detection suggests breathing exercises after 2 minutes
  • Progress Tracking: Real-time cycle and time tracking during exercises

Tech Stack

Frontend

  • React 18 with TypeScript
  • Vite for fast development
  • Tailwind CSS for styling
  • Framer Motion for smooth animations
  • Zustand for state management
  • Axios for API calls

Backend

  • Node.js with Express
  • TypeScript for type safety
  • SQLite with better-sqlite3 for session storage
  • RESTful API design

Project Structure

MindfulIDE/
β”œβ”€β”€ frontend/                     # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ BreathingCircle.tsx      # Animated breathing visualization
β”‚   β”‚   β”‚   β”œβ”€β”€ BreathingExercise.tsx    # Main exercise component
β”‚   β”‚   β”‚   β”œβ”€β”€ ExerciseSelector.tsx     # Exercise selection UI
β”‚   β”‚   β”‚   └── StatsDashboard.tsx       # Statistics display
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── useBreathingCycle.ts     # Breathing cycle logic
β”‚   β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”‚   └── api.ts                   # API client
β”‚   β”‚   └── App.tsx                      # Main app component
β”‚   └── package.json
β”‚
β”œβ”€β”€ backend/                      # Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ database/
β”‚   β”‚   β”‚   └── db.ts                    # SQLite setup
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   └── Session.ts               # Session data model
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ sessions.ts              # Session endpoints
β”‚   β”‚   β”‚   └── stats.ts                 # Statistics endpoints
β”‚   β”‚   └── index.ts                     # Express server
β”‚   └── package.json
β”‚
β”œβ”€β”€ shared/                       # Shared types & constants
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── breathing.ts                 # TypeScript interfaces
β”‚   └── constants/
β”‚       └── breathingPatterns.ts         # Exercise definitions
β”‚
└── package.json                  # Monorepo root

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Git

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd MindfulIDE
  2. Install dependencies

    npm install
    cd frontend && npm install
    cd ../backend && npm install
    cd ..
  3. Set up environment variables

    cp frontend/.env.example frontend/.env
    cp backend/.env.example backend/.env
  4. Run the application

    # From root directory - runs both frontend and backend
    npm run dev

    Or run separately:

    # Terminal 1 - Backend (port 5000)
    cd backend && npm run dev
    
    # Terminal 2 - Frontend (port 3000)
    cd frontend && npm run dev
  5. Open your browser

API Endpoints

Sessions

  • POST /api/sessions - Create a new session
  • PATCH /api/sessions/:id - Update a session
  • GET /api/sessions/:id - Get session by ID
  • GET /api/sessions - Get all sessions (limit query param)

Statistics

  • GET /api/stats - Get aggregated statistics

Health

  • GET /api/health - Health check endpoint

Usage

Starting a Breathing Exercise

  1. Select an exercise from the home screen

    • Choose "Cyclic Sighing" for relaxation
    • Choose "Cyclic Hyperventilation" for alertness
  2. Click Start when ready

  3. Follow the visual cues

    • Circle expands during inhale
    • Circle contracts during exhale
    • Read on-screen instructions
  4. Complete the session

    • Progress bar shows current cycle
    • Timer shows elapsed time
    • Can pause/resume anytime

Viewing Statistics

Click "View Stats" to see:

  • Total mindfulness sessions completed
  • Total time spent in mindfulness
  • Current daily streak
  • Longest streak achieved
  • Breakdown by exercise type
  • Average session duration

Breathing Patterns Explained

Cyclic Sighing (Relaxation)

Pattern: Inhale (2s) β†’ Inhale (2s) β†’ Exhale (6s)

How it works:

  1. First inhale through nose (fill lungs 80%)
  2. Quick second inhale through nose (top off to 100%)
  3. Long, slow exhale through mouth (empty completely)

Benefits:

  • Activates parasympathetic nervous system
  • Reduces heart rate and blood pressure
  • Decreases stress hormones (cortisol)
  • Improves emotional regulation

Best for:

  • After a stressful debugging session
  • Before important code reviews
  • When feeling overwhelmed

Cyclic Hyperventilation (Alertness)

Pattern: Deep Inhale (1.5s) β†’ Passive Exhale (2.5s)

How it works:

  1. Deep, rapid inhale through nose or mouth
  2. Let the exhale happen passively (don't force it)
  3. Repeat rapidly for 30 cycles

Benefits:

  • Increases oxygen in blood
  • Boosts adrenaline and energy
  • Enhances mental clarity
  • Improves focus and alertness

Best for:

  • Early morning coding sessions
  • After lunch energy dip
  • Before tackling complex problems

Development

Running Tests

# Frontend tests
cd frontend && npm test

# Backend tests
cd backend && npm test

Building for Production

# Build both frontend and backend
npm run build

# Or separately
npm run build:frontend
npm run build:backend

Database

The SQLite database is stored at backend/data/mindful.db and includes:

  • Session history
  • Exercise completion data
  • Timestamps for streak calculation

Future Enhancements

  • VS Code extension integration
  • Real-time AI downtime detection hooks
  • Audio cues and ambient sounds
  • Custom breathing pattern creator
  • Multi-user support with authentication
  • Mobile app version
  • Integration with other IDEs (JetBrains, Sublime)
  • Biometric data integration (Apple Watch, Fitbit)
  • Team/workplace mindfulness challenges
  • Export data to CSV/JSON

Inspiration

This project was inspired by:

  • Whoop: For their excellent breathing exercise implementations
  • ChadIDE: For highlighting the downtime problem during AI coding
  • Research: Neuroscience studies on breathing and stress reduction

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - feel free to use this project however you'd like!

Acknowledgments

  • Research on physiological sighs by Stanford's Huberman Lab
  • Wim Hof Method for cyclic hyperventilation technique
  • All developers struggling with AI coding downtime

Built with 🧘 by developers, for developers

Stay mindful, code better! πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published