/CoffeeDir

Primary LanguageJavaScript

CoffeeDir

Online demo: SSL CoffeeDir | No-SSL CoffeeDir

CoffeeDir Logo

Specialty coffee journal that lets you log the coffees you and other users have tried.



BRAINSTATION WEB DEVELOPMENT BOOTCAMP CAPSTONE PROJECT

The problem: I've always wanted to keep a detailed track of the coffees I tried, and started keeping coffee bags in hopes that I'll record them into a nice leather bound journal. So I've just kept all the coffee bags I've bought... but never got to the journal part. Hence, the solution, Coffee Dir. All the coffee, none of the baggage!


Tech stack

Font-end:

Create-react-app, React Router v6, Axios, Sass front-end

Back-end:

NodeJs, JSON Web Tokens (JWT), BCrypt, MongoDB, Mongoose back-end


Setup the project

Installation (in root directory, use terminal/bash commands)

npm i
cd client && npm i
cd .. && cd server && npm i

Set up .env file inside /server/ directory

Pick a port to use to run the server (8080 is a good one to use)

PORT=*PORT NUMBER HERE*

Initialize a MongoDB database and include the connection string in DB_CONNECTION variable

DB_CONNECTION=*DB CONNECTION STRING*

Secret for the JWT token generation (takes any string, but I suggest using openssl rand -hex 25 in terminal to generate a quick random key key)

TOKEN_KEY=*SECRET TOKEN*


Run the project

To run the project locally, write npm run dev in root directory of the project


Server end-points

/user

/user/register - takes a user object

{
  username: "username string",
  email: "email string",
  password: "password string"
}

/user/login - takes a user object and sends back a JWT token to be added to sessionStorage in the browser to be used for user authentication

{
  email: "email string",
  password: "password string"
}

/coffee

/coffee - takes a large object with all the coffee information that includes user id, so the coffee can be tied to the user

{
  name: "coffee name",
  roaster: "roaster name",
  origin: "country of origin",
  farm: "coffee farm",
  description: "a large string with description",
  flavours: ["array of strings"],
  price: number,
  link: "https url string",
  score: number,
  user_id: req.params.userId
}

/coffee/:id - takes a large object with all the coffee information and uses request params to identify coffee to update

{
  name: "coffee name",
  roaster: "roaster name",
  origin: "country of origin",
  farm: "coffee farm",
  description: "a large string with description",
  flavours: ["array of strings"],
  price: number,
  link: "https url string",
  score: number,
}


Hope you enjoy my project and collect some amazing brew, if you have any questions you can find me on Twitter and LinkedIn

https://twitter.com/pavelisp

https://linkedin.com/in/pavelisp



Credits:

Background image:

Coffee branch vector created by rattanachomphoo - www.freepik.com

Support and guidence (BrainStation Educators and TAs):

Patrick McCullough: https://github.com/pgmccullough

Ernie Hsiung: https://github.com/ErnieAtLYD

Nigel D'Souza: https://github.com/glitcher93

Ben Wanless: https://github.com/BenWanless