Skip to content

This repo is a copy of the team graduation project from HackYourFuture program. You can discover the team code in coffee-and-chocolate-version branch, and my own improvements in develop.

Notifications You must be signed in to change notification settings

AlexanderSaid/we-save

Repository files navigation

TABLE OF CONTENTS
  1. About The Project
  2. Setup
  3. Code Structure
  4. Stack / External Libraries
  5. Contributing
  6. Further Improvements
  7. License
  8. Contact

Class 34 final project

This is the final project for the HackYourFuture curriculum we did as a class using the MERN stack by following the agile methodology with our team and a group of mentors. A quick guide to what we built:

Everyday 1/3 of the food goes waste globally. To help to reduce the food waste and create a connection between stores and people in need, we -as a WeSave team- took our responsibility! This app is created to help shops to be able to sell their almost-expired food for a very reasonable prices and customers to locate them according to their postcodes.

Click here for the Demo version

1. Setup

First, to setup all the directories run the following in the main directory:

npm install

npm run setup

The first command will install cypress and some small libraries needed for running the rest of the commands. The second will go into the client and server directories and set those up to be ran.

In the client and server directory there are two .env.example files. Create a copy and rename that to .env. Then follow the instructions in those files to fill in the right values.

To run the app in dev mode you can run the following command in the main directory:

npm run dev

(back to top)

2. Code structure

client
├── public
└── src
|   └── __tests__
|   └── __testUtils__
|   └── assets
|   └── components
|   |   └── __test__
|   |   └── Forms
|   |   └── layout
|   |   └── Search-Bar
|   |
|   └── context
|   └── css
|   └── hooks
|   └── pages
|   |   └── AboutUs
|   |   └── Contact
|   |   └── Home
|   |   └── MyShop
|   |   └── resetpassword
|   |   └── Results
|   |
|   └── util
|   └── index.jsx
|
cypress
|   └── fixtures
|   └── integration
|   └── plugins
|   └── support
server
|
└── src
    └── __testUtils__
    └── controllers
    └── db
    └── Middlewares
    └── models
    └── routes
    └── util
    index.js

(back to top)

2.1 Client structure

  • public || public facing client code
  • __tests__ || any jest tests for specific components will be in a __tests__ folder on the same level
  • __testUtils__ || any code that is only being used in the tests is put in the __testUtils__ folder to separate that away from the rest of the code
  • components || all of our shared components that are used over multiple pages
  • hooks || all of our custom hooks
  • pages || the page components of our app, any routing will go between these components
  • pages/components || components used specifically on those pages
  • util || any utility functions that can be used anywhere on the client side
  • index.jsx || the start point of the client

(back to top)

2.2 Cypress structure

  • fixtures || any data/files that cypress needs can be placed here
  • integration || all of our tests are in here, separated in folders based on the pages in our app
  • plugins || any plugins for our cypress configuration can be placed here
  • support || custom commands and other support files for cypress can be placed here

(back to top)

2.3 Server structure

  • __tests__ || any jest tests for the api endpoints as that is our testing strategy for the backend
  • __testUtils__ || any code that is only being used in the tests is put in the __testUtils__ folder to separate that away from the rest of the code
  • controllers || all of our controller functions that interact with the database
  • db || all of our configuration for the database
  • models || all of our mongoose models will be placed here
  • routes || code to match up the API with our controllers
  • util || any utility functions that can be used anywhere on the server side
  • index.js || the start point of the server

(back to top)

3. Stack / external libraries

The base stack of the app is a MERN stack (Mongoose, Express, React, Node). Next to that we make use of the following extras:

3.1 Configuration libraries

  • dotenv || To load the .env variables into the process environment. See docs
  • webpack / html-webpack-plugin || To bundle our React app and create a static app to host. See docs
  • husky || To run our tests and linter before committing. See docs
  • eslint || To check our code. We have different configurations for frontend and backend. You can check out the configuration in the .eslintrc.(c)js files in the respective client and server folders. See docs
  • prettier || To automatically format our code. See docs
  • concurrently || To run commands in parallel. See docs

For more information on how these work together including the automatic deployment to heroku, have a look at our detailed DEV file.

(back to top)

3.2 Client-side libraries

  • @testing-library/* || We use React Testing Library to write all of our tests. See docs
  • jest || To run our tests and coverage. See docs
  • jest-fetch-mock || To mock out the backend for our testing purposes. See docs
  • prop-types || To type-check our components. See docs
  • Tailwind CSS || To do the css design for all the components. Seedocs
  • Framer|| To apply animation to style. See docs
  • geolib || To do basic geospatial operations like distance calculation, conversion of lat&lon to postcodes, etc. See docs

(back to top)

3.3 Server-side libraries

  • nodemon || To automatically restart the server when in development mode. See docs
  • jest || To run our tests and coverage. See docs
  • supertest || To more easily test our endpoints. See docs
  • mongodb-memory-server || To mock out our database in our backend tests. See docs
  • cors || To open up our API. See docs
  • mongoose || To add schemas to our database. See docs
  • geolib || To do basic geospatial operations like distance calculation, conversion of lat&lon to postcodes, etc. See docs
  • jsonwebtoken || To create tokens to check the authorization. See docs
  • nodemailer|| To send emails after confirmation of basket reservation and sending message through Contact Us page See docs

(back to top)

3.4 API's used

  • geoapify || To deal with geospatial operations/ See docs

4. Further Improvements

  • To create a customer profile and shop profile pages to be able to display information of the user/shop.
  • The functionality that allows customer/shop-owner to edit personal/shop-related info
  • Adding "cart" functionality to be able to store one or multiple baskets in it before payment
  • Adding payment functionality
  • Being able to upload custom images for baskets, shop-covers, and shop-logo
  • History of purchase/sell for customer/owner

We, as a WeSave team, really would like to hear your amazing ideas about further improvements!! To do so, please reach us here!

(back to top)

5. Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

6. License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

7. Contact

Email - [email protected]

WeSave contact: WeSave Contact Form

(back to top)

About

This repo is a copy of the team graduation project from HackYourFuture program. You can discover the team code in coffee-and-chocolate-version branch, and my own improvements in develop.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages