/Auction_APP-NITK

MEN Stack Used - MySQL, Express, Node

Primary LanguageCSS

191CS124_MEN-Stack

MEN Stack Used - MySQL, Express, Node

  1. MySQL - There are a lot of relational features in the database like - items related to users, being claimed by other users, etc...

  2. Node + Express - I am familiar with this backend framework, so...

  3. EJS - My design is card based and has a lot of repeating elements, making either ejs or react a good choice. I chose ejs for this project.


System Recommendation : Windows or Ubuntu with 1920*1080 resolution :)

I have tested only on these parameters, although lower resolution is accounted for...

Clone or download this project on your system and then follow along...

INSTALLATION INSTRUCTIONS

  1. Setup NODE and NPM

    1. Windows and Mac Users - Go to the following site - https://nodejs.org/en/ Download the current latest stable release and run the installer.

    2. Linux Users - run sudo apt-get install nodejs npm in terminal to install nodejs and npm directly.

  2. Copy the project files to a directory of your choice and navigate to the project directory.

  3. Install required NPM packages

    1. Open your preferred terminal (cmd, system terminal, hyper terminal, vscode terminal, etc) in that folder.

    2. Run the command npm init on that terminal and just hit enter till the promt is ready again :)

    3. run the command npm i package and replace package with the following one after the other.

      1. express
      2. ejs
      3. body-parser
      4. md5
      5. multer
      6. mysql

      Alternatively, run npm i express ejs body-parser md5 multer mysql on that terminal. It is important this terminal is open in your project folder only.

  4. Setup MySQL database for the project

    1. Head over to https://dev.mysql.com/downloads/mysql/ and download the installer for any OS you are running.
      1. Get the installer for windows or Mac.
      2. Run sudo apt install mysql-server to install followed by sudo mysql_secure_installation to setup the root account on linux
    2. Run mysql --version to check if MySQL installed successfully. My instructions might be wierd to follow, but you can look-up the documentation on https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/ for assistance.
    3. In projectFolder/Reference Docs, you will find an exports.sql file, which is the database. Fetch its path "path"
    4. On that terminal, run the following commands :
      1. mysql -u root -p and then enter your password
      2. create database irisrec;
      3. exit
    5. On terminal, run mysql -u root -p irisrec < "path/exports.sql". Enter the password you setup in step 4.i.b above. Remember to replace the path according to your system as fetched in step 4.iii above.
    6. This will setup my database on your system with following credentials
      1. user: "root"
      2. password: <The one you entered in step 4.iv above>
      3. database: "irisrec" and you need to remember this for a later step.
  5. Cool! You have Node, Express, NPM-dependencies and MySQL setup, time for action...

  6. Setup project variables

    1. Open my project folder in your favourite editor (vs-code, atom, etc..)
    2. Locate the file query.js in root directory. Check the mysql parameters on lines 6-11 and enter your credentials as in step 4.v above.
  7. You are all set! Open a terminal in the root directory of the project and run node server.js to run the server. You might want to change the listening port on line 21 of server.js to another free port on your computer. Default is 3000.

  8. On your browser (Chrome, etc..), goto localhost:3000 to see a page. If it renders, well and good. Otherwise, go through the setup again. You could call me up or reach by WhatsApp, either way!

  9. If you see hell load of random errors saying "previlage" related "mysql" stuff, do the following..

    1. Open a new terminal anywhere
    2. Run the command sudo mysql -u root -p and enter your password.
    3. Run the command ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '_yourPasswordHere_';
    4. Run the command exit
    5. Go back to the earlier terminal that you used for step 7 above.
    6. Hit ctrl+C and rerun sudo node server.js and you should be up and running!

Current Database Structure

  1. The Users on my database have followin id-pwd credentials

    1. 1-1234
    2. 2-1234
    3. 3-1234
  2. You shouldn't face any database issues if you import my database as explained in steps above.

  3. This database set (in my project folder) represents diversely, all cases of items regarding deadline, costs, bidding, etc.. Feel free to explore!

  4. Please check images under Reference Docs > MySQL Verification to verify your database, incase of errors. To do so, run the following commands in a new terminal.

    1. mysql -u root -p then enter your password
    2. use irisrec
    3. show tables; - you should see 2 entries
    4. desc users; - check if your terminal output matches with the screenshots I provided
    5. desc items; - check if your terminal output matches with the screenshots I provided

Implemented Features

  1. User Dashboard - The user can view items where

    1. His bid is highest
    2. The dealine is over and he needs to claim the item
    3. Items he has uploaded for auction.
  2. Add Item Sheet - The user can upload a new item for auction on this page

  3. Auction Dashboard - A common space for bidding where all uploaded items within deadline are open for auction followed by an auction archive where past items and highest bidders are seen.

  4. A functional navbar and a landing page has been added and the UI is user friendly.


Non-essential planned features

  1. Server-wide encryption and .env can be implemented. As of now, my database stores encrypted passwords only with 1 round of hashing.

  2. Google signin could be added. But since this is an app for NITK only, it wouldn't make sense if not for additional security tests, which I had no time for.


Known bugs

  1. Server side mimetype check for files is limited to .jpg, .jpeg, .png only, although user should technically be able to upload other valid image files.

  2. Please ignore the error Cannot set headers after they are sent to the client. I am unaware of why it happens, and would love to know!

  3. The calendar while setting deadline for auction on item accepts past values. But I left it like that only as it is easier for you and me to test myweb-app for old items. So not a bug!