Broccoli is a decentralized Application (dApp) for the Ethereum Virtual Machine (EVM), able to be run on a blockchain itself. It provides a smart contract using an escrow system for buying and selling any goods.
The frontend is developed with Vue and TypeScript and makes it possible to interact with the smart contract through an easy-to-use webpage.
Package management is done by npm.
First, install the dependencies:
npm installStart the webserver on localhost:
npm run devThe smart contract is located in the directory ethereum-contract. It consists of a truffle project for deploying and testing.
First, change into the directory:
cd ethereum-contractCheck the truffle-config.js file. It describes how truffle should handle deployment. Check out the truffle docs for syntax and examples.
Compile the contract:
truffle compileFor dev usage, start truffles own blockchain instance:
truffle developDeploy the contract:
truffle migrateOr: test the contract:
truffle testTesting the contract can also be called from the projects root directory through npm run test:truffle
===============================================================
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
See Vite Configuration Reference.
npm installnpm run devnpm run buildRun Unit Tests with Vitest
npm run test:unitRun End-to-End Tests with Cypress
npm run build
npm run test:e2e # or `npm run test:e2e:ci` for headless testingLint with ESLint
npm run lint