Skip to content

Instantly share code, notes, and snippets.

@csain
Last active July 29, 2025 17:47
Show Gist options
  • Save csain/2c09368bcde85b7da6debe7a759cc82c to your computer and use it in GitHub Desktop.
Save csain/2c09368bcde85b7da6debe7a759cc82c to your computer and use it in GitHub Desktop.
Project: Daily Habit Challenge

Daily Habit Challenge

Overview

What: A daily habit challenge app for Android.

Tech Stack

  • Front-end: Jetpack Compose (Kotlin)
  • Back-end: Kotlin

Features

  • personalized challenge with fixed number of days
  • custom units for daily progress tracking
  • full progress tracking view

Links

Habit Challenge Schema

This schema supports a simple habit challenge app where users commit to completing a set of tasks daily over a fixed number of days.


Database Overview

A Challenge is a fixed-length commitment of a set of ChallengeTasks. For example, the Challenge may last 21 days and include 3 ChallengeTasks:

  • Walk 10K steps
  • Drink 8 glasses of water
  • Study 45 minutes

Each day, the user sees the same list of tasks, DailyTaskItems, which are grouped in the DailyTaskList for that day.

The schema is designed to record consistency and progress without changing the challenge once it starts.


Database Details

This schema is implemented using SQLite, the native local database engine on Android devices.
Data access is managed using the Room persistence library. This is optimal for offline-first, local storage of structured data in Android apps.


ER Diagram

erDiagram
    CHALLENGES {
        Long id PK
        Int numDays
        Date startDate
        Date stoppedAt
        Date completedAt
    }

    CHALLENGE_TASKS {
        Long id PK
        Long challengeId FK
        String title
        String unit
        Float amount
    }

    DAILY_TASK_LISTS {
        Long id PK
        Long challengeId FK
        Date date
        Int numDay
        Date completedAt
    }

    DAILY_TASK_ITEMS {
        Long id PK
        Long dailyTaskListId FK
        Long challengeTaskId FK
        Float progressAmount
        Date completedAt
    }

    CHALLENGES ||--o{ CHALLENGE_TASKS : has
    CHALLENGES ||--o{ DAILY_TASK_LISTS : contains
    DAILY_TASK_LISTS ||--o{ DAILY_TASK_ITEMS : includes
    CHALLENGE_TASKS ||--o{ DAILY_TASK_ITEMS : used_by


Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment