Boilerplate for decentralized applications based on Diadem protocol
1 - git clone [email protected]:DiademNetwork/diadem-dapp-boilerplate.git
2 - cd diadem-dapp-boilerplate
3 - yarn install
4 - Create a .development.env
file (see .env.example
for ex)
5 - yarn start
Sometimes (for example when working on design), you would prefer running in a sandboxed environment. In the sandbox environment, external calls are mocked, and responses stubbed, so you dom't have to worry about another service being down or broken to work on application.
To start sandboxed app, after repository is cloned and dependencies installed:
1 - yarn start:sandbox
2 - Go to http://localhost:9000
You will notice a sandbox settings button appearing on left of screen in application. You can use it to switch mocks/stubs behaviour (For ex is user already registered?)
cypress:open
: open cypressstart
: start a development version onlocalhost:9000
, in watch modestart:sandbox
: start a sandboxed development version onlocalhost:9000
, in watch modestart:sandbox:server
: start a fake server api version onlocalhost:3001
, in watch modebuild
: build a development version indist
folder. UseNODE_ENV
for desired env buildstorybook
. Run storybook on port6006
lint
: run eslint for you projecttest
: runjest
tests and create acoverage
directory (you can then open file/coverage/lcov-report/index.html
to see nice coverage report)test:cypress
run cypress test.start:sandbox
should have been started before running this command.
UNIT tests:
yarn test
for JS filesyarn storybook
+ check components for components ACCEPTANCE tests:yarn start:sandbox
+yarn test:cypress
Please always check tests before asking for a Pull Request Review.
You can configure application to use any network supported. Networks supported are in src/configurables/network/
TO CHANGE network, you need to edit src/configurables/network/index.js
to use the network you want before building application
TO ADD a network, you need to create a new folder for it in src/configurables/network/
. Your logic will need to export an object like:
{
components: {
LoginButton: React component
},
urls: {
hashtag: String (url),
website: String (url)
},
inputs: {
link: {
maxCaracters: Number,
placeholder: String,
isValid: Function taking ({previousLink) as parameter
}
},
name: String,
dataPaths: {
userName: Array
userAccessToken: Array
userPictureUrl: Array
userID: Array
},
texts: {
linkHelp: String
}
}
You can configure application to use one social network you want.
Configured social networks:
TIPS: to use facebook in development mode, you will need to:
1 - If it's the first time you develop on application add 127.0.0.1 local.diadem.network
in your /etc/hosts
file
2 - Go to https://local.diadem.network:9000
Indeed, facebook force using https