/Donatify

Repo for project 1 of group 22 NCSU SE Fall 2022 - Donatify

Primary LanguageJavaScriptMIT LicenseMIT

GitHub GitHub issues Github closed issues Github pull requests Github closed pull requests Github all contributors DOI codecov

πŸ‘ β€œHappiness doesn’t result from what we get, but from what we give." ~ Ben Carson πŸ‘

Majority of us have noticed items which go to waste even when they are in their prime condition. For example, many atriums, dining halls around the world, dispose of their leftovers at the end of the day, and a lot of food is being wasted.

We introduce to you Donatify, a platform for donors and receivers to communicate, donate and recieve items respectively. In simple terms, a user would put up items which they would like to donate, and other users, if their interests match with the item, would choose to receive it.

Want to be part of an environment saving initiative, while sitting in the comfort of your home? Get on Donatify, donate the stuff you don't need, and feel good.

Demo video

Demo_video.mp4

App in action

List available items:

Donate an item:

Accept a donation:

Getting started

  • Prerequisites

    • npm and node (version 16.X or 16.17.1) should be installed.
    • Make sure the database server (mysql) is on. Consider using XAMPP.
    • Download Python3.
    • pytest for testing the application server.
  • Dependencies

    Backend: flask (2.2.2), flask_cors (3.0.10), json, asyncio, ast, re, mysql (8.0.30), pytest (7.1.2), pdoc (0.10.0).

    Frontend: axios (1.0.0), antd (4.23.4), jsdoc (3.6.11), react-select (5.4.0), react-tag-input (6.8.1), reactstrap (9.1.4), jest.

  • Installation and Run

    Backend: Documentation

    1. Create virtual environment
    python -m venv <name_of_virtualenv>
    
    1. Activate Python Virtual environment
    <name_of_virtualenv>\Scripts\activate.bat for Windows users.
    source <name_of_virtualenv>/bin/activate for linux users.
    
    1. Install dependencies
    pip install -r requirements.txt
    
    1. Make sure the database is imported from src/database/donationsystem.sql onto the mysql server.

    2. Run the below command from the main directory to start the backend application server.

    python -m src.Backend.app
    
    1. The backend flask application will be up and running at localhost:5001

    Frontend: Documentation

    1. After cloning the repository, move to the directory src\frontend where our frontend code is located.

    2. Install all the dependencies using npm. Command to run: npm install. This will fetch the dependecies from package.json file, and install them.

    3. Start the server by using the command npm start. This will run the server on port 3000, and the website can be accessed by going to http://localhost:3000/.

    4. If credentials of a registered user are available, use them, or register a new user and interact with the website.

  • Testing

    Backend

    1. Run the below command from the main directory. This should run all the test cases for app.py.
    pytest
    

    Frontend

    1. Move to the directory src\frontend where our frontend tests are located.

    2. Run the tests using the command npm test -- --coverage --watchAll=false. This will run all the tests across the frontend code.

  • Troubleshooting

    Try the following troubleshooting steps. If none of them work, contact the repository owner/file an issue.

    Backend

    1. We have added the print statements in all of the backend functions to know execution of the codes.
    2. In case of error the print statements will let us know about the issue of code break.
    3. The api responses the status code, valid message and response header which they can share back for troubleshooting.

    Frontend

    1. Since frontend is build using JavaScript, React and Redux, check for console logs under developer tools to identify any failures.
    2. Consider installing and using React developer tools and Redux developer tools to track the request through the system.

Directory structure

.
β”œβ”€β”€ .github
|   β”œβ”€β”€ workflows
|   |   β”œβ”€β”€ frontendGitActions.yml      # GitActions workflow for frontend
|   |   β”œβ”€β”€ backendGitActions.yml       # GitActions workflow for frontend
β”œβ”€β”€ .vscode
|   β”œβ”€β”€ extensions.json                 # Recommended extensions for vscode
|   β”œβ”€β”€ settings.json                   # Workspace settings for vscode
β”œβ”€β”€ docs
|   β”œβ”€β”€ Rubrics
|   |   β”œβ”€β”€ proj1rubric.md              # Project rubric
|   β”œβ”€β”€ Backend                         # Documentation for backend
|   β”œβ”€β”€ frontendDocs/left-overs/0.1.0   # Documentation for frontend
|   β”œβ”€β”€ README.md                       # Readme file for docs folder
β”œβ”€β”€ src
|   β”œβ”€β”€ Backend
|   |   β”œβ”€β”€ __init__.py                 # Init file for backend
|   |   β”œβ”€β”€ app.py                      # File containing backend APIs
|   |   β”œβ”€β”€ dbconfig.py                 # DB configuration for backend
|   |   β”œβ”€β”€ utils.py                    # Utilities for backend
|   β”œβ”€β”€ database
|   |   β”œβ”€β”€ donationsystem.sql          # Backend SQL
|   β”œβ”€β”€ frontend
|   |   β”œβ”€β”€ public                      # Folder containing assets and images
|   |   β”œβ”€β”€ src
|   |   |   β”œβ”€β”€ API                     # Folder containing API calling frontend code
|   |   |   β”œβ”€β”€ __tests__               # Folder containing unit tests for frontend
|   |   |   β”œβ”€β”€ app                     # Folder containing redux store configuration
|   |   |   β”œβ”€β”€ components              # Folder containing frontend react components
|   |   |   β”œβ”€β”€ containers              # Folder containing containers to connect components with redux store
|   |   |   β”œβ”€β”€ reducers                # Folder containing reducers
|   |   |   β”œβ”€β”€ axiox.js                # API client generation
|   |   |   β”œβ”€β”€ index.css               # CSS configuration for frontend
|   |   |   β”œβ”€β”€ index.js                # Entry point for frontend
|   |   |   β”œβ”€β”€ leftOver.jsx            # Root react component
|   |   |   β”œβ”€β”€ setupTests.js           # Setup jest configuration for unit testing
|   |   β”œβ”€β”€ .eslintignore               # Ignore configuration for eslint
|   |   β”œβ”€β”€ .eslintrc.js                # eslint configuration
|   |   β”œβ”€β”€ package.json                # Package configuration and dependency closure
|   β”œβ”€β”€ README.md                       # Readme file for src folder
β”œβ”€β”€ test
|   β”œβ”€β”€ README.md                       # Readme file for test folder
|   β”œβ”€β”€ __init__.py                     # Init file for test folder
|   β”œβ”€β”€ test_app.py                     # Tests for backend
β”œβ”€β”€ .gitattributes                      # File for git attributes
β”œβ”€β”€ .gitignore                          # File for git ignore
β”œβ”€β”€ CODE_OF_CONDUCT.md                  # Code of conduct for repository
β”œβ”€β”€ CONTRIBUTING.md                     # Details about contributing to the repository
β”œβ”€β”€ LICENSE.md                          # MIT License details
β”œβ”€β”€ README.md                           # Readme file for repository
β”œβ”€β”€ requirements.txt                    # Details of dependency packages
└── setup.py                            # Setup file for the module

Releases

Roadmap

  • Roadmap for this project can be found here.

Chat channel

  • All the communication was handled through a private chat channel and online meets. Some screenshots of discussions can be found here.

Support

We do our best to answer all tickets in a timely manner, but sometimes we accumulate a backlog and may take awhile to respond. Please be patientβ€”we will get back to you as soon as we can! Please do contact any of us:

License

Contributors ✨

Thanks goes to these wonderful people.