secret_tech ICO Dashboard Backend
This is backend module of secret_tech ICO dashboard: https://demo.icodashboard.space.
It was implemented to provide following functionality:
- ICO investors sign up.
- Generation of Ethereum address upon user activation.
- KYC verification using Jumio Netverify service (https://www.jumio.com/trusted-identity/netverify) and Sufti Pro service (https://shuftipro.com).
- Token purchase.
- Displaying Investor's transaction history.
- All important actions are protected with 2FA (email or google authenticator) by integration with secret_tech Backend Verify service (https://github.com/JincorTech/backend-verify)
- For more info check API docs: https://secret-tech.github.io/backend-ico-dashboard
Technology stack
- Typescript, Express, InversifyJS (DI), TypeORM (MongoDB interaction).
- Web3JS - interaction with Ethereum client. ICO backend supports any JSON-RPC compliant client.
- Mocha/chai - unit/functional tests.
- Docker.
How to start development and run tests?
- Clone this repo.
- Run
docker-compose build --no-cache
. - Run
docker-compose up -d
. - Run
cp .env.test .env
. - To install dependencies run
docker-compose exec ico yarn
. - Run tests
docker-compose exec ico yarn test
.
How to generate docs?
- Install aglio
npm install -g aglio
. - Run
mkdir /usr/local/lib/node_modules/aglio/node_modules/aglio-theme-olio/cache
. - Generate
aglio --theme-variables cyborg --theme-template triple -i apiary.apib -o ./docs/index.html
.
How to launch the project?
Getting Started
- Clone the repo.
- Write the necessary environment variables in
.env
. For a basis it is possible to take.env.stage
or.env.prod
. - Build services
docker-compose build --no-cache
- Run the services
docker-compose up -d
Note: The auth and verify services should be accessible from the outside. More in detail with the configuration of these services can be found in their readme.
Building the Application
- Install dependencies and build the project
docker-compose exec ico npm i && docker-compose exec ico npm run build
- Generate a token for a tenant:
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data-binary "{
\"email\": \"[email protected]\",
\"password\": \"Password1\"
}" \
'http://auth:3000/tenant'
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data-binary "{
\"email\": \"[email protected]\",
\"password\": \"Password1\"
}" \
'http://auth:3000/tenant/login'
Note: If you start it in ico service, you must install
curl
. This can be done with theapk add curl
command.
- Specify the received token in
.env
AUTH_JWT
. - Copy the certificates to the
dist/certs
directory. - Rename or delete the
src
directory.
Note: If the test environment is deployed and
.env.test
is used, files fromsrc
will be used.
- Run ico service:
npm run serve
Note: If the dev environment, will run
npm run start
command.