Skip to content

This project is the back end of my version of the app showcased in the HBO show Silicon Valley that identifies images as hot dogs, or not hot dogs.

Notifications You must be signed in to change notification settings

cedis81/not-hot-dog-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Not Hotdog

Contents


Background

This app was inspired by the HBO sitcom Silicon Valley where a character's investor urged him to build "Shazam...but for food." The result was an app that was able to determine if your photo was of a hot dog. Or not a hot dog. Further background on the story and show can be found here from Engadget (there is strong language if you watch the YouTube clips).

This is the back end for the React app (front end repository here). The Node.js server was built using Express, and both the server and PostgreSQL database are hosted on Heroku. The Knex.js package was used for querying the database. The bcrypt.js package was used to hash passwords. This app uses the Clarifai Predict API with their food recognition model to create a basic identifier for hot dogs.

A user will need to register and sign in to use the app (while the back end uses bcrypt.js to hash the password, it is not recommended to use real account information). Once signed in, a user can then submit an image URL in the input field and click on the button to see if their image contains a hot dog. The database will keep track of the number of images a registered user has submitted, as well as how many of those images were hot dogs.

Installation

  1. Fork and clone this repository.
  2. Install dependencies with npm install.
  3. Run npm start to run website on local host 3000.
  4. Fork and clone front end repository.
  5. Install dependencies with npm install.
  6. Run npm start to run website on local host.
  7. To publish on Github Pages, push your changes to Github.
  8. Run npm run build to deploy front end app.
  9. Run git push heroku main to deploy back end app.
  10. Go on an interview with Emily Chang at Bloomberg Tech and talk about your new app Seefood. (Just kidding, please don't do this).

Please note the following for this repo:

  1. You will need to create your own database locally for development (tables below this section), and eventually one host online. If you're not using PostgreSQL, you will need to change line 13 in server.js to a different client.
  2. While in development, you will need to remove comments on lines 15 and 16 in server.js. You will also need to comment lines 17 through 20.
  3. When you deploy (I used a free Heroku app), you will want to revert these previous two steps - comment or delete lines 15 and 16, and lines 17-20 need to be in use. Line 17 needs to be the URL of your deployed database.
  4. In image.js, you will need to use your own Clarifai API Key from the start, and there is a free version if you sign up.
  5. In image.js, you can change the criteria for identifying a food as a hotdog. Lines 25-33 contain that logic.

Below are the tables created in the 'hotdog' database with PostgreSQL:

Users table

CREATE TABLE users (
  id serial PRIMARY KEY,
  name VARCHAR(100),
  email text UNIQUE NOT NULL,
  entries BIGINT DEFAULT 0,
  hotdogs BIGINT DEFAULT 0,
  joined TIMESTAMP NOT NULL
);
id name emails entries hotdogs joined

Login table

CREATE TABLE login (
    id serial PRIMARY KEY,
    hash VARCHAR(100) NOT NULL,
    email text UNIQUE NOT NULL
);
id hash email

Technologies Used

Links

Next

  • Immproved error messaging.
  • Allow a user to change a password.

About

This project is the back end of my version of the app showcased in the HBO show Silicon Valley that identifies images as hot dogs, or not hot dogs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published