Skip to content

Mobile apps · Expo

Habit tracker

Check off daily habits, see streaks and a seven-day history. Saved on the device with AsyncStorage.
Habit tracker starter, as built from its own files
Starter screenshot captured from this template's own web build (react-native-web) in a 390×844 phone viewport. In Codexa you can also open it on your phone with Expo Go.

What you get

A single-screen habit tracker: today's progress, a week strip to look back at any of the last seven days, habit rows with streaks and a mini history, and a form to add habits with an icon. Data persists with AsyncStorage (device storage on phones, localStorage on the web).

Files, exactly as copied.

Exactly what is copied into a new project: 14 files, nothing generated.

Raw data: GET /api/v1/templates/expo-habits

src/habits.ts
src/habits.ts
/** Habit data, date helpers and the sample habits a new install starts with. */export type Habit = { id: string; name: string; icon: HabitIcon; goal: string; done: string[] }; export type HabitIcon = "water" | "walk" | "book" | "leaf" | "barbell" | "moon" | "bicycle" | "musical-notes";export const ICONS: HabitIcon[] = ["water", "walk", "book", "leaf", "barbell", "moon", "bicycle", "musical-notes"]; /** YYYY-MM-DD in local time. */export function dayKey(d: Date): string {  const m = String(d.getMonth() + 1).padStart(2, "0");  const day = String(d.getDate()).padStart(2, "0");  return `${d.getFullYear()}-${m}-${day}`;} export function addDays(d: Date, n: number): Date {  const out = new Date(d);  out.setDate(out.getDate() + n);  return out;} /** The last seven days, oldest first, ending today. */export function lastSevenDays(today = new Date()): Date[] {  return Array.from({ length: 7 }, (_, i) => addDays(today, i - 6));} /** Consecutive days completed, counting back from today (or yesterday if today is still open). */export function streak(habit: Habit, today = new Date()): number {  const done = new Set(habit.done);  let cursor = done.has(dayKey(today)) ? today : addDays(today, -1);  let n = 0;  while (done.has(dayKey(cursor))) {    n++;    cursor = addDays(cursor, -1);  }  return n;} function seed(offsets: number[]): string[] {  const today = new Date();  return offsets.map((o) => dayKey(addDays(today, -o)));} export function sampleHabits(): Habit[] {  return [    { id: "h1", name: "Drink 2 litres of water", icon: "water", goal: "Every day", done: seed([1, 2, 3, 4, 5, 6]) },    { id: "h2", name: "10-minute walk", icon: "walk", goal: "Every day", done: seed([0, 1, 2, 4, 5]) },    { id: "h3", name: "Read 20 pages", icon: "book", goal: "Every day", done: seed([0, 2, 3, 6]) },    { id: "h4", name: "Lights out by 11", icon: "moon", goal: "Weeknights", done: seed([1, 3]) },  ];}

Remix

Remix this template.

Describe what to change and the agent starts from Habit tracker's files. The box is already started for you: finish “Start from Habit tracker and …”

Agent ready

Creates a free account first; your idea is carried over.

Dependencies

Documented from the template's package.json. The runtime has a prebuilt dependency set for Expo · React Native, so installs are fast.

  • expo~58.0.23
  • react19.3.0
  • react-native0.88.1
  • react-native-web~0.21.4
  • react-native-safe-area-context~5.11.1
  • @expo/vector-icons^15.0.2
  • @react-native-async-storage/async-storage2.2.0
  • typescript~6.0.3

How it runs

Framework
Expo · React Native
Dev command
npm run dev
Build command
npm run build
Output directory
dist
Port
8081
Entry route
/

Projects run in an isolated sandbox with a live preview. Read the projects documentation for settings, snapshots and deployment.

All templates

Build on Habit tracker

Create a free account, start from this template, and ask the AI agent to turn it into your app.