First off, thank you for considering contributing to MediDiet AI! It's people like you that make MediDiet AI such a great tool for helping people manage their nutrition and health.
- Code of Conduct
- What Should I Know Before I Get Started?
- How Can I Contribute?
- Development Setup
- Development Workflow
- Style Guidelines
- Pull Request Process
- Community
This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to support@medidiet.app.
For the full Code of Conduct, please read CODE_OF_CONDUCT.md.
MediDiet AI is a React Native mobile application that provides AI-powered personalized nutrition management for individuals with medical conditions. The app uses Google's Gemini API to generate meal plans tailored to specific health needs.
Key Technologies:
- React Native 0.79.3
- Expo ~53.0.9
- TypeScript 5.8.3
- Google Gemini API
- AsyncStorage for local data
Project Structure:
medidiet-app/
βββ app/ # Expo Router screens
βββ components/ # Reusable UI components
βββ contexts/ # React Context providers
βββ hooks/ # Custom React hooks
βββ services/ # Business logic and API services
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
βββ constants/ # App-wide constants
This app deals with sensitive health information and provides dietary guidance for medical conditions. When contributing:
- Always prioritize user safety - Health-related features require extra scrutiny
- Include medical disclaimers where appropriate
- Validate health data inputs thoroughly
- Respect privacy - All data is stored locally by design
- Be evidence-based - Nutritional recommendations should align with established medical guidelines
Before creating bug reports, please check existing issues to avoid duplicates. When you create a bug report, include as many details as possible:
Bug Report Template:
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Device Information:**
- Device: [e.g. iPhone 14, Samsung Galaxy S23]
- OS: [e.g. iOS 17.0, Android 13]
- App Version: [e.g. 1.0.0]
- Expo Version: [e.g. ~53.0.9]
**Additional context**
Add any other context about the problem here.Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
Enhancement Suggestion Template:
**Is your feature request related to a problem?**
A clear and concise description of what the problem is.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Medical/Health Considerations**
If this feature involves health data or medical advice, describe how it ensures user safety.
**Additional context**
Add any other context, mockups, or screenshots about the feature request here.We love code contributions! Here's how to get started:
- Fork the repository and clone your fork
- Create a feature branch from
main - Make your changes following our style guidelines
- Test your changes on both iOS and Android if possible
- Commit with meaningful messages following our conventions
- Push to your fork and create a Pull Request
Documentation improvements are always welcome! This includes:
- README updates
- Code comments for complex logic
- API documentation
- User guides and tutorials
- Medical/nutritional reference information
- Node.js: v18 or higher
- pnpm: v8 or higher (preferred) or npm/yarn
- Expo CLI: Latest version
- iOS Simulator (Mac only) or Android Studio (for emulator)
- Git: For version control
-
Clone your fork
git clone https://github.com/YOUR-USERNAME/medidiet-app.git cd medidiet-app -
Install dependencies
pnpm install # or npm install -
Set up environment variables
Create a
.envfile in the root directory:EXPO_PUBLIC_GEMINI_API_KEY=your_gemini_api_key_here
Get a free API key from Google AI Studio
-
Start the development server
pnpm start
-
Run on your device
- iOS: Press
ior runpnpm ios - Android: Press
aor runpnpm android
- iOS: Press
# Run linter
pnpm lint
# Type checking
npx tsc --noEmit
# Run on specific platforms
pnpm ios # iOS simulator
pnpm android # Android emulatorUse descriptive branch names with one of these prefixes:
feature/- New features (e.g.,feature/meal-photo-recognition)fix/- Bug fixes (e.g.,fix/calorie-calculation-diabetes)docs/- Documentation updates (e.g.,docs/api-guide)refactor/- Code refactoring (e.g.,refactor/health-context)test/- Adding tests (e.g.,test/ai-service)chore/- Maintenance tasks (e.g.,chore/update-dependencies)
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make focused commits
- Keep changes small and focused
- One logical change per commit
- Test frequently as you develop
-
Write tests (when applicable)
- Add tests for new features
- Ensure existing tests still pass
-
Update documentation
- Update README if needed
- Add JSDoc comments for complex functions
- Update type definitions
-
Test thoroughly
- Test on both iOS and Android
- Test with and without internet (for AI fallback)
- Test with different medical conditions
- Verify loading and error states
Follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that don't affect code meaning (formatting, etc.)refactor: Code change that neither fixes a bug nor adds a featuretest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
Examples:
feat(meal-plan): add weekly meal plan generation with AI
fix(diabetes): correct carb calculation for type 2 diabetes
docs(readme): update installation instructions
style(ui): improve meal card spacing and colors
refactor(ai-service): simplify error handling logic
test(health-context): add tests for BMI calculation
chore(deps): update expo to version 53.0.9General Rules:
- β Always use TypeScript, never plain JavaScript
- β Enable strict mode (already configured)
- β Provide explicit types for function parameters and return values
- β
Use
interfacefor object shapes,typefor unions/intersections - β Never use
anytype - use proper types orunknown
Examples:
// β
Good - Explicit types
interface MealPlan {
id: string;
date: Date;
meals: Meal[];
}
function calculateCalories(meals: Meal[]): number {
return meals.reduce((total, meal) => total + meal.calories, 0);
}
// β Bad - Missing types
function calculateCalories(meals) {
return meals.reduce((total, meal) => total + meal.calories, 0);
}
// β Bad - Using any
function processMeal(meal: any): void {
// ...
}Component Structure:
import { View, Text, StyleSheet } from 'react-native';
import { useState, useEffect } from 'react';
// 1. Interfaces/Types
interface MyComponentProps {
title: string;
onPress?: () => void;
}
// 2. Constants
const DEFAULT_PADDING = 16;
// 3. Main Component
export default function MyComponent({ title, onPress }: MyComponentProps) {
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
// Side effects
}, []);
return (
<View style={styles.container}>
<Text style={styles.title}>{title}</Text>
</View>
);
}
// 4. Styles
const styles = StyleSheet.create({
container: {
padding: DEFAULT_PADDING,
backgroundColor: '#F5F7FA',
},
title: {
fontSize: 20,
fontWeight: 'bold',
},
});Key Practices:
- β Use functional components with hooks
- β
Use
StyleSheet.create()for styles - β
Wrap screens with
SafeAreaView - β Handle loading and error states
- β
Use existing UI components from
components/ui/ - β Avoid inline styles (except for dynamic values)
- β Avoid class components
- β Don't skip error handling
Design System:
// Use constants from constants/Colors.ts
import Colors from '@/constants/Colors';
// Headers: 28px, Bold
// Titles: 20px, Bold
// Body: 15px, Medium
// Small: 13px, Regular
// Colors:
// Primary: #0066CC
// Success: #4CAF50
// Warning: #FF9800
// Error: #FF6B6B
// Background: #F5F7FAWhen working with health-related features:
-
Always validate health inputs
// β Good function validateWeight(weight: number): boolean { return weight > 0 && weight < 500; // Reasonable range }
-
Include disclaimers
// β Good <MedicalDisclaimer text="This is for educational purposes only. Consult your healthcare provider." />
-
Handle medical conditions carefully
// β Good - Condition-specific validation if (userProfile.medicalConditions.includes('diabetes')) { // Apply diabetes-specific dietary restrictions }
-
Respect data privacy
- All health data stored locally
- Never log sensitive information
- Use secure storage for authentication tokens
- Code follows the style guidelines
- TypeScript types are properly defined
- Code has been tested on iOS and/or Android
- Linter passes (
pnpm lint) - Type check passes (
pnpm typecheck) - Commit messages follow conventions
- Documentation updated (if needed)
- Medical disclaimers included (if applicable)
-
Push your branch to your fork
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- Use a clear, descriptive title
- Reference related issues (e.g., "Fixes #123")
- Describe your changes in detail
- Include screenshots for UI changes
- List any breaking changes
-
Pull Request Template:
## Description
Brief description of the changes made.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Related Issues
Fixes #(issue number)
## Testing
Describe the tests you ran:
- [ ] Tested on iOS
- [ ] Tested on Android
- [ ] Tested with medical condition: [specify]
- [ ] Tested offline fallback
- [ ] Linter passed (`pnpm lint`)
- [ ] Type checking passed (`pnpm typecheck`)
## Screenshots (if applicable)
[Add screenshots here]
## Checklist
- [ ] My code follows the style guidelines
- [ ] I have performed a self-review
- [ ] I have commented complex code
- [ ] I have updated documentation
- [ ] My changes generate no new warnings
- [ ] I have tested on real devices
- [ ] Medical disclaimers included (if applicable)- Automated checks will run (linting, type checking)
- Maintainers will review your code
- Address feedback by pushing new commits
- Approval - Once approved, your PR will be merged
Review Timeline:
- Small fixes: Usually within 1-3 days
- New features: May take 3-7 days
- Large refactors: Could take 1-2 weeks
- GitHub Discussions: Ask questions and discuss ideas
- GitHub Issues: Report bugs and request features
- Email: support@medidiet.app
- Documentation: Check the README and code comments
Contributors will be recognized in:
- GitHub contributors list
- Release notes for significant contributions
- Special mentions for exceptional contributions
- Watch the repository for notifications
- Star the project to show support
- Share the project with others who might benefit
- React Native Documentation
- Expo Documentation
- TypeScript Handbook
- Google Gemini API Docs
- Conventional Commits
If you have questions that aren't covered in this guide:
- Check the README
- Search existing GitHub Issues
- Create a new issue with the
questionlabel
Your contributions help make MediDiet AI better for everyone managing their health through nutrition. Every contribution, no matter how small, is valued and appreciated!
Happy Contributing! π