TURNING SLEEP INTO A FUN COMPETITION

DreamRank

Akhmad Aji Permadi
As a Researcher & iOS Developer

banner

Scroll to explore ↓

What if building healthy sleep habits felt less like discipline and more like a game you want to win?

DreamRank transforms sleep into a lighthearted competition, motivating people to sleep better.

DIVE INTO THE PROBLEM

Why good sleep is hard, even when we know better?

Research clearly shows how sleep affects focus, mood, and long-term health. Most people already understand what improves sleep quality: consistent schedules, sleep before midnight, proper routines.

Yet in reality, knowledge rarely turns into action.

As a researcher, I explored this gap between knowing and doing. Our findings revealed a recurring pattern:

  • Low emotional engagement
  • No immediate reward loop
  • Habits that feel isolated and boring

Statistically, people didn’t fail because they lacked information. They failed because nothing made them want to keep going.

This insight shaped every design and technical decision that followed.

DESIGNING THE SOLUTION

Once the core issues were clearly defined, I began shaping a solution that was both practical and motivating.

Rather than treating good sleep habit as a task people should do, I reframed it as something they could look forward to. Through my research, I found that gamification, particularly competition, can significantly increase motivation and habit consistency. Building on this insight, I worked closely with my team to design a system that transforms healthy sleep behaviors into engaging experiences.

DreamRank doesn’t teach sleep.
It makes you want to win at it.

Sleep Competition

A daily challenge where users complete three sleep quests to earn points, climb the leaderboard, and compete with friends in a fun, motivating way.

feature-competition

Personal Progress

A non-competitive path that rewards users with experience points for completing seven scientifically proven sleep quests, helping them track personal improvement over time.

feature-personalprogress

LSEQ Evaluation

A built-in self-evaluation using the Leeds Sleep Evaluation Questionnaire to help users assess subjective sleep quality and monitor changes.

feature-lseq

MVVM & HIGH-LEVEL ARCHITECTURE DESIGN

An overview of how I applied MVVM and high-level system design principles to build a scalable, maintainable, and easy-to-reason-about iOS application.

As an iOS developer, I chose MVVM as the core architecture to ensure a clear separation of concerns and long-term maintainability. This approach allows UI logic, business logic, and data handling to evolve independently while keeping the codebase easy to test and reason about.

I structured the app into three distinct layers, each with a clearly defined responsibility:

  • Presentation Layer
    Focused on UI rendering and UI-related logic, with ViewModels managing state, user interactions, and data binding.
  • Business Layer
    Implemented using Repositories to encapsulate business rules and application logic, keeping them isolated from the UI.
  • Data Source Layer
    Responsible for data access and integrations, including a CloudKit Manager for syncing user data and a HealthKit Manager for fetching sleep data.
hld

DATA ENTITIES & RELATIONSHIPS

Data Comes First: Designing Entities Before Features

Well-structured data is the foundation of any scalable system. Before building features, I carefully designed the data entities and their relationships to ensure clarity,performance, and long-term maintainability while keeping user privacy at the core.

Because the app uses CloudKit for data persistence, I intentionally separated data into private and shared domains based on access requirements and ownership.

  • Private Data
    Stores user-specific information such as first name, last name, and email. These records live in the user’s private CloudKit database and are never exposed to other users.
  • Shared Data
    Stores competition-related data that enables leaderboards and ranking comparisons across users.

To protect user privacy, no raw health data is stored in CloudKit. All sleep data is processed and validated on-device via HealthKit, and only the resulting scores from completed daily quests are saved to the cloud.

erd

CLOUDKIT INTEGRATION

Users never notice syncing,
unless it breaks.

To support real-time leaderboard updates, the app needed a reliable way to stay in sync with CloudKit. My initial approach was interval-based fetching, where the app periodically retrieved data from the cloud.

While this worked functionally, it introduced unnecessary overhead. The app performed frequent network and database operations even when no data had changed, making the approach inefficient.

Recognizing these limitations, I explored a more event-driven solution and adopted CloudKit Subscriptions.

With subscriptions in place, the device fetches data only when relevant changes occur, such as updates to competitions the user has joined instead of polling the database at fixed intervals.

This approach significantly reduced redundant network requests, improved data consistency, and delivered a seamless syncing experience that stays invisible to users.

RESULT

What’s next:
Building with users, not just for them.

finalshowcase

Following the first TestFlight release, more than 20 early users onboarded and actively used DreamRank. I collected and analyzed their feedback to identify usability issues, edge cases, and opportunities to improve the overall experience.

This feedback directly informed bug fixes, performance optimizations, and refinements across key user flows. Through multiple iterations, the app matured from an experimental build into a stable, production-ready product.

Today, DreamRank is available on the App Store, with ongoing development guided by real user behavior and continuous feedback rather than assumptions.

Scan the QR code below to download it directly.

DreamRank-qr.png
Back to Top