Akshat Wagadre, Olatunji Busari, Tejas Rajopadhye
CryptoBase is a social media application for cryptocurrencies. With the growing awareness of investments into financial investments like stocks, mutual funds, etc , not only has the returns on investments have increased but also difficulties in transparency about the investment. False news can hurt a novice investor badly.
Just like on any social media platform, on which the validity of the news is unfolded within secs/ minutes ( for example :- twitter) , we intend CryptoBase to do the same but with cryptocurrencies. Not only will it provide a social media experience , it will also help the user to analyse various cryptocurrencies at a touch of a button on the same platform.
Please add a .env file and copy and paste the below configuration in "Backend" folder
port=
cookieMaxAge=
minPasswordLength=
maxPasswordLength=
secret=
dbName=
sessionsDb=sessions
$ cd Backend
$ npm i
$ npm start
$ cd Frontend
$ npm i
$ npm start
While installing dependencies for frontend , if you get any issues that are specific to OS, system architecture, please run the below commands,
$ cd Frontend
$ npm i -f
$ npm start
- The application launches at http://localhost:3000/ on the default browser.
- Click on 'SignUp' and create the user by entering the appropriate details.
- If the user is created, you will be redirected to the sign in page else an error will be shown in the sign up box.
- Now with those credentials, login into the website.
- The news for your favourite crypto currencies (hard coded as of now) will be displayed under their respective names.
- Clicking on the title of crypto will open a new page which displays its chart over 500 days. Another chart can be selected using the dropdown button below the chart.
- You can see your profile by clicking on the 'Profile' button on the navbar.
- Profile page allows you to update your name and delete your account by clicking the appropriate buttons.
Details about unit testing for critical modules is given below, to run the unit test, please run the below command
$ npm run test
-
Normal Usage - This tests verifies if the passwordlength is permissible when a password with permissible length is provided. For this application password with length > 8 are considered permissible. This test is named as "Positive Test Case for Correct Input"
-
Erroneuos Usage - This test verifies the functionality of password lenght checker in case the password lenght is < 8 . This test is named as "Negative Test case for Incorrect Input" . Here password with length = 4 is passed and checked if the function returns 'false' which indicates the correctness of this test
-
Normal Usage - This tests verifies for the given password, a hash and salt is generated and does verify this by validating the password with the salt by rehashing and checking the generated hash
-
Negative Usage - In this test, for the password the salt for the password is changed and then the password and salt combinations are revalidated . Failure is to be expected in this test
For this test , the sample user object is created and inserted into the database . The response for the function is checked in this case
For this test, the sample user created previous is used and data for the same is pulled from DB and the object returned is checked
For this test , data is updated for a user and the data which is updated is checked by querying the data from the DB and checking the fields that were supposed to change
For this test , user's email ID is provided to be deleted from the data. The response from the function/ DB is checked for the test
The project is divided into 3 parts,
- Frontend - in the folder Frontend
- Backend - in the folder Backend
- Database - in the folder Database
Frontend is made in React JS and backend in NodeJS ( with Express.js ) .Both frontend and backend server need to be started. Before starting both frontend and backend servers please install the appropriate dependencies.
- Dependencies for Backend - NodeJS, npm and packages inside the package.json file , .env file
- Dependencies for Frontend - ReactJS, React Context API, MaterialUI
Whenever a new user is created, its details (username, emailID, date of birth, password) is stored in the SQLite based database which is located in "./Backend/database/crytobaseDB.db". Passwords are hashed with a salt and the hash along with the salt is stored in the database.
(Updated) Tables used and brief usage
- UserDetails - Store the Users Data for login and auth
- Comments - Store the comments made by the user
- CryptoFavourites - Store the favourites for crypto currencies
- NewsItems - Storage of News Items (used if user wants to view, his recently watched news / his activity)
- NewsLikes - Stores the likes by each user
The database can be accessed from the CLI provided by SQLite or with a user friendly software called SQLite Studio
All the session related data is used in the session.db table . The configuration for the same in 'index.js' file.
All the unit test are made with a replica of "cryptoBaseDB.db" database called "testDB.db". Before any operation related to database , all the data is erased . Please take a look at 'userOperationDB.test.js' file for the same
This API is used to fetch the news for the various crypto currencies based on the given keywords to be displayed to the users. This API provides 500 free requests on the free plan.
This API is used to fetch the historical market data of crypto currencies which is later used to plot their chart. It is a free to use API with no limit on the number of requests.
The library used here is kaktana-react-lightweight-charts which is a modified version of the standard lightweight charts provided by tradingview, to work with react. This library makes use of price and time data to plot various types of charts like line chart, candlestick chart, area series chart etc. We have used the area series chart using the data fetched from coingecko's API for a given crypto. The chart displayed here gives us important information about the crypto currencies' price over a span of 500 days. Users can see the chart to understand how the price has moved in the past days, perform technical analysis to make investment decisions in that crypto.