foodByte is a web application that enables the user to search for food related products, share their recipes, and compare prices. It is based on MEAN stack and relies on the data from OpenFoodFacts.
A live demo is available at: http://foodbyte-app.herokuapp.com/. It uses Heroku and mLab MongoDB.
Demo account:
- Email:
demo@foodbyte.io
- Password:
demo
This application implements the following features:
User features
- create a new account and sign in using his email and password.
- display user statistics on his profile.
Recipe features
- create a new recipe.
- edit an existing recipe.
- search recipes by keywords with autocomplete.
- sort recipes by name, modification date or creation date.
- comment recipes.
- display global nutritional score of the recipe and the nutritional score of the products that make up the recipe.
Product features
- search product by keywords, store or nutritional value with autocomplete.
- sort product by name or by price.
- edit product: adding price, store and entry date.
- display product details, with a computed nutritional score based on the features (ingredients and nutriments) of the product.
Store features
- list of stores with address and geolocation (displayed on a map)
foodByte uses a number of open source projects to work properly:
The web application is powered by Angular using the popular library Angular Material for the User Interface.
List of the main technologies used on the front-end:
- Angular 7 - TypeScript based front-end web framework
- Angular Material - Material Design components for Angular
- Angular Flex Layout - provide component layout features
The server is based on Node.js. It relies on MongoDB for the database, and uses Mocha for testing.
List of the main technologies used on the back-end:
- Node.js - evented I/O for the back-end
- Express - fast Node.js network app framework
- Mocha - feature rich Node.js test framework
- Mongoose - elegant MongoDB object modeling for Node.js
- compromise - modest natural-language processing in javascript
- Install Node.js. The minimum version that will work is 8.0, but the latest version is recommended.
- Install MongoDB and make sure that the MongoDB server is started.
- Clone this repository by doing
git clone https://github.com/ehrhart/foodbyte
. - In the cloned foodbyte folder, run
npm install
to install the dependencies from package.json. - Copy the
.env.example
file into a new file named.env
, and change the variables according to your build environment. - Run
npm start
. This builds the front-end based on the package.json scripts section.
Run node server/scripts/initialize-database.js
to create the DB, tables, and indexes.
The script is split into multiple parts that :
- parses the OpenFoodFacts dataset and inserts products.
- calculates the score of each product.
- inserts the missing images by using OpenFoodFacts REST API.
- queries Google Places API for shops in the Côte d'Azur area, and inserts them in the database.
- inserts test data (for testing purpose).
A docker image is also provided, to mitigate the hassle of building from the sources, as well as having a MongoDB server running.
The image is split into two containers :
- a container for the web application,
- a container for the MongoDB server.
By default, the application container will expose the port 4040.
All you have to do is to run:
docker-compose up -d
We use Mocha for our back-end tests. The list of tests can be found in server/tests/
.
npm test
- Haroun Amri - front-end
- Aymen Baya - back-end
- Thibault Ehrhart - back-end
- Hajer Ferjani - front-end