Creating your first Chainlet

Create Chainlet is a supported Chainlet creation tool that will allow you to quickly create Chainlets and add them to your project seamlessly.

You must first have node and make sure the node version is 16.0 or above.

Foundation

1 yarn create chainlet my-chainlet
# or npm create chainlet my-chainlet
# or pnpm create chainlet my-chainlet

Creating projects via CLI

bash

chainlet create my-chainlet

Installing Dependencies

bash

yarn

Open the URL from the console to view the running project.


Deploying

bash

yarn deploy

Two options of deployment

  1. Deploy directly via CLI

  2. Deploy to the Chainlet Store (with local validation on a Chainlet Server first)

Upload

bash

yarn upload

Will upload your package to the Chainlet Store.


Application Types

create-chainlet

Supports two types of Applications

  1. Single Application

  2. Combind Applications

Example:

bash

cd my-single-chainlet
npm install
chainlet dev

Terminal will output a launch address where you can preview your Chainlet.


Workflow Development

Edit code → changes will be reflected live in the browser.


Packaging and Publishing

Use the CLI for packaging:

bash

npm run bundle

Scripts configured by default

json

"scripts": {
  "dev": "chainlet dev",
  "eject": "vite eject",
  "serve": "vite preview",
  "lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
  "lint:fix": "npm run lint -- --fix",
  "start": "vite --host",
  "clean": "rm -rf .chainlet",
  "bundle": "npm run clean && vite build && chainlet bundle --zip --create-release",
  "deploy": "npm run bundle && chainlet deploy .chainlet/bundle",
  "upload": "npm run bundle && chainlet upload .chainlet/release/chainlet.json",
  "prepare": "husky install"
}

Now upload your Chainlet with:

bash

chainlet upload

Last updated