Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@kody/example-habit-log

A small habit log app built from the app starter: indigo theme, mobile layout, sign-in, and saved entries.

FollowFork

Files

AGENTS.md

46 lines · 1.9 KB · Markdown

Habit log: agent notes

An example built from @kody/app-starter. Only app/content/site.ts, public/tokens.css, and package.json differ from the starter.

Start with search({ entity: "guide:making_great_apps" }). Ask the person who the app is for before you change anything.

No build step

Starters must work with no local build step. Kody bundles the source on publish, so edit and republish source files directly (packageSave or a git push, then publish). Keep the app buildless: no bundler config, no build scripts, no TanStack Start. Use TanStack Router, Query, and Form from dependencies.

Where to work

  • app/content/site.ts: names, copy, and sample text.
  • public/tokens.css: the shared theme tokens (--color-*, --font-sans, --radius, --space-1 to --space-4) for light and dark. Style everything with these names.
  • app/routes/: one file per page. Add the route to app/router.tsx.
  • app/data/: storage helpers. packageStorage() keys are per signed-in person (items:<userId>).
  • app/components/ui.tsx: Button, TextField (always labeled), Alert, LoadingRows, EmptyState. Reuse them for new pages.

How it fits together

  • app/server.tsx is the kody.app.entry fetch handler. It serves /health, the JSON API under /api/, and server-renders every page.
  • app/client.tsx hydrates the same router in the browser.
  • Sign-in reads the verified X-Kody-Visitor header (app/auth.ts). Sign-in and sign-out links go to /-/auth/login and /-/auth/logout.
  • Every route has a pending state (LoadingRows), and the root route has an error state with a retry button and a not-found page.

Smoke tests

  • kody dev fetch /health returns { "ok": true }.
  • kody dev fetch / and /items return HTML with a <main id="main">.
  • kody dev fetch /api/items returns 401 when signed out.

After you build

Run kody app check and fix what it shows.