KAUSHIK SARKARBlogs
Software Prompts

ZenClock: Minimalist Alarm Clock with Snooze & Dark Mode in React

By Kaushik Sarkar · · 10 min read
Hero screenshot of the finished Alarm Clock

This tutorial shows how to build a minimalist alarm clock app using AI coding tools. The prompt comes from the Mega Project List (karan/Projects), which is a curated collection of project ideas for developers. We’ll walk through building this app step-by-step using AI assistants like ChatGPT, Claude, and Cursor. The output will be a functional web app with alarms, snooze, repeat options, and responsive design that works on mobile, tablet, and desktop.

We'll focus on practical implementation using local storage for data persistence, smooth animations for active alarms, and support for both light and dark modes. You’ll learn how to test each feature, fix common bugs, and deploy your app free to GitHub Pages or Netlify.

What you need

  • Access to an AI coding tool like ChatGPT, Claude, or Cursor
  • A code editor (VS Code, Cursor, or any IDE)
  • Basic knowledge of HTML, CSS, and JavaScript
  • Browser for testing the final app
  • Optional: Vite or Node.js installed locally if building React project
  • GitHub account for deploying to GitHub Pages

The full prompt

Build ZenClock - A Minimalist Alarm Clock Application

Tech Stack: React with Vite or single HTML file with localStorage, no backend required

- Set alarms with specific time or countdown timer functionality
- Play customizable alarm sounds with volume control
- Visual clock display with date and time in digital format
- Add multiple alarms with unique labels and snooze options
- Snooze functionality that delays alarm for 5 minutes
- Delete or edit existing alarms from the list
- Responsive design that works on mobile, tablet, and desktop
- Local storage persistence to save alarms between sessions
- Dark/light mode toggle with system preference detection
- Visual alarm animation with pulsing effect when active
- Set repeating alarms (daily, weekly, custom days)
- Clear visual distinction between active and inactive alarms
- Alarm history tracking with timestamps
- Optional vibration notification for mobile devices

