Sleep Log App
Build an Android app in Kotlin for keeping a sleep diary: each morning you log when you went to bed and when you woke up (sleep that crosses midnight is handled correctly), and optionally how well you slept on a scale from 1 to 5. The app shows each night's duration, your average for the week, the difference between weekdays and weekends, and a simple bar chart of the last 7 nights. Everything is stored on the phone with Room, and the screens are built with Jetpack Compose. It's a good first Android app: you'll learn Room, working with dates and times using java.time, forms with validation, calculations over a list of records, and a simple chart.
- Estimate
- ~9.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
Jetpack Compose · Room
Project roadmap
- 01
Plan the data and screens
~1hWrite README.md: an entry has a bedtime, a wake-up time (both date and time), an optional quality from 1 to 5 and a note; the screens are the list of nights, adding and editing an entry, and a weekly summary. Define exactly how a night's duration is calculated when it crosses midnight. Create a Compose project with Room. Done when: the app runs, and README.md describes the data and rules.
- 02
Store entries with Room
~1.5hCreate a Room entity with the times stored as epoch milliseconds (or with type converters for java.time types), a DAO with queries returning Flow (all entries newest first, and entries in a date range), and a repository. Done when: DAO tests with an in-memory database pass.
- 03
Build the entry form
~2hBuild a form with date and time pickers for bedtime and wake-up, quality buttons and a note. Validate: the wake-up time must be after bedtime, the sleep must be between 1 and 16 hours, and an entry can't overlap an existing one. Pre-fill with last night's usual times. Done when: valid entries are saved, and invalid ones show clear messages.
- 04
List the nights
~1.5hShow the entries in a list with the date, bedtime and wake-up time, the duration as hours and minutes, and the quality. Tap to edit, swipe to delete with Undo. Show a friendly empty state. Done when: the list updates immediately when entries change.
- 05
Show the weekly summary
~2hWrite pure Kotlin functions for the average duration and quality for the last 7 nights, the weekday and weekend averages, and the shortest and longest nights. Show them on a summary screen with a bar chart of the last 7 nights drawn with Compose Canvas (or simple rows of bars), with a line for your target sleep time. Done when: the summary numbers and chart match the entries.
- 06
Test it
~1.5hWrite unit tests for the duration calculation (including crossing midnight and daylight saving changes), the validation rules, and the summary averages with fixed dates, plus ViewModel tests with a fake repository. Done when: all tests pass.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack