$ show CodeWithCJ/SparkyFitness
SparkyFitness is a large, self-hosted fitness and health tracking platform. It is primarily an application: a full-stack monorepo with an Express + PostgreSQL backend, a React web frontend, a React Native/Expo mobile app, and a Python FastAPI Garmin microservice, all coordinated by a shared TypeScript package containing Zod schemas, constants, and domain algorithms. The product covers nutrition, workouts, sleep, fasting, mood, cycle/pregnancy, medications, symptoms, water intake, mindfulness, and health-provider data from Garmin, Fitbit, Withings, Oura, Polar, Strava, Google Health, and others. It also includes an AI chatbot with tool calling, barcode scanning, CSV/FIT imports, and native HealthKit/Health Connect sync. The dominant data flow is client hooks calling typed API service layers, which hit Express routes backed by PostgreSQL with row-level security. External wearable integrations refresh OAuth tokens under row locks and use provider sync claims to avoid duplicate imports. The mobile clients also directly read/write platform health stores, and a large migration set evolves the schema with careful backfills and deduplication. The repository is not a data-research repo; there are no analytical notebooks or dbt-style pipelines. Its character is clearly a production application with an unusually wide feature surface. The codebase shows strong engineering discipline: shared Zod schema triples, consistent TanStack Query key factories, central cache invalidation hubs, provider sync concurrency controls, and extensive Vitest/Jest tests, including regression tests pinned to GitHub issue numbers. The main risks are breadth-driven complexity: many external integrations, native iOS/Android/watch targets, manual patches to generated schemas, and some duplicated logic across web and mobile. Overall it is actively maintained, well-tested, and offers several genuinely reusable patterns.
The LLM identified 5 files worth highlighting for reuse:
Defines a pluggable engine contract for barcode scanning, with Html5Qrcode, Quagga, and Zxing implementations behind one interface. The abstraction is self-contained and can be extracted into any web or scanning project that needs vendor-agnostic barcode capture.
A pure utility for appending paginated results while removing overlapping duplicate items and preserving array identity. It is small, well-tested, and directly reusable in any TypeScript frontend that uses infinite queries or offset-based pagination.
Centralized outbound HTTP configuration with tuned timeouts and Happy Eyeballs handling for third-party provider APIs. It demonstrates a production approach to external API reliability and can be lifted into any Node.js service making many upstream HTTP calls.
A feature-registry pattern for TanStack Table v9, keeping table features modular instead of cramming them into component markup. This is a clean reusable pattern for complex data grids and can be adapted to other React projects using TanStack Table.
Implements nutrient calculation algorithms such as added sugar, fat breakdown, vitamin, and mineral calculations using multiple scientific profiles. The non-obvious health-domain logic is isolated enough to be ported to other nutrition applications.