{"id":46506833,"url":"https://github.com/bounswe/bounswe2025group9","last_synced_at":"2026-03-06T15:02:03.549Z","repository":{"id":277354974,"uuid":"931115738","full_name":"bounswe/bounswe2025group9","owner":"bounswe","description":"CMPE352/451 Group 9 repository","archived":false,"fork":false,"pushed_at":"2025-12-21T13:52:04.000Z","size":38911,"stargazers_count":7,"open_issues_count":48,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-23T04:48:20.135Z","etag":null,"topics":["healthy-eating","nutrition","software-development","software-engineering"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bounswe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-11T18:36:34.000Z","updated_at":"2025-12-21T13:52:08.000Z","dependencies_parsed_at":"2025-02-13T14:31:29.116Z","dependency_job_id":"f6deef78-b1a9-4cf1-96fb-a64b886c564c","html_url":"https://github.com/bounswe/bounswe2025group9","commit_stats":null,"previous_names":["bounswe/bounswe2025group9"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/bounswe/bounswe2025group9","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bounswe%2Fbounswe2025group9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bounswe%2Fbounswe2025group9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bounswe%2Fbounswe2025group9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bounswe%2Fbounswe2025group9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bounswe","download_url":"https://codeload.github.com/bounswe/bounswe2025group9/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bounswe%2Fbounswe2025group9/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30182686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T14:42:24.748Z","status":"ssl_error","status_checked_at":"2026-03-06T14:42:14.925Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["healthy-eating","nutrition","software-development","software-engineering"],"created_at":"2026-03-06T15:01:59.912Z","updated_at":"2026-03-06T15:02:03.538Z","avatar_url":"https://github.com/bounswe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\nVisit our website 👇\n\u003c/p\u003e\n\n\u003ca href=\"https://nutrihub.fit\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/f44d84fe-ac8d-44e2-b643-bbebab4e09ef\" alt=\"Nutrihub Logo\" width=\"800\"/\u003e\n\u003c/a\u003e  \n\nOr watch our [website](https://www.youtube.com/watch?v=Uglpcuw_Zg0) and [mobile](https://drive.google.com/file/d/1FJ-BgY_uusbCjsC7Lncxc12e4Ob1NKFR/view?usp=sharing) demos.\n\n---\n\n# About Us\n\nWe are Computer Engineering students studying at Boğaziçi University.  \nWe are taking the course [**CmpE 451: Introduction to Software Engineering**](https://www.cmpe.boun.edu.tr/tr/courses/cmpe451) together.  \nTo learn more about the team and the project, visit our [Wiki Page](https://github.com/bounswe/bounswe2025group9/wiki).\n\n\u003cimg src=\"https://github.com/user-attachments/assets/0f7b63a5-9fbc-40f5-a1ee-cf4cfe666c2e\" alt=\"bounswe2025group9\" width=\"800\"/\u003e\n\n[CmpE 352 Codebase](https://github.com/bounswe/bounswe2025group9/tree/cmpe352-main)\n\n---\n\n# Table of Contents\n\n- [Project Overview](#project-overview)\n- [Prerequisites](#prerequisites)\n- [Web Application](#web-application)\n  - [Quick Start (Development)](#quick-start-development)\n  - [Environment Configuration](#environment-configuration)\n  - [Database Population](#database-population)\n  - [Default Credentials](#default-credentials)\n  - [Production Deployment](#production-deployment)\n- [Mobile Application](#mobile-application)\n  - [Environment Configuration](#mobile-environment-configuration)\n  - [Development Build](#development-build)\n  - [Production APK Build](#production-apk-build)\n  - [Network Configuration](#network-configuration)\n  - [Release Artifact](#release-artifact)\n- [Manual Development Setup](#manual-development-setup)\n- [Running Tests](#running-tests)\n- [Contributing](#contributing)\n\n---\n\n# Project Overview\n\nNutriHub is a comprehensive platform that helps users discover and manage affordable and healthy food options. The project consists of three main components:\n\n- **Frontend**: React + TypeScript + Vite\n- **Backend**: Django REST Framework + MySQL\n- **Mobile App**: React Native + Expo\n\n---\n\n# Prerequisites\n\nBefore you begin, ensure you have the following installed:\n\n- **Docker** (20.10+) and **Docker Compose** (2.0+)\n  - For APK builds: Allocate at least **8GB RAM** to Docker (Gradle build fails with OOM otherwise)\n  - macOS: Docker Desktop → Settings → Resources → Memory\n  - Windows: Docker Desktop → Settings → Resources → Memory\n\n**Optional** (for manual development without Docker):\n- Node.js (v20 or later)\n- Python (3.11 or later)\n- MySQL (8.0)\n\n---\n\n# Web Application\n\n## Quick Start (Development)\n\nThe easiest way to run the entire web application is using Docker Compose:\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/bounswe/bounswe2025group9.git\ncd bounswe2025group9\n```\n\n### 2. Configure Environment Variables\n\nCopy the example environment file and configure it:\n\n```bash\ncp .env.example .env\n# Edit .env if needed (defaults work for local development)\n```\n\nThe provided `.env.example` contains sensible defaults for local development.\n\n### 3. Start All Services\n\n```bash\ndocker-compose up --build -d\n```\n\nThis will start:\n- **Frontend** at http://localhost:8080\n- **Backend API** at http://localhost:8080/api/\n- **MySQL database** (internal, port 3306)\n\n### 4. Populate the Database\n\nSee [Database Population](#database-population) section below for two options to seed data.\n\n### 5. Access the Application\n\n- Open http://localhost:8080 in your browser\n- Log in with [default credentials](#default-credentials)\n\n---\n\n## Environment Configuration\n\nThe web application uses environment variables defined in `.env` at the project root. Here's what each variable does:\n\n### Web Hosting Options\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `BUILD` | `DEV` | Build mode: `DEV` (http only) or `PROD` (https with redirect) |\n| `PORT` | `8080` | Port for web hosting. Use `80` for production to enable http→https redirect |\n\n### Database Secrets\n\n| Variable | Default | Required | Description |\n|----------|---------|----------|-------------|\n| `MYSQL_PASSWORD` | `djangopass` | ✓ | Password for MySQL user `django` |\n| `MYSQL_ROOT_PASSWORD` | `rootpass` | ✓ | Password for MySQL root user |\n\n\u003e [!WARNING]\n\u003e **Production Security**: Use strong passwords in production! Change these defaults.\n\n### Application Secret\n\n| Variable | Default | Required | Description |\n|----------|---------|----------|-------------|\n| `DJANGO_SECRET_KEY` | `super-secret-key` | ✓ | Django secret key for cryptographic signing |\n\n\u003e [!WARNING]\n\u003e **Production Security**: Generate a unique secret key for production deployments.\n\n### External API Keys (Optional)\n\nThese are optional for basic functionality but required for specific features:\n\n| Variable | Default | Required | Description |\n|----------|---------|----------|-------------|\n| `FATSECRET_CONSUMER_KEY` | _(empty)_ | ✗ | FatSecret API key (for external food database) |\n| `FATSECRET_CONSUMER_SECRET` | _(empty)_ | ✗ | FatSecret API secret |\n| `FAL_KEY` | _(empty)_ | ✗ | Fal AI key (for AI image generation) |\n| `CLOUDINARY_CLOUD_NAME` | _(empty)_ | ✗ | Cloudinary cloud name (for image storage) |\n| `CLOUDINARY_API_KEY` | _(empty)_ | ✗ | Cloudinary API key |\n| `CLOUDINARY_API_SECRET` | _(empty)_ | ✗ | Cloudinary API secret |\n\n**FatSecret API Setup** (optional):\n1. Create an account at [FatSecret Platform API](https://platform.fatsecret.com/api/)\n2. Get your consumer key and secret\n3. Add to `.env` or `backend/.env.example`\n\nSee `backend/.env.example` for additional backend-specific configuration options.\n\n---\n\n## Database Population\n\nAfter starting the services, you need to populate the database. Choose one of two options:\n\n### Option A: Restore from Backup (Fastest, Recommended)\n\nThe repository includes a complete database backup with users, foods, recipes, and posts.\n\n**Location**: `backup/nutrihub-db-backup.zip`\n\n**Restore steps**:\n\n```bash\n# 1. Unzip the backup file\ncd backup\nunzip nutrihub-db-backup.zip\n\n# 2. Restore using docker exec (pipe SQL into container)\ndocker exec -i mysql-db mysql -udjango -pdjangopass mydb \u003c nutrihub-db-backup.sql\n```\n\n**Alternative using root user**:\n```bash\ndocker exec -i mysql-db mysql -uroot -prootpass mydb \u003c nutrihub-db-backup.sql\n```\n\n\u003e [!NOTE]\n\u003e This is a **destructive restore** - existing tables in `mydb` will be dropped and recreated.\n\nFor more restore options, see [`backup/README.md`](backup/README.md).\n\n### Option B: Seed from Scratch\n\nDjango migrations automatically create the schema and seed essential data:\n\n```bash\n# Migrations run automatically when backend container starts\n# To run manually:\ndocker exec -it django-app python manage.py migrate\n```\n\n**What gets seeded automatically**:\n- ✓ Database schema (all tables)\n- ✓ Default forum tags (Dietary tip, Recipe, Meal plan)\n- ✓ Sample recipes with ingredients\n- ✓ **Default users** (admin + demo user)\n\n**Loading additional food data** (optional):\n\nThe database backup already contains ~500 foods. To load more from JSON:\n\n```bash\n# Load foods from JSON file\ndocker exec -it django-app python api/db_initialization/load_food_from_json.py \\\n  api/db_initialization/NewFoodDatabase.json --limit 1000 --skip-errors\n```\n\nSee [`backend/api/db_initialization/readme.md`](backend/api/db_initialization/readme.md) for more details.\n\n---\n\n## Default Credentials\n\nAfter seeding (either via backup or migrations), you can log in with these pre-created users:\n\n| Role | Username | Password | Email | Capabilities |\n|------|----------|----------|-------|--------------|\n| **Admin** | `admin` | `admin123` | admin@nutrihub.fit | Full access, staff privileges, food moderation |\n| **Regular User** | `demo` | `demo123` | demo@nutrihub.fit | Standard user access |\n\n\u003e [!TIP]\n\u003e Use the **admin** account to access the admin panel at http://localhost:8080/api/admin/ and moderate food proposals, manage users, etc.\n\n---\n\n## Production Deployment\n\nFor production deployment with HTTPS:\n\n### 1. Update Environment Variables\n\nEdit `.env`:\n\n```bash\nexport BUILD=PROD          # Use production nginx config (https)\nexport PORT=80             # Allow http→https redirect\nexport MYSQL_PASSWORD=\"your-strong-password\"\nexport MYSQL_ROOT_PASSWORD=\"your-strong-root-password\"\nexport DJANGO_SECRET_KEY=\"your-random-secret-key-generate-this\"\n```\n\n\u003e [!CAUTION]\n\u003e **Security Critical**: Always use strong, random passwords and secret keys in production!\n\n### 2. Obtain SSL Certificates\n\nNutriHub uses Let's Encrypt for free SSL certificates via Certbot.\n\n**First, start the app in development mode** to expose port 80:\n\n```bash\n# Temporarily use DEV mode with PORT=80\nBUILD=DEV PORT=80 docker-compose up --build -d\n```\n\n**Run Certbot to obtain certificates**:\n\n```bash\nsudo docker run --rm \\\n    -v $(pwd)/certbot/www:/var/www/certbot \\\n    -v $(pwd)/certbot/conf:/etc/letsencrypt \\\n    certbot/certbot certonly \\\n    --webroot \\\n    --webroot-path=/var/www/certbot \\\n    --email your-email@example.com \\\n    --agree-tos \\\n    --no-eff-email \\\n    -d nutrihub.fit \\\n    -d www.nutrihub.fit\n```\n\n\u003e [!NOTE]\n\u003e Replace `your-email@example.com` and domain names with your actual values.\n\nCertificates will be stored in `certbot/conf/`.\n\n### 3. Restart with Production Settings\n\n```bash\n# Update .env: BUILD=PROD, PORT=80\ndocker-compose down\ndocker-compose up --build -d\n```\n\nYour application is now running with HTTPS! 🎉\n\n---\n\n# Mobile Application\n\n## Mobile Environment Configuration\n\nThe mobile app needs to know where your backend API is located.\n\n### 1. Create Environment File\n\n```bash\ncd mobile/nutrihub\ncp .env.example .env\n```\n\n### 2. Configure API Endpoint\n\nEdit `mobile/nutrihub/.env` and set `API_BASE_URL`:\n\n**For production** (deployed server):\n```bash\nAPI_BASE_URL=https://nutrihub.fit/api\n```\n\n**For local development** (Docker backend on your machine):\n```bash\n# Replace YOUR_LOCAL_IP with your computer's local network IP\nAPI_BASE_URL=http://192.168.1.100:8080/api\n```\n\n\u003e [!IMPORTANT]\n\u003e **Finding your local IP**:\n\u003e - **macOS**: System Preferences → Network, or run `ipconfig getifaddr en0`\n\u003e - **Windows**: Run `ipconfig` and look for IPv4 Address\n\u003e - **Linux**: Run `hostname -I` or `ip addr show`\n\nSee [Network Configuration](#network-configuration) below for detailed guidance.\n\n---\n\n## Development Build\n\n### 1. Install Dependencies\n\n```bash\ncd mobile/nutrihub\nnpm install\n```\n\n### 2. Configure API Endpoint\n\nMake sure `.env` points to your backend (see above).\n\n### 3. Start Development Server\n\n```bash\nnpm run dev\n```\n\n### 4. Run on Device/Emulator\n\n- **Android Emulator**: Press `a` in the Expo terminal\n- **iOS Simulator** (macOS only): Press `i` in the Expo terminal\n- **Physical Device**: Scan QR code with Expo Go app\n\n\u003e [!TIP]\n\u003e Your device/emulator must be able to reach the backend API. See [Network Configuration](#network-configuration).\n\n---\n\n## Production APK Build\n\n### Using github action (Recommended)\n\nWe have a github action that builds the apk for you. You can trigger it by going to the actions tab and selecting \"Apk Builder\" [workflow](https://github.com/bounswe/bounswe2025group9/actions/workflows/apk_builder.yml). Then click on \"Run workflow\" button.\n\n\n### Using Docker\n\nDocker ensures a consistent build environment and handles all dependencies.\n\n**Prerequisites**: Docker with **8GB+ RAM** allocated\n\n```bash\ncd mobile/nutrihub\n\n# Build the Docker image\ndocker build -t nutrihub-apk .\n\n# Create a temporary container\ndocker create --name nutrihub-temp nutrihub-apk\n\n# Extract the APK\ndocker cp nutrihub-temp:/app/android/app/build/outputs/apk/release/app-release.apk ./nutrihub.apk\n\n# Clean up\ndocker rm nutrihub-temp\n```\n\n**Troubleshooting**:\n- If build fails with \"Gradle daemon disappeared\", increase Docker memory to 8GB+\n- Restart Docker Desktop after changing memory allocation\n\n---\n\n### Without Docker (Manual Build)\n\nIf you can't use Docker, you can build manually:\n\n**Prerequisites**:\n- Node.js 20+\n- Java JDK 17+\n- Android SDK (via Android Studio)\n\n```bash\ncd mobile/nutrihub\n\n# Install dependencies\nnpm install\n\n# Generate native Android project\nnpx expo prebuild --platform android --clean\n\n# Build release APK\n./gradlew assembleRelease\n\n# APK output location:\n# android/app/build/outputs/apk/release/app-release.apk\n```\n\n---\n\n## Release Artifact\n\n\u003e [!TIP]\n\u003e **Pre-built APK Available**: Download the compiled `.apk` file directly from GitHub Releases!\n\n### Download Pre-built APK\n\n1. Go to [Releases](https://github.com/bounswe/bounswe2025group9/releases)\n2. Find the release tagged **`customer-milestone-3`**\n3. Download `nutrihub.apk` from the release assets\n4. Install on your Android device\n\n### Installing on Android Device\n\n1. Enable \"Install from Unknown Sources\" in Android settings\n2. Transfer the APK to your device\n3. Open the APK file to install\n4. Launch NutriHub!\n\n---\n\n# Manual Development Setup\n\nIf you prefer to run components individually without Docker:\n\n## Backend Setup\n\n\u003e [!NOTE]\n\u003e Assumes MySQL database is available and running with `django@localhost` user and `mydb` database.\n\n```bash\ncd backend\n\n# Create and activate virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements-dev.txt\n\n# Set up environment variables\nsource setup.sh  # On Windows: .\\setup.sh\n\n# Run migrations\npython manage.py makemigrations\npython manage.py migrate\n\n# Start development server\npython manage.py runserver 9000\n```\n\nBackend API will be available at http://localhost:9000/api/\n\n---\n\n## Frontend Setup\n\n```bash\ncd frontend\n\n# Install dependencies\nnpm install\n\n# Start development server\nnpm start\n```\n\nFrontend will be available at http://localhost:5173/ (or similar Vite port).\n\n**Configure API endpoint**:\nSet `VITE_API_BASE_URL` environment variable:\n```bash\nexport VITE_API_BASE_URL=\"http://localhost:9000/api\"\nnpm start\n```\n\n---\n\n## Mobile App Setup\n\n```bash\ncd mobile/nutrihub\n\n# Install dependencies\nnpm install\n\n# Configure backend URL in .env\necho \"API_BASE_URL=http://YOUR_LOCAL_IP:9000/api\" \u003e .env\n\n# Start development server\nnpm run dev\n```\n\n---\n\n# Running Tests\n\n## Backend Tests\n\n```bash\ncd backend\npython manage.py test\n```\n\n## Frontend Tests\n\n```bash\ncd frontend\nnpm test\n```\n\n## Mobile App Tests\n\n```bash\ncd mobile/nutrihub\nnpm test\n```\n\n---\n\n# Contributing\n\n1. Create a new branch for your feature\n2. Make your changes\n3. Run tests to ensure everything works\n4. Submit a pull request\n\nSee our [Wiki](https://github.com/bounswe/bounswe2025group9/wiki) for contribution guidelines.\n\n---\n\n# License\n\nThis project is part of the CmpE 451 course at Boğaziçi University.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbounswe%2Fbounswe2025group9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbounswe%2Fbounswe2025group9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbounswe%2Fbounswe2025group9/lists"}