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