Habit tracker built with React + TypeScript + Vite.
It lets you create custom habits, mark daily completions, browse progress on a calendar, and recover/sync data with a short code.
- Custom habits (name + color)
- Daily completion tracking
- Calendar view with logged-day indicators
- Recovery code flow for restoring/syncing data
- Local cache fallback per recovery code
- React 19
- TypeScript (strict mode)
- Vite
- React Query
- Supabase
- Tailwind CSS 4
- Vitest + Testing Library
- Install dependencies:
npm ci- Create
.env(or copy from.env.example) with:
VITE_SUPABASE_CO=...
VITE_SUPABASE_ANON=...
# optional
VITE_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=...- Start dev server:
npm run devCodebase is organized by clear boundaries:
src/views,src/layouts: route compositionsrc/components: reusable/presentational UIsrc/hooks: view-model and UI logicsrc/providers: app-level orchestration/contextsrc/entities: domain data hooks + contractssrc/lib: integration layer (Supabase, QueryClient)src/utils: pure helpers
Data flow:
- UI event in component
- Hook transforms UI intent
- Provider action runs mutation/query
- Entity hook calls Supabase client
- React Query cache invalidates and refetches
- Provider syncs latest data into localStorage cache per recovery code
More detail:
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Type-check and production build |
npm run preview |
Preview production build |
npm run test |
Run test suite |
npm run test:watch |
Run tests in watch mode |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
npm run format:check |
Validate formatting with Prettier |
npm run depcheck |
Check for unused dependencies |
npm run lint:all |
Lint + format check + dependency check |
- Type safety:
tsconfigstrict checks - Linting/formatting: ESLint + Prettier
- Unit/integration tests: Vitest + Testing Library
- CI workflow: lint, test, build, deploy