CryptoKitties Contest App
Who's the cutest CryptoKitty?
This simple web app demonstrates a simple implementetion of the MEVN stack (MongoDB, Express, Vue and Node) plus adding public Ethereum Blockchain data via web3 injection.
- Every Kitty card is populated with info coming from the public Ethereum Blockchain, our own MongoDB and the CryptoKitties website API:
- Kitties name, and picture come from the CryptoKitties API.
- Kitties generation, genes and cakeday are read from the Blockchain .
- Kitties added to the contest and their votes are stored on MongoDB.
- Validation of Kitty ID is handled reading the CryptoKitties smart contract.
- Infura is used as web3 provider service since this simple app doesn't need to write on the blockchain.
Simple CRUD methods:
Method | Endpoint | Description |
---|---|---|
POST | /api/kitties | Add Kitty ID to contest and initialize votes with cero. |
GET | /api/kitties | Returns Array of kitties on contest and their votes. |
GET | /api/kitties/:id | Returns individual Kitty id and votes. |
POST | /api/kitties/:id/vote | Increments Kitty votes, returns kitty ID and votes. |
DELETE | /api/kitties/:id | Removes Kitty from contest, returns status. |
# install dependencies
$ yarn install
# serve with hot reload at localhost:3000
$ yarn dev
# build for production and launch server
$ yarn build
$ yarn start
# generate static project
$ yarn generate
For detailed explanation on how things work, check out Nuxt.js docs.
For easy deployment, this app was containarized with a Dockerfile. MongoDB is orchestrated via docker-compose which also sets the needed enviroment viarables.
$ git clone https://github.com/delta575/cryptokitties-contest.git
$ cd cryptokitties-contest
$ cd cryptokitties-contest
$ cp .env.example .env
Variable | Description |
---|---|
BASE_URL | Axios base URL, defaults to localhost, must be changed on deployment. |
DATABASE_URL | MondoDB URL, useful for development, override with docker-compose on deployment. |
WEB3_PROVIDER | URL of web3 provider, you can use Infura.'s service or point to your own node |
$ docker-compose up -d --build
$ docker-compose logs -f
$ docker-compose stop