Deploy the app
This topic provides a detailed guide on deploying a frontend application into the blockchain. It includes steps for configuring environment variables, building and packaging the application, updating the blockchain settings, and accessing the deployed application through a web interface.
Prerequisites
- A dapp should be ready for the deployment.
- The dapp should be placed into the root of the frontend application file structure. An example can be found here.
Steps to deploy
-
Run the node to get the
blockchainRid
value, it can be found in the terminal of dapp logs.chr node start --wipe
-
Set the
.env
file by updatingNEXT_PUBLIC_BRID
to the newblockchainRid
value. -
Replace the empty Next.js configuration with the following:
const nextConfig = {
output: "export",
images: { unoptimized: true },
basePath: `/web_query/${process.env.NEXT_PUBLIC_BRID}/web_static`,
}; -
Build the frontend and package it using the command:
pnpm build
-
Add
webStatic
to yourrell/chromia.yml
file as shown below:blockchains:
asset_management:
webStatic: out # this attribute -
Update the blockchain to enable new queries by running:
chr node update
-
Navigate to the following URL to interact with your deployed webpage:
http://localhost:7740/web_query/<blockchainRid>/web_static
To learn more about developing production-ready dapps, visit the Chromia course page.