Return to site

Code a Happy Place Meditation App

Educators & parents: You can do this Hour of Code Activity as a class or students can work on it independently. If you have any questions or need help, email

Sometimes, coding can feel frustrating for kids (and grown-ups!). We might work really hard to create a project, but one small bug (coding mistake) can crash the whole thing. At times we might feel angry, discouraged, or sad. When we are emotionally charged, it can make it even harder to find and fix bugs.

Practicing mindfulness and meditation can help us improve focus and reduce stress. Through things like guided breathing, you can learn how to focus your attention to the present moment and calm the worried mind.

Research also shows that mindfulness can make us happier by permanently rewiring our brain. By focusing on the present moment and using our imagination, mindfulness can help us be less reactive to problems we face everyday (i.e. when your mic is not working on Zoom and you don't know why).

Today, you're going to be coding your own mindfulness app! First, you'll learn how to do a breathing and visualization exercise. In the video below, Olivia from Project Peaceful Warriors will guide you through a Happy Place breathing exercise-- a happy place is anywhere you'd like to go when you are feeling frustrated. We can go to our happy place by imagining the sounds, smells, and sights of that place. A happy place can be a specific location, like your bedroom. Or it can be a general location, like the beach or the forest. When we come back from our happy place, we'll be in a better mental state to find and fix our bugs.

Then, you'll program your own happy place! You can go back to this project anytime to help you imagine the sensations of your happy place. You can even create more than one happy place so you have options to choose from when you are feeling you need it.

To program your app, you'll need to go to Scratch:

Your final project might function like this example, but the happy places in yours will be unique to you and your preferences!

Click on the buttons to go to each happy place. After trying each button, how do you feel?

Ok, let’s get coding! Watch the video below to see Olivia’s Happy Place guide, and then follow along with me to build your own mindfulness app:


Want to go beyond Hour of Code and make another Mindfulness app? Check out this tutorial on breathing techniques and build an app to go with it. Or, if you liked Scratch and you're already feeling happy, spread the love by making someone a digital birthday card or programming a loved one a special message.

If you had fun, check out our YouTube channel for more free coding projects like these! Go to