← 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.
Files
import type { QueryClient } from '@tanstack/react-query'
import type { Visitor } from './auth.ts'
import type { Item } from './data/items.ts'
/** Server and browser each provide this; routes never care which one runs. */
export type AppApi = {
listItems: () => Promise<Array<Item>>
addItem: (text: string) => Promise<Item>
deleteItem: (id: string) => Promise<void>
}
export type RouterContext = {
queryClient: QueryClient
api: AppApi
visitor: Visitor | null
appBasePath: string
assetBasePath: string
clientModuleUrl: string | null
hostedUrl: string | null
dehydratedState?: unknown
}
export const itemsQuery = (api: AppApi) => ({
queryKey: ['items'],
queryFn: () => api.listItems(),
})