A comprehensive fitness and nutrition tracking application built with Flutter and Serverpod
Features β’ Quick Start β’ Architecture β’ Documentation β’ Contributing
FitBodyRD is a full-stack mobile application designed to help users achieve their fitness goals through personalized meal plans, workout routines, and comprehensive progress tracking. Built with modern technologies, it provides a seamless experience for managing nutrition, workouts, and overall health.
- π― Personalized Plans: AI-powered meal and workout plan generation
- π Progress Tracking: Comprehensive analytics and visualization
- π Nutrition Management: Food logging, macro tracking, and meal planning
- ποΈ Workout Management: Exercise database, session tracking, and progress monitoring
- π Secure Authentication: Email/password and Google OAuth integration
- π± Cross-Platform: Native iOS and Android support
- Meal Plan Generation: AI-powered personalized meal plans based on user goals
- Food Logging: Track consumed foods with serving sizes and nutritional information
- Macro Tracking: Real-time monitoring of calories, proteins, carbs, and fats
- Nutrition Dashboard: Daily nutrition overview with color-coded progress indicators
- Food Search: Search and add foods from an extensive database
- Meal Editing: Edit or delete logged meals with intuitive swipe gestures
- Workout Plans: View and follow personalized workout routines
- Exercise Database: Comprehensive exercise library with images, videos, and instructions
- Exercise Logging: Track completed exercises with sets, reps, and weights
- Progress Visualization: Charts and graphs showing exercise progression over time
- Workout History: Complete workout history with session details
- Statistics: Track streaks, averages, and workout frequency
- Home Dashboard: Personalized greeting with weekly summary metrics
- Today's Progress: Quick view of nutrition and workout status
- Weekly Summaries: Aggregated metrics for workouts and nutrition
- Progress Charts: Visual representation of exercise progression
- Workout Metrics: Streaks, totals, and frequency analysis
- Multi-step Onboarding: Guided setup for body stats, goals, and preferences
- Profile Management: View and manage user information
- Secure Authentication: Email/password and Google Sign-In
- Session Management: Secure token-based authentication
FitBodyRD follows a monorepo structure with three main components:
fitbodyrd/
βββ fitbodyrd_flutter/ # Flutter mobile application
βββ fitbodyrd_server/ # Serverpod backend server
βββ fitbodyrd_client/ # Auto-generated Serverpod client
βββ fitbodyrd_agent/ # AI agent documentation
Frontend (Flutter)
- Framework: Flutter 3.24.0+
- Language: Dart 3.5.0+
- State Management: BLoC (flutter_bloc) with Cubit pattern
- Dependency Injection: GetIt
- Routing: GoRouter
- Architecture: Clean Architecture (Data β Domain β Presentation)
Backend (Serverpod)
- Framework: Serverpod 2.9.2
- Database: PostgreSQL 16 with pgvector extension
- Cache: Redis 6.2.6
- Email: Resend (via easy_resend)
- Architecture: Feature-based modular architecture
Communication
- Type-safe RPC calls via Serverpod protocol
- Auto-generated client code for type safety
- Flutter SDK: >=3.24.0
- Dart SDK: >=3.5.0 <4.0.0
- Docker & Docker Compose: For local databases
- PostgreSQL 16 with pgvector extension
- Redis 6.2.6+
-
Navigate to server directory
cd fitbodyrd_server -
Start database services
docker compose up --build --detach
-
Install dependencies
dart pub get
-
Configure environment
- Edit
config/development.yaml - Add
config/passwords.yaml(not in git) - Configure Google OAuth in
config/google_client_secret.json
- Edit
-
Run server
dart bin/main.dart
Server runs on:
- API:
http://localhost:8080 - Insights:
http://localhost:8081 - Web:
http://localhost:8082
- API:
-
Navigate to Flutter directory
cd fitbodyrd_flutter -
Install dependencies
flutter pub get
-
Configure environment
- Create
.envfile (seefitbodyrd_flutter/README.mdfor template) - Set
SERVERPOD_URL, Google OAuth credentials - Generate env code:
reload_env.sh
- Create
-
Run app
flutter run
The client package is auto-generated by Serverpod. Regenerate after backend changes:
cd fitbodyrd_server
serverpod generatefitbodyrd/
β
βββ fitbodyrd_flutter/ # Flutter mobile application
β βββ lib/
β β βββ features/ # Feature modules (Clean Architecture)
β β β βββ auth/ # Authentication
β β β βββ onboarding/ # User onboarding flow
β β β βββ nutrition/ # Nutrition tracking & meal plans
β β β βββ workouts/ # Workout management
β β β βββ profile/ # User profile
β β β βββ splash/ # Splash screen & routing
β β βββ src/
β β βββ app/ # App configuration
β β βββ core/ # Shared utilities
β βββ assets/ # Images, icons, etc.
β
βββ fitbodyrd_server/ # Serverpod backend server
β βββ lib/
β β βββ server.dart # Server entry point
β β βββ src/
β β βββ features/ # Feature modules
β β β βββ auth/ # Authentication setup
β β β βββ email/ # Email services
β β β βββ exercise/ # Exercise database
β β β βββ food/ # Food database
β β β βββ nutrition/# Nutrition tracking
β β β βββ nutrition_plan/ # Meal planning
β β β βββ user/ # User management
β β β βββ workouts/ # Workout management
β β βββ generated/ # Serverpod generated code
β βββ config/ # Environment configs (YAML)
β βββ migrations/ # Database migrations
β βββ docker-compose.yaml # Local dev database setup
β
βββ fitbodyrd_client/ # Auto-generated Serverpod client
β βββ lib/src/protocol/ # Generated protocol code
β
βββ fitbodyrd_agent/ # AI agent documentation
βββ meal_plans_agent/ # Meal plan generation agent
- PROJECT_CONTEXT.md - Comprehensive project context and architecture guide
- DEVELOPMENT_ROADMAP.md - Development progress and roadmap
- Flutter App README - Flutter app setup and development guide
- Server README - Backend server setup and API documentation
- Client README - Client package information
- Meal Plans Agent - AI meal plan generation agent
- Modify endpoint/model files
- Generate code:
cd fitbodyrd_server serverpod generate - Create migration if schema changed:
serverpod create-migration
- Client package auto-updates
- Follow Clean Architecture structure
- Add new features in
features/directory - Register dependencies in
injection_container.dart - Add routes in
app_router.dart
- Migrations auto-apply on server start
- Review migration files before committing
- Test migrations in test environment first
cd fitbodyrd_server
dart testcd fitbodyrd_flutter
flutter test- Separate PostgreSQL instance on port
9090 - Configured via
config/test.yaml
cd fitbodyrd_flutter
flutter build apk --release
# or
flutter build appbundle --releasecd fitbodyrd_flutter
flutter build ios --releaseFlutter App (.env file):
ENVIRONMENT- Environment nameSERVERPOD_URL- Backend API URLGOOGLE_REDIRECT_URL- OAuth redirectGOOGLE_SERVER_CLIENT_ID- Server OAuth client IDGOOGLE_CLIENT_ID_ANDROID- Android OAuth client IDGOOGLE_CLIENT_ID_IOS- iOS OAuth client ID
Backend Server (config/*.yaml):
- API server ports and hosts
- Database connection (PostgreSQL)
- Redis connection
- Authentication settings
- Email service (Resend) configuration
The app uses a custom design system with:
- Material Design 3 theme
- Google Fonts for typography
- Custom color scheme with brand colors
- Consistent spacing utilities
- Spanish localization as primary language
- Secure Storage: User credentials stored with
flutter_secure_storage - JWT Tokens: Secure session management via Serverpod Auth
- Password Hashing: Bcrypt-based secure password hashing
- SQL Injection Protection: Parameterized queries via Serverpod ORM
- Environment Isolation: Separate configurations for dev/staging/prod
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Clean Architecture principles
- Write tests for new features
- Update documentation as needed
- Follow the existing code style
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Create an issue in the repository
- Review PROJECT_CONTEXT.md for detailed information
Made with β€οΈ using Flutter and Serverpod