Visit our website 👇
Or watch our website and mobile demos.
We are Computer Engineering students studying at Boğaziçi University.
We are taking the course CmpE 451: Introduction to Software Engineering together.
To learn more about the team and the project, visit our Wiki Page.
NutriHub is a comprehensive platform that helps users discover and manage affordable and healthy food options. The project consists of three main components:
- Frontend (React + TypeScript)
- Backend (Django)
- Mobile App (React Native)
- Docker and Docker Compose
- Node.js (v20 or later)
- Python (3.11 or later)
- MySQL (8.0)
The easiest way to run the entire project is using Docker Compose:
- Clone the repository:
git clone https://github.com/bounswe/bounswe2025group9.git
cd bounswe2025group9- Environment Variables:
See the .env.example file in the root directory for required environment variables. Create a .env file and add your configurations.
cp .env.example .env
# edit .env to add your configurations
source .envThe given .env.example is sufficient for local development as is.
- Start all services:
docker-compose up --build -dThis will start:
- Frontend at http://localhost:8080
- Backend API at http://localhost:8080/api/
- MySQL database
- Environment Variables:
- Use
BUILD=PRODin your.envfile for production settings. This switches the frontend build to usefrontend/nginx.confinstead offrontend/nginx-dev.conf. The basic difference is that the production config uses https and redirects http traffic to https, while the dev config only serves http traffic. - Set
PORT=80for production web hosting, it will allow http traffic to be redirected to https. (seenginx.conffor details) - Make sure to set strong passwords for
MYSQL_PASSWORD,MYSQL_ROOT_PASSWORDandDJANGO_SECRET_KEY. - FatSecret API credentials are required only if db initialization scripts are invoked.
- SSL Certificates:
- For production, you need to set up SSL certificates for secure https connections. Use Let's Encrypt service to obtain free SSL certificates.
- Start the app in development mode to expose port 80, then use Certbot to obtain and install the certificates.
docker-compose up --build -d # with BUILD=DEV and PORT=80- Following command will create a docker container to run certbot and obtain the certificates. Make sure to replace
<email>with your email address and set the correct domain names.
sudo docker run --rm\
-v $(pwd)/certbot/www:/var/www/certbot\
-v $(pwd)/certbot/conf:/etc/letsencrypt\
certbot/certbot certonly\
--webroot\
--webroot-path=/var/www/certbot\
--email <email> # your email here\
--agree-tos\
--no-eff-email\
-d nutrihub.fit\ # domain to deploy
-d www.nutrihub.fit
This will store the obtained certificates under certbot/ directory.
After obtaining the certificates, you can restart the application with production settings:
# from .env file, set:
# BUILD=PROD
# PORT=80
docker-compose up --build -dTo use the food data features, you need to set up FatSecret API credentials:
- Go to FatSecret Platform API
- Create a new account to get your API credentials
- Add the following environment variables to your environment variables in the backend directory:
FATSECRET_CONSUMER_KEY=your_consumer_key FATSECRET_CONSUMER_SECRET=your_consumer_secret
Note: The API credentials are required for:
- Food search functionality
- Nutritional information retrieval
- Food database integration
- Docker with at least 8GB RAM allocated, gradle build fails with OOM otherwise
cd mobile/nutrihub
# Build the Docker image
docker build -t nutrihub-apk .
# Create a temporary container
docker create --name nutrihub-temp nutrihub-apk
# Extract the APK
docker cp nutrihub-temp:/app/android/app/build/outputs/apk/release/app-release.apk ./nutrihub.apk
# Clean up
docker rm nutrihub-tempIf build fails with "Gradle daemon disappeared":
- Increase Docker memory to 8GB+ in Docker settings
- Restart Docker
!! We assume that
mysqldatabase is available and running withdjango@localhostuser andmydbdatabase. !!
- Navigate to the backend directory:
cd backend- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements-dev.txt- Set up environment variables:
source setup.sh # On Windows: .\setup.sh- Run migrations:
python manage.py makemigrations
python manage.py migrate- Start the development server:
python manage.py runserver 9000- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Start the development server:
npm start- If frontend cannot reach the backend, make sure to set the correct API base URL in the environment variables. You can set backend path with
VITE_API_BASE_URL="http://localhost:8080/api"environment variable, where 8080 is the port where your backend is running.
- Navigate to the mobile directory:
cd mobile/nutrihub- Install dependencies:
npm install- Start the development server:
npm run devThe project uses MySQL as the database. When running with Docker, the database is automatically configured. For manual setup:
- Create a MySQL database named
mydb - Create a user with the following credentials:
- Username: django
- Password: djangopass
cd backend
python manage.py testcd frontend
npm testcd mobile/nutrihub
npm testThe project uses Black for Python code formatting:
cd backend
black .Pre-commit hooks are set up for the backend:
cd backend
pre-commit installbounswe2025group9/
├── backend/ # Django backend
├── frontend/ # React frontend
├── mobile/ # React Native mobile app
└── docker-compose.yml
- Create a new branch for your feature
- Make your changes
- Run tests
- Submit a pull request
This project is part of the CmpE 451 course at Boğaziçi University.