A modern, cross-platform fitness tracking application built with React Native and Expo. CoreSync helps users track workouts, manage exercises, and get AI-powered guidance for their fitness journey.
- Workout Tracking: Track active workouts with real-time timer, sets, reps, and weights
- Exercise Library: Browse and search through a comprehensive exercise database
- AI-Powered Guidance: Get detailed exercise instructions and tips using Google Gemini AI
- Workout History: View past workouts with detailed statistics and analytics
- User Authentication: Secure authentpication powered by Clerk
- Cross-Platform: Works on iOS, Android, and Web
- Modern UI: Beautiful, responsive interface built with Tailwind CSS and NativeWind
- State Management: Efficient state management with Zustand
- CMS Integration: Sanity CMS for managing exercises and workout data
- Expo (v53.0.4) - React Native framework for cross-platform development
- React Native (v0.79.4) - Mobile app framework
- React (v19.0.0) - UI library
- TypeScript - Type-safe JavaScript
- Expo Router (v5.1.0) - File-based routing system with API routes support
- Protected routes with authentication guards
- Clerk - Complete authentication solution with Google Sign-In support
- Zustand (v5.0.8) - Lightweight state management
- Persistent storage with AsyncStorage
- NativeWind (v4.0.1) - Tailwind CSS for React Native
- Tailwind CSS (v3.4.0) - Utility-first CSS framework
- Expo Linear Gradient - Gradient components
- Sanity CMS - Headless CMS for content management
- GROQ - Query language for Sanity
- Sanity Client - JavaScript client for Sanity
- Google Gemini AI - AI-powered exercise guidance
- Groq - AI inference platform
- Node.js (v18 or higher)
- npm or yarn
- Expo CLI (
npm install -g expo-cli) - iOS Simulator (for iOS development) or Android Studio (for Android development)
- Sanity account
- Clerk account
- Google Cloud account (for Gemini AI)
-
Clone the repository
git clone <repository-url> cd coresync
-
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in the root directory:# Clerk Authentication EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key # Sanity CMS EXPO_PUBLIC_SANITY_PROJECT_ID=your_sanity_project_id EXPO_PUBLIC_SANITY_DATASET=production EXPO_PUBLIC_SANITY_API_VERSION=2024-01-01 SANITY_API_TOKEN=your_sanity_api_token # Google Gemini AI GEMINI_API_KEY=your_gemini_api_key
-
Configure Sanity
Navigate to the sanity directory and install dependencies:
cd sanity npm installUpdate
sanity.config.tswith your project ID and dataset. -
Start the development server
npm start
-
Run on your preferred platform
- iOS:
npm run iosor pressiin the Expo CLI - Android:
npm run androidor pressain the Expo CLI - Web:
npm run webor presswin the Expo CLI
- iOS:
The app.json file is configured with:
- Output Mode: Set to
"server"for API routes to work (similar to Next.js) - Scheme: Custom URL scheme for deep linking
- Plugins: Expo Router plugin configured
The project uses two main schema types:
-
Exercise Schema (
sanity/schemaTypes/exercise.ts)- Exercise name, description, difficulty level
- Image and video URL
- Active status toggle
-
Workout Schema (
sanity/schemaTypes/workout.ts)- User ID (Clerk user ID)
- Workout date and duration
- Exercises with sets, reps, weights, and weight units
CoreSync uses Expo Router's API routes (similar to Next.js):
-
/api/ai(POST): Get AI-powered exercise guidance- Request body:
{ exerciseName: string } - Returns: Markdown-formatted exercise instructions
- Request body:
-
/api/save-workout(POST): Save workout to Sanity- Request body:
{ workoutData: WorkoutData } - Returns:
{ success: boolean, workoutId: string }
- Request body:
-
/api/delete-workout(DELETE): Delete a workout- Request body:
{ workoutId: string }
- Request body:
The app uses Expo Router's Stack.Protected component to guard routes:
- Authenticated users can access app tabs and exercise details
- Unauthenticated users are redirected to sign-in/sign-up screens
The workout state is managed using Zustand with persistence:
- Workout exercises and sets
- Weight unit preference (lbs/kgs)
- Persistent storage using AsyncStorage
Uses react-timer-hook to track workout duration:
- Auto-start timer when workout begins
- Track total seconds for workout duration
- Reset functionality
Uses GROQ (Graph-Relational Object Queries) for fetching data from Sanity:
- Type-safe queries with
defineQuery - Efficient data fetching with references
- Filtered and sorted results
npm start- Start the Expo development servernpm run ios- Run on iOS simulatornpm run android- Run on Android emulatornpm run web- Run on web browsernpm run deploy- Build and deploy the app
- Access Sanity Studio (usually at
http://localhost:3333) - Navigate to the Exercise schema
- Add new exercise with name, description, difficulty, and image
- Exercises will automatically appear in the app
API routes follow the Next.js convention:
- Create files with
+api.tsextension in theapp/api/directory - Export HTTP method functions (GET, POST, PUT, DELETE)






