Thank you for your interest in contributing to FlavorSnap! This guide will help you get your development environment set up and ready to contribute.
- Prerequisites
- Development Environment Setup
- Project Structure
- Development Workflow
- Code Style & Quality
- Testing
- Pull Request Process
- Contribution Areas
Before you begin, ensure you have the following installed:
| Tool | Version | Check Command |
|---|---|---|
| Python | 3.8+ | python --version |
| Node.js | 18+ | node --version |
| npm | 9+ | npm --version |
| Git | 2.30+ | git --version |
| Rust (optional, smart contracts) | 1.70+ | rustc --version |
System Requirements:
- 4GB+ RAM (PyTorch model loading)
- ~3GB disk space (PyTorch is large)
# Fork the repository on GitHub, then:
git clone https://github.com/<your-username>/flavorsnap.git
cd flavorsnap
git remote add upstream https://github.com/SamixYasuke/flavorsnap.gitCreate a virtual environment and install all dev dependencies:
🪟 Windows (PowerShell)
python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt🪟 Windows (Command Prompt)
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements-dev.txt🍎 macOS
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt🐧 Linux (Debian/Ubuntu)
sudo apt-get install python3-venv python3-dev gcc
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txtVerify installation:
python -c "import torch; print(f'PyTorch {torch.__version__} — GPU: {torch.cuda.is_available()}')"
cd frontend
npm install
cp .env.example .env.local
# Edit .env.local — set NEXT_PUBLIC_API_URL=http://localhost:5000Open two terminals:
# Terminal 1: API Server (from project root, venv activated)
cd ml-model-api
python app.py
# → API running at http://localhost:5000
# Terminal 2: Frontend (from project root)
cd frontend
npm run dev
# → Frontend running at http://localhost:3000# Check API health
curl http://localhost:5000/health
# Open browser
# → http://localhost:3000flavorsnap/
├── requirements.txt # Core Python dependencies (pinned)
├── requirements-dev.txt # Dev dependencies (testing, linting)
├── frontend/ # Next.js web app (TypeScript)
│ ├── pages/
│ ├── styles/
│ └── package.json
├── ml-model-api/ # Flask ML inference API (Python)
│ ├── app.py # Main Flask application
│ ├── xai.py # Explainable AI module
│ ├── model_registry.py # Model versioning
│ ├── ab_testing.py # A/B testing framework
│ └── monitoring.py # Prometheus metrics
├── contracts/ # Soroban smart contracts (Rust)
├── dashboard.py # Panel-based dashboard
├── train_model.py # Model training script
├── model.pth # Trained PyTorch model
├── docs/
│ └── dependencies.md # Dependency documentation
└── CONTRIBUTING.md # ← You are here
-
Create a feature branch from
main:git fetch upstream git checkout -b feature/your-feature-name upstream/main
-
Branch naming conventions:
Prefix Example Use Case feature/feature/image-croppingNew features fix/fix/upload-cors-errorBug fixes docs/docs/api-examplesDocumentation refactor/refactor/model-loaderCode improvements test/test/batch-processorTest additions -
Keep your branch up to date:
git fetch upstream git rebase upstream/main
Follow Conventional Commits:
feat: add multi-image upload support
fix: resolve CORS error on /predict endpoint
docs: add API examples for batch processing
style: format model_registry.py with black
refactor: extract image transforms to utils
test: add unit tests for ABTestManager
chore: update torch to 2.2.0
- Style: PEP 8 compliant
- Formatter: black (auto-format)
- Imports: Sorted by isort
- Linting: flake8
- Type Checking: mypy
# Format code
black .
isort .
# Lint
flake8 .
# Type check
mypy ml-model-api/ --ignore-missing-imports- Style: Strict mode TypeScript
- Components: Functional components with hooks
- CSS: TailwindCSS utility classes
- Linting: ESLint + Prettier
cd frontend
npm run lint
npm run format- Formatter:
rustfmt - Linting:
clippy
cargo fmt --check
cargo clippy -- -D warnings# Run all tests
pytest
# With coverage report
pytest --cov=ml-model-api --cov-report=html
# Run specific test file
pytest test_analytics.py -vcd frontend
npm run test # Unit tests
npm run test:coverage # With coverage
npm run test:e2e # End-to-end testsRun all checks before committing:
# Python
black --check .
isort --check .
flake8 .
pytest
# Frontend
cd frontend && npm run lint && npm run testBefore submitting your PR, ensure:
- Code follows the project's style guidelines
- All existing tests pass (
pytestandnpm run test) - New functionality has corresponding tests
- Documentation is updated (README, docstrings, etc.)
- Commit messages follow Conventional Commits
- No secrets or credentials committed
- Virtual environment files (
venv/) are not included
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request on GitHub against
main -
Fill in the PR template:
- What does this PR do?
- Why is this change needed?
- How was this tested?
- Screenshots (for UI changes)
-
Request a review from maintainers
-
Address review feedback with fixup commits
- UI/UX improvements
- New React components
- Performance optimizations
- Mobile responsiveness
- Accessibility (a11y)
- Internationalization (i18n)
- Model architecture improvements
- New food categories
- Training pipeline improvements
- Data augmentation strategies
- Model compression
- New API endpoints
- Rate limiting improvements
- Security hardening
- Database integration
- Caching layer
- API documentation
- Tutorials and guides
- Video walkthroughs
- Translation
- Soroban smart contract features
- Token incentive mechanisms
- Model governance
- Telegram Group: Join our community
- GitHub Issues: Browse open issues
- Discussions: Ask questions in GitHub Discussions
Look for issues labeled
good first issueorhelp wantedto find beginner-friendly tasks.
Thank you for contributing to FlavorSnap! 🍲✨