Introduction

The importance of the deployment phase in the application development process cannot be over-emphasized. Your application goes from local hosting and personal viewing on your personal computer to online presence and visibility from just about every nook and cranny of the world.

Perhaps even more difficult to the average developer is the process of hosting decentralized applications constantly interacting with smart contracts and built on the blockchain.

While you can host applications on IPFS, it is a difficult task even for veteran developers. If the content changes, then the hash changes too and this can be an issue when it comes to updating a website. A single character change to an HTML file will create an entirely new hash!

Cue in Fleek…

What is Fleek?

Fleek is an web3 native venture studio and creator of the Fleek.co developer platform, which provides web services (e.g., hosting, storage, gateways, domains, and more) to developers that are built with the technologies that form the foundation for the web3 native (such as the Internet Computer, Ethereum, IPFS, Filecoin, ENS, HNS, and more).

Why Deploy Through Fleek & Host on the OpenWeb?

Fleek.co offers a simple workflow and looks to abstract all the potential of the Web3 technologies it leverages to provide a seamless way for any developer to build, host, store, and power sites, applications, or infrastructure built on the web3 native. It aims to eliminate the friction of building with these new technologies so that anyone, anywhere, can easily adopt and transition to the web3 native, without the technical complexities or friction points that developers would normally expect. Once you've pushed your changes to git, Fleek builds, pins, and updates your site.

Fleek has a guide to IPFS which you can read about here. You can also learn more about IPFS here. Fleek is built in a similar way to hosting providers like Netlify.

In this tutorial, you will be learning to deploy your decentralized React App and host it on IPFS using Fleek. When you are finished, you will be able to successfully deploy your React application to the web3 native easily with Fleek.

Prerequisites

This tutorial contains several hands-on steps. To follow along, you will need to have some knowledge of the following:

Let’s get started…

Step 1 - Creating A React Application

npx create-react-app react-fleek-app
cd react-fleek-app
npm start
Simple React Application Adding the homepage field to the package.json

Step 2 - Setting Up Your Git Repository And Pushing Your Repository

git remote add origin https://github.com/resourcefulmind/react-fleek-app.git
git branch -M main
git push -u origin main

Feel free to fork it. Let’s move on to deployment.

Step 3 - Deploying Your App Via Fleek

Fleek Sign Up options Connect Fleek To Github Choosing your repo

The default docker image is fleek/create-react-app which runs the latest node.js version (16 as of this writing). If you have an app requiring another version, you can specify it in the docker tag. Mine is fleek/create-react-app:node-16. Your build command should be:

npm && npm build

Application Deployment Starts Deployment Success Deployment Log Verify on IPFS

Conclusion

It takes very less time to create a react app and deploy to IPFS using Fleek. Fleek is beneficial because:

For additional stuff like Customizing a DNS, ENS or HNS Domain, do visit the Fleek documentation.

It is important to note that Fleek uses the data on GitHub in order to deploy the project. Therefore, your application must be pushed to Github and deployed from a production branch within its repository. This will allow Fleek to automatically redeploy the app whenever there is an iteration to the code.

Deployment can also be done through GUI or the Fleek CLI.

I hope this tutorial was helpful. If you have any questions, feel free to shoot me an email, g.bibeaulaviolette@gmail.com!