Make sure you have Node.js installed.
$ git clone git@github.com:taptrust/taptrust.git # or clone your own fork
$ cd taptrustThe backend server uses Node.js, Express and PostgreSQL.
- Copy
.env.exmaplefile to.envand add environment variables. (ElephantSQL has a sandbox postgres option if you don't want to run database locally). npm installto install dependencies.- Run
npm run migrateto migrate database. - Initialize dev server with
npm run start:dev, which starts at localhost:8000.
The frontend server uses React, webpack, and Node.js.
- The frontend is in the
wwwfolder. In this folder, copy.env.exmaplefile to.envand add environment variables. You can setAPI_BASE_URLto a remote server if you'd like to develop the frontend without making any backend changes. npm install- Run
npm start. (Frontend has it's own package.json.). The frontend server runs onlocalhost:8080.
- With database server and frontend server running, you can POST your first token at
localhost:8080/tokenform. - After a token is posted you can POST your first review at
localhost:8080/reviewform/:tokenId, where tokenId is the numerical id of the token that you want to review.
In addition, you can GET, POST, PUT, DELETE at these routes:
POST:
/api/tokensto create a new token. Response will be201 Createdfor success or400 Bad Requestfor error./api/tokens/:tokenId/reviewsto create a new review for a token (:tokenId is the id of the token you want to add a review of). This request will also update the aggregate scores of the token, which are the average of each score category. Response will be201 Createdfor success or400 Bad Requestfor error.
GET:
/api/tokensto GET all tokens and their reviews. Response will be200 OKfor success or400 Bad Requestfor error./api/tokens/:nameto GET a specific coin, and it's reviews. Response will be200 OKfor success,404 Token not found, or400 Bad Requestfor error./api/tokens/:tokenId/reviewto GET all of a specific token's reviews. Response will be200 OKfor success or400 Bad Requestfor error./api/reviews/:reviewIdto GET a specific review. Response will be200 OKfor success or400 Bad Requestfor error.
PUT:
/api/tokens/:tokenIdto update a specific coin. Response will be200 OKfor success or400 Bad Requestfor error./api/reviews/:reviewIdto update a specific review. Response will be200 OKfor success or400 Bad Requestfor error.
DELETE:
/api/tokens/:tokenIdto delete a token. Response will be204 No Contentfor success or400 Bad Requestfor error./api/tokens/:tokenId/reviews/:reviewIdto delete a review. Response will be204 No Contentfor success or400 Bad Requestfor error.
| Field Names | Field Type | Description |
|---|---|---|
| id | Integer | Automatically generated id for a given token |
| name | String | The name of the token |
| category | String | A token's given category (Utilities, Social, General, ect). |
| description | Text | A longer description of the token and it's unique qualities. |
| age | String | The age of the token since it's creation (In years, months). |
| symbol | String | The token's abbreviated symbol, eg. ETH or LTC. |
| website | String | The website of the token, leaving off 'http://' (eg. taptrust.com). |
| founders | String | A single founder, or a single string of founders separated by commas. |
| score_overall | Integer | The average of all of a token's score_overall reviews. Entered automatically |
| score_transparency | Integer | The average of all of a token's score_transparency reviews. Entered automatically |
| score_governance | Integer | The average of all of a token's score_governance reviews. Entered automatically |
| score_legal | Integer | The average of all of a token's score_legal reviews. Entered automatically |
| score_functionality | Integer | The average of all of a token's score_functionality reviews. Entered automatically |
| createdAt | Date | Automatically generated datetime that the token was created |
| updatedAt | Date | Automatically generated datetime that the token was last updated |
The above fields should be sent in POST/PUT requests using x-www-form-urlencoded params.
All token score fields will be automatically entered once a review for the coin is POSTed. They will be null until then.
| Field Names | Field Type | Description |
|---|---|---|
| id | Integer | Automatically generated id for a given review |
| tokenId | Integer | id of the token to which this review corresponds. Generated from URL during POST request |
| name | String | The name of the person leaving a review. |
| review | Text | A longer format review of a given token, minimum 100 characters. |
| url | String | Url for a website of the reviewer. (Personal website, Medium, Twitter, ect) |
| score_overall | Integer | Average of all other scores. Automatically entered after other scores are entered |
| score_transparency | Integer | A score for a given token based on it's transparency, 0-100. |
| score_legal | Integer | A score for a given token based on it's legal status, 0-100. |
| score_functionality | Integer | A score for a given token based on it's functionality, 0-100. |
| score_governance | Integer | A score for a given token based on it's governance, 0-100. |
| createdAt | Date | Automatically generated datetime that the review was created |
| updatedAt | Date | Automatically generated datetime that the review was last updated |
- Set
NODE_ENVvariable totestandTEST_DB_URLvariable to your postgres test database in.envfile. (ElephantSQL has a sandbox postgres option if you don't want to run it locally). - Run
sequelize db:migrate --env testto set up a replica of your development database on the test database. - Run
npm test.
- Push the updated code to
masterbranch.
$ git push origin master- Connect to the server via SSH.
You can connect on GCP console
- Go to the project folder.
$ cd /var/www/taptrust
- Pull the latest
masterbranch.
$ git pull origin master- Install npm packages in backend app if
package.jsonhas been modified.
$ npm installThe next two steps are in the www folder. Use cd www to navigate to it.
- Install npm package in frontend app if if
www/package.jsonhas been modified.
$ npm install- Build the front-end app if any other code in
wwwhas been modified.
$ npm run build- Restart pm2 processes
$ cd ..
$ pm2 stop pm2config.json
$ pm2 start pm2config.json