Creating apps with Embark
Once Embark is installed, there are different ways to create a new decentralized application. Whether we intent to create an application that uses only Smart Contracts, or we want to take advantage of other decentralized features like storages and messaging, Embark provides options and templates for various scenarios. Let’s take a look!
As discussed in our quickstart guide, the fastest way to get up and running with Embark is using its
demo command. This will scaffold a new demo application and its needed environment in a folder called
embark_demo. The demo application lets you play with Embark’s APIs through a pre-built web interface.
$ embark demo
If you prefer starting entirely from scratch, while still getting a ready to use environment, Embark’s
new command has got you covered. Similar to the
demo command, it will scaffold a new project folder. However, it will not include the demo application. The green field is all yours.
Quick tip: Smart Contract only apps
Smart Contract developers that mainly want to focus on building and deploying Smart Contracts can take advantage of
--contracts-only option, as described here.
$ embark new <YourDappName>
Another possible scenario to start from is taking advantage of a template. Embark comes with templates for various environments and frameworks, but you can also use any template created by the community. In order to create a new app from a template, use the
--template option and either specify a supported template name, or a Git host URL.
The following example creates a new application from Embark’s TypeScript template:
$ embark new <YourDAppName> --template typescript
Templates can also be fetched from external resources as long as they can be referred to via Git host URLs. The following example fetches a template from a GitHub repository and uses that to create that app:
$ embark new <YourDAppName> --template https://github.com/embark-framework/embark-vue-template
In fact, in case of GitHub, the same can be done with the username/repository shortcut:
$ embark new <YourDAppName> --template embark-framework/embark-vue-template
It is even possible to specify the branch by appending a
# and the branch name you’re interested in:
$ embark new <YourDAppName> --template status-im/dappcon-workshop-dapp#start-here
Sometimes, all we really want to do is creating, developing, compiling and deploying Smart Contracts without introducing an actual front-end that talks to them. Embark lets us scaffold apps that come with the most minimal setup needed to build and deploy our Smart Contracts, using the
The following command will create a project with all Embark services disabled except the blockchain service.
$ embark new <YourDAppName> --contracts-only
This will also affect the generated application structure, as Smart Contract only apps are less complex. Learn more about the application structure of Smart Contract only apps here.
A note on --simple
In earlier versions of Embark the same could be achieved using the
--simple option. This option is still supported but will be deprecated and likely be removed in future versions of Embark.