All projects

Your daily habits, on the phone and nowhere else.

No account, no server and no connection: everything lives in a SQLite on the phone. It is React on Lynx, packaged as a native Android app with Sparkling, TikTok’s shell.

Download APK 1.16
Other versions
See the repository

74 MB · Android 7.0 or later · arm64 and armv7 · signed · MIT license

Tuesday, November 10

Ana, you have 2 of 555 %

  • Drink water2 / 2 liters
  • Exercise0 / 30 minutes
  • Read20 / 20 pages
  • Meditate7.71 / 10 minutes
  • Sleep early0 / 1 time

Press and hold a habit to record a part.

The five sample habits the app starts with. It works as on the phone: a tap marks, a long press records a part and the bar below switches screens.

The same product, rewritten four times

Rebuilt on purpose with four different architectures to learn each stack in depth, on a domain I already knew.

  1. Kivy / FletReplaced
  2. NiceGUI + SurrealDBReplaced
  3. FastAPI + SvelteKit 5Replaced
  4. React on Lynx, with SparklingIn service

What it does

A tap marks or unmarks a habit. A long press on the row opens the partial entry —did you read 15 of 20 pages?— and the habit's ring fills in proportion. Habits are edited and deleted by swiping the row, and completing the day sets off an achievement animation.

The calendar paints each day in its traffic-light color and filters by habit. The analysis covers 7, 14 or 30 days, a month or a year, compares against the previous period and draws eight zoomable SVG charts. Reminders arrive at one or several times of day, picked with a custom selector, and backups go to Downloads as JSON.

October's calendar in Marco: each day colored red, amber, green or mint by its completion
Calendar: each day in its traffic-light color; tapping one opens its progress.
Marco's ranking per habit and habit wheel, with the 82% average in the center
The ranking per habit and the wheel, with the average in the center.
Marco's time selector in a bottom sheet, with 22:00 picked
The custom time selector, in a bottom sheet.

Screenshots with sample data, not real: the profile “Ana”, with the five habits the app seeds and a history generated with scripts/datos-demo.py. The app's interface is in Spanish.

How it is built

All the business logic lives in src/api/ against SQLite, one file per area —profile, habits, entries, calendar, analysis, categories, seed— with marco.ts as the barrel. The bridge src/db/native.ts only serializes and deserializes: it holds no logic.

On the Android side, MarcoDbHelper.kt defines the schema and NativeDatabaseModule.kt runs the queries. The daily reminder is four classes on top of AlarmManager —NativeReminderModule, ReminderScheduler, ReminderAlarmReceiver and BootReceiver— because surviving a phone restart is not free. LynxInputComponent.kt is a custom <input>.

Creating the profile brings five sample habits with their categories, so no screen starts empty.

Counted from the repository

lines of TypeScript
6,146
lines of Kotlin
950
custom SVG charts
8
servers involved
0

What it is made with

  • React on Lynx · PrimJS
  • Sparkling (TikTok)
  • TypeScript
  • Kotlin
  • SQLite
  • AlarmManager
  • vitest

What it cost on the device

Lynx is a young runtime and its JavaScript engine, PrimJS, is not the browser. These seven cannot be worked out by reading the code: each came from a real failure and was documented in its file.

  • Writing the native module is not enough

    It has to be registered in SparklingApplication.kt through SparklingLynxConfig.Builder.addLynxModules(...). Without that, NativeModules.<Name> simply does not exist on the JS side.

  • <svg> is not part of the Lynx core

    It is a separate X-Element, org.lynxsdk.lynx:xelement-svg, forced to version 3.7.0 in build.gradle.kts and registered by hand. The eight charts depend on it.

  • No code splitting

    A lazy import compiles into a separate Lynx bundle that does not inherit the global CSS: invisible text and screens that would not swap. The router goes without lazy on purpose.

  • The main thread cannot see data structures

    Inside a 'main thread' handler only numbers arrive. Walking a table declared at the top of the file blows up silently, with no exception and no log.

  • touchstart arrives late and touchend sometimes never arrives

    Inside a scroll-view the event is delivered once the gesture can no longer be a scroll; and if a modal mounts on top, the row that opened it never gets the end of the gesture. Hence the custom swipe component.

  • <input> ignores CSS color

    The text color goes through the text-color prop, not the stylesheet. Centralized in src/lib/colors.ts so it does not trip me again.

  • No Intl

    PrimJS does not guarantee internationalization support, so date formatting is manual in src/lib/date.ts. No toLocaleDateString.

What is missing

  • iOS is not configured: it is a decision, Android only for now.Pending
  • It has been tested on a single phone model, a Galaxy S23 Ultra.Pending
  • The package identifier is still the scaffold's, com.example.sparkling.go.Pending
  • Backups are exported as plain JSON, unencrypted.Pending

Install it on your Android

74 MB · Android 7.0 or later · arm64 and armv7 · signed · MIT license

New in 1.16

  • A night style across the whole app, made for reviewing the day in low light.
  • A renewed Analysis: the period against the previous one, the daily line and the ranking per habit.
  • Reminders at several times of day, picked with a custom selector.
  • Settings reorganized as a grouped list.

It installs outside the store: Android will ask permission to install apps from this source.

Let’s talk

Curious how something here is solved, or have a similar problem?