Guide: Deploying Web App to BTFS (Part 2)

This guide introduces two methods to deploy the front-end of a web application on BTFS, and compares the differences between BTFS, CDN, and Amazon S3.

Method Two: Using BTFS CLI

Deployment Method

Installing BTFS Node

Please refer to: Install BTFS Node

Adding Files/Folders

Execute the btfs add command:

$ btfs add <file-name>

// Output
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <file-name>
 163 B / 163 B [=======================================================] 100.00%

$ btfs add -r <dir-name>

// Output
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-name/file-name>
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-name/file-name>
......
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-name>
 163 B / 163 B [=======================================================] 100.00%

Upload files to the BTFS network:

$ btfs storage upload <file-hash>

Checking Upload Status

$ btfs storage upload <session-id> status | jq '.Status'

Accessing Deployed Website

Open your browser and enter the URL: https://gateway.btfs.io/btfs/<file-hash> to view the deployed website.

Downloading Files

Execute the btfs get command:

// get file
$ btfs get <file-hash>


// get dir(files)
$ btfs get <dir-hash>

This will download the respective file from the BTFS network.

Deleting Files

To delete files from the network, run:

$ btfs rm <file-hash>
Subscribe to DeFi Simon
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.