Visual Design: Clean modern interface with soft blue color scheme (#4A90E2) as primary, white background, and dark gray text (#333333). Typography uses Roboto or similar sans-serif fonts with large, clear numbers for time display. Layout features a centered clock with alarm list below, smooth transitions between states, and subtle hover effects on interactive elements. Animations include gentle pulsing for active alarms and fade-in effects for new alarms.

User Flow: Main clock view shows current time, users can add alarms through modal form, alarms appear in list with status indicators, clicking alarm toggles snooze/delete options, dark/light mode switcher in header.

Data Handling: State management for current time, alarms array, active alarm tracking, user preferences. All data stored in localStorage with automatic synchronization.

Responsive Requirements: Mobile-first design with touch-friendly controls, adaptive grid layout, readable text sizes on all devices, optimized touch targets.

Accessibility: ARIA labels for screen readers, keyboard navigation support, sufficient color contrast, focus indicators, and voice control compatibility.

Output: Single HTML file with embedded CSS/JS or complete React/Vite project structure with package.json, src directory containing components, and README with run instructions.

1Choose an AI Tool and Paste the Prompt

Start by selecting one of the recommended AI tools, ChatGPT, Claude, Cursor, Lovable, or Bolt. For this tutorial, I recommend using Cursor or Claude, as they are good at generating full React projects with clear component structure.

Paste the full prompt above directly into your chosen tool’s input box. Make sure to set the output format to either a single HTML file or a Vite project if the tool offers that choice. Avoid selecting backend or Node.js options unless specifically required by the prompt.

Once you paste the prompt, wait for the AI to generate code. If it starts off with a React/Vite structure, that’s fine, we’ll adjust it for a single HTML file later if needed.

AI coding assistant generating the Alarm Clock code
AI coding assistant generating the Alarm Clock code

Pro tip: Use tools like Cursor or Bolt for better control over output format and debugging support.

2Generate and Review the Initial Code Output

After pasting the prompt, review the AI’s output carefully. If it gives you a React/Vite project, make sure it includes components for clock display, alarm list, form input, and dark mode toggle.

If the output is too complex or doesn’t match what we want, ask the AI to simplify it into a single HTML file with embedded JS and CSS. This makes local testing easier.

You should see structure like:

  • A clock display showing time and date
  • An alarm form modal for adding alarms
  • A list of alarms with delete/edit/snooze options
  • localStorage usage to persist alarms between sessions

Check that it uses the soft blue color scheme (#4A90E2) as specified in the prompt.

Pro tip: Ask AI to break down components and add comments for better readability.

3Save Code Locally and Run It

Save the generated code into a file named index.html. Open it directly in your browser to test the basic functionality. If you're working with React, use npm run dev or vite to start the development server.

Test that:

  • The clock updates every second
  • You can add an alarm via modal
  • Alarms show up in the list
  • Snooze and delete buttons work
  • Dark mode toggle switches between themes

Make sure all components render correctly, and there are no console errors. If you notice missing elements or layout issues, go back to the AI tool and refine the prompt.

Pro tip: Always run your code locally first before trying to deploy.

4Implement Local Storage for Alarm Persistence

One of the key requirements in the prompt is local storage persistence. Ensure that alarms are saved and restored across browser sessions.

In your HTML or React app, look for localStorage.setItem() calls when creating or deleting alarms. You should also use localStorage.getItem() to restore alarms on page load.

Test this by:

  • Adding an alarm
  • Refreshing the browser
  • Confirming the alarm is still there

If local storage isn't working, ask the AI to add a debug log or fix any incorrect syntax in data handling.

Pro tip: Use JSON.stringify() and JSON.parse() when saving/restoring complex objects.

5Add Visual Feedback and Animations

The prompt requires visual alarm animations such as a pulsing effect for active alarms. Add CSS transitions or keyframe animations to indicate when an alarm is ringing.

For example:

.alarm-active {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

Also ensure that:

  • Active alarms are visually distinct from inactive ones
  • New alarms fade in smoothly
  • The snooze button delays the alarm for 5 minutes

Test with multiple alarms to confirm they behave correctly.

Pro tip: Use CSS animations sparingly but effectively to improve UX without slowing down performance.

6Fix Bugs and Add Missing Features

As you test the app, you may notice issues such as:

  • Alarms not playing sound
  • Repeat options not saving correctly
  • Incorrect time formatting in UI
  • Dark mode toggle not persisting

To fix these, ask your AI tool to correct or enhance specific parts. For example:

> "Fix the alarm sound so it plays on active alarms"

Or:

> "Ensure repeat days are saved and displayed properly in the alarm list"

Always test each change thoroughly before moving forward. Add more features like vibration support if targeting mobile users.

Pro tip: Keep a running list of issues you find during testing to prioritize fixes.

7Test Responsive Design and Accessibility

Ensure the app works on all devices by testing:

  • Mobile touch targets are large enough (minimum 48px)
  • Layout adapts to different screen sizes
  • Keyboard navigation is supported
  • ARIA labels are present for screen readers
  • Focus indicators are visible

In your AI prompt, add a note like:

> "Make sure the app is fully responsive and accessible"

If needed, ask the AI to inject media queries or accessibility attributes. Use tools like Chrome DevTools to simulate mobile views and test tab navigation.

Pro tip: Use semantic HTML elements and ARIA roles to improve screen reader compatibility.

8Deploy Your App for Free

To deploy your app, use GitHub Pages or Netlify. First, push your code to a new GitHub repository.

Then go to:

  • GitHub > Settings > Pages > Source > Deploy from a branch (select main)

Or:

  • Upload the index.html file to Netlify via drag-and-drop or CLI

Once deployed, visit the live URL and make sure all features work correctly. The app should load without errors and retain alarm data between visits.

You can also use Vercel for deployment if you prefer using React with Vite.

Pro tip: Use GitHub Pages or Netlify for easy free deployment with automatic builds.

9Optimize Performance and Polish UI

Optimize your app’s performance by:

  • Minimizing re-renders in React if used
  • Using efficient CSS selectors
  • Compressing images or assets
  • Reducing unnecessary DOM elements

Polish the UI with:

  • Consistent spacing and alignment
  • Typography hierarchy using Roboto or similar fonts
  • Hover and focus states for buttons
  • Clear visual feedback on user actions

Test again after optimization to ensure no regressions were introduced.

Pro tip: Avoid inline styles in React apps; use CSS modules or styled-components instead.

10Verify All Features Are Working as Expected

Before finishing, verify each feature listed in the prompt:

  • Set alarms with specific time or countdown timer
  • Play customizable alarm sounds with volume control
  • Visual clock display with date and time in digital format
  • Add multiple alarms with labels and snooze options
  • Delete or edit existing alarms
  • Responsive design for mobile, tablet, desktop
  • Local storage persistence
  • Dark/light mode toggle
  • Visual alarm animation when active
  • Set repeating alarms (daily, weekly)

If anything fails, go back to your AI tool and ask it to correct or add missing parts. Double-check that all icons, animations, and interactions behave as expected.

Alarm Clock main dashboard view
Alarm Clock main dashboard view

Pro tip: Use browser dev tools to simulate real-world usage and edge cases.

11Document and Share Your App

Create a README file with:

  • How to run the app locally
  • Explanation of features
  • Notes on how it works
  • Any limitations or known issues

Then share your project in open-source communities, GitHub, or social media. You’ve built a fully functional alarm clock using AI assistance, great job!

The final result will be an interactive web app that meets all requirements from the prompt. It’s lightweight, responsive, and ready to use.

Pro tip: Include screenshots in your README for better clarity when sharing with others.

Adapt it to your own brand

  • Change color scheme by updating CSS variables or replacing primary color (#4A90E2) with a brand palette
  • Swap out alarm sounds with custom audio files or Web Audio API
  • Add timezone support to handle global time zones
  • Integrate mobile-specific features like vibration APIs or push notifications
  • Modify the UI layout to fit different design systems (Material, Tailwind, Bootstrap)
  • Support multiple languages through i18n libraries
  • Allow users to customize alarm labels and icons

Common mistakes and fixes

  • Forgetting to initialize local storage data before using it, fix by checking if data exists before parsing
  • Using inline styles instead of CSS classes in React, fix by switching to modular CSS or styled-components
  • Not testing responsive behavior on real devices, fix by using browser dev tools or emulator
  • Missing accessibility attributes like aria-labels or role tags, fix by adding ARIA support manually
  • Incorrect time formatting causing alarms to not trigger, fix by standardizing date/time parsing logic
  • Failing to save alarm state after edits, fix by ensuring every action triggers a save to localStorage

Frequently asked questions

Can I build this app using just HTML/CSS/JS?

Yes, the prompt allows for either a single HTML file with embedded CSS/JS or a React/Vite project. We recommend starting with HTML for simplicity.

How do I make sure alarms persist between browser sessions?

Use localStorage to store alarm data as JSON strings and parse them on page load.

What tools work best for building this type of app?

Tools like Cursor, Claude, and ChatGPT are great for generating full apps from prompts.

How do I test alarms triggering correctly?

Use browser console logs or set timeouts to simulate alarm events during testing.

Final thoughts

You’ve now built a fully functional minimalist alarm clock using AI tools. The app includes all the core features from the prompt: alarms, snooze, repeat, dark mode, and responsive design. You can extend this further by adding sound customization, vibration support, or internationalization.

To continue learning more, copy the prompt above and try building variations of it, like a timer or stopwatch. The possibilities are endless when you combine AI coding assistants with project ideas from resources like Mega Project List (karan/Projects).

Originally published on PromptGrabber.com — find thousands more AI prompts there.