Skip to content

A minimal, offline-capable Pomodoro timer with cycle tracking, adaptive break scheduling, optional focus music, and accurate background timing. Built with vanilla JavaScript and designed for clarity, accessibility, and deep work.

License

Notifications You must be signed in to change notification settings

hjadmz/pomodoro-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ… Pomodoro Timer

A professional, accessible, and feature-rich Pomodoro timer built with vanilla JavaScript. Boost your productivity with the proven Pomodoro Technique.

Version License PWA

โœจ Features

Core Functionality

  • โฑ๏ธ Customizable Timers - Set your own work, break, and long break durations
  • ๐Ÿ”„ Cycle Tracking - Zero-indexed cycles (0/4 โ†’ 4/4) with automatic long breaks
  • ๐ŸŽต Background Music - YouTube integration with hidden player (audio only)
  • ๐Ÿ”” Smart Notifications - Browser notifications when sessions complete
  • ๐Ÿ’พ Auto-Save - All settings and progress saved automatically
  • ๐Ÿ“ฑ Progressive Web App - Install on any device, works offline

Professional Polish

  • โ™ฟ WCAG AA Compliant - Fully accessible to all users
  • ๐ŸŽจ Modern UI - Clean blue accent design with smooth animations
  • ๐ŸŒ“ Dark Mode - Automatic dark mode based on system preferences
  • โŒจ๏ธ Keyboard Shortcuts - Full keyboard navigation (Space, R, S)
  • ๐Ÿ“ Responsive - Works perfectly on all screen sizes (360px to 4K)
  • ๐Ÿ›ก๏ธ Offline Support - Service worker caches everything

Technical Excellence

  • ๐Ÿš€ Zero Dependencies - Pure vanilla JavaScript
  • ๐Ÿ”ง Modular Architecture - Clean, maintainable code structure
  • ๐Ÿ›ก๏ธ Error Handling - Comprehensive error handling and recovery
  • ๐Ÿ”’ Privacy First - All data stored locally, no tracking
  • ๐ŸŒ Cross-Browser - Works on Chrome, Firefox, Safari, Edge
  • ๐Ÿ“Š Professional Logging - Developer-friendly console messages

๐Ÿš€ Quick Start

Installation

  1. Clone the repository

    git clone https://github.com/hjadmz/pomodoro-timer.git
    cd pomodoro-timer
    
  2. Serve the files

    Using Python:

    python -m http.server 8000
    

    Using Node.js:

    npx serve
    

    Using PHP:

    php -S localhost:8000
    
  3. Open in browser

    http://localhost:8000
    

Usage

Basic Operation

  1. Click Start to begin a 25-minute work session
  2. Work until the timer completes
  3. Take a 5-minute short break
  4. After 4 work cycles, enjoy a 15-minute long break

Keyboard Shortcuts

  • Space - Start/Pause timer
  • R - Reset timer
  • S - Jump to settings

Customization

  1. Scroll to the Settings section
  2. Adjust durations and cycles to your preference
  3. Enable notifications (requires browser permission)
  4. Add a YouTube URL for background music (optional)
  5. Click Save Settings

๐Ÿ“‹ Browser Compatibility

Browser Minimum Version Support Level
Chrome 90+ โœ… Full
Firefox 88+ โœ… Full
Safari 14+ โœ… Full
Edge 90+ โœ… Full
iOS Safari 14+ โš ๏ธ No notifications
Android Chrome 90+ โœ… Full

๐Ÿ—๏ธ File Structure

pomodoro-timer/
โ”œโ”€โ”€ index.html              # Main HTML
โ”œโ”€โ”€ manifest.webmanifest    # PWA manifest
โ”œโ”€โ”€ service-worker.js       # Offline support
โ”œโ”€โ”€ offline.html           # Offline fallback
โ”œโ”€โ”€ robots.txt             # SEO configuration
โ”œโ”€โ”€ LICENSE                # MIT License
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ .gitignore             # Git exclusions
โ”œโ”€โ”€ css/
โ”‚   โ””โ”€โ”€ style.css          # Complete stylesheet
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ state.js           # State management
โ”‚   โ”œโ”€โ”€ timer.js           # Timer logic
โ”‚   โ”œโ”€โ”€ player.js          # YouTube integration
โ”‚   โ”œโ”€โ”€ notifications.js   # Notification handling
โ”‚   โ”œโ”€โ”€ ui.js              # UI updates
โ”‚   โ””โ”€โ”€ app.js             # Main orchestrator
โ””โ”€โ”€ assets/
    โ””โ”€โ”€ icons/             # PWA icons (12 sizes)

๐ŸŽจ Customization

Colors

Edit CSS custom properties in css/style.css:

:root {
  --color-primary: #3b82f6;        /* Blue accent */
  --color-success: #10b981;        /* Success states */
  --color-bg: #f8fafc;             /* Background */
  --color-text: #1e293b;           /* Text color */
}

Durations

Default durations in js/state.js:

const DEFAULT_STATE = {
  settings: {
    workDuration: 25,              // Minutes
    breakDuration: 5,              // Minutes
    longBreakDuration: 15,         // Minutes
    cyclesBeforeLongBreak: 4       // Cycles (0-indexed)
  }
};

โ™ฟ Accessibility Features

  • Semantic HTML - Proper heading hierarchy and landmarks
  • ARIA Labels - Comprehensive screen reader support
  • Keyboard Navigation - All functionality accessible via keyboard
  • Focus Indicators - Clear visual focus states
  • Color Contrast - WCAG AA compliant (4.5:1+ ratios)
  • Reduced Motion - Respects prefers-reduced-motion
  • Touch Targets - Minimum 44x44px tap targets

๐Ÿ”’ Privacy & Security

  • No Tracking - Zero analytics or tracking scripts
  • Local Storage Only - All data stored on your device
  • No External Requests - Except YouTube (optional)
  • No Cookies - No cookies used
  • Open Source - Full transparency

๐Ÿ“ฑ Progressive Web App

Installation

Desktop:

  1. Click the install icon in the address bar
  2. Follow browser prompts

Mobile:

  1. Open in browser
  2. Tap "Add to Home Screen"
  3. Confirm installation

Offline Support

  • Works completely offline after first load
  • Settings and progress saved locally
  • Graceful degradation for online-only features

๐Ÿ› Troubleshooting

Notifications Not Working

  1. Check browser supports notifications
  2. Grant permission when prompted
  3. Note: iOS Safari doesn't support web notifications

YouTube Player Not Loading

  1. Check internet connection
  2. Verify valid YouTube URL format
  3. Check browser console for errors

Settings Not Saving

  1. Ensure localStorage is available
  2. Not in private/incognito mode
  3. Check browser console for errors

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Code Standards

  • Indentation: 2 spaces
  • Naming: camelCase (JS), kebab-case (CSS)
  • Comments: JSDoc for functions
  • No emojis in code (only in README)

๐Ÿ“„ License

This project is licensed under the MIT License - see LICENSE file.

๐Ÿ‘ค Author

Henry Adams

๐Ÿ™ Acknowledgments

  • Pomodoro Techniqueยฎ by Francesco Cirillo
  • YouTube IFrame API by Google
  • Inspired by the productivity community

๐Ÿ“ž Support


Made with โค๏ธ by Henry Adams

Pomodoro Techniqueยฎ is a registered trademark of Francesco Cirillo

About

A minimal, offline-capable Pomodoro timer with cycle tracking, adaptive break scheduling, optional focus music, and accurate background timing. Built with vanilla JavaScript and designed for clarity, accessibility, and deep work.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published