Fauna: Host an Application on IPFS with IPFS Dedicated Gateways

Learn how to host a Fauna application on IPFS with IPFS Dedicated Gateways

What is Fauna?

FaunaDB is a distributed, multi-model, serverless, and cloud-native database that allows developers to easily store, manage, and query their data. Fauna applications can be built using a variety of programming languages and frameworks, including JavaScript, Python, and Java. They can be used for a wide range of use cases, including e-commerce, social media, gaming, and IoT.

Read below to learn how to host a Fauna application on IPFS with IPFS Dedicated Gateways.

Prerequisites:

1. To add Filebase as a pinning service, use the following command:

ipfs pin remote service add filebase https://api.filebase.io/v1/ipfs access-token

Replace access-token with your Filebase IPFS Pinning Service token. The access-token can be generated by navigating to the Filebase Access Keys page, then viewing the IPFS PInning Service API Endpoint. Click the drop down menu for 'Choose Bucket to Generate Token', then choose the IPFS Filebase Bucket you want to use.

Then copy the generated Secret Access Token:

2. Next, clone the following GitHub repository:

git clone https://github.com/fauna/todomvc-fauna-spa

3. Then, navigate into the newly created directory, install the dependent packages, and start the app:

cd todomvc-fauna-spa/

npm install

npm start

4. A new window will appear showing the default screen for this app:

5. Now it’s time to add the app’s files to IPFS. You can do so with the command:

ipfs add -r build

6. Once the files have been added to IPFS, they need to be pinned. You can pin them with the command:

ipfs pin add -r /ipfs/CID

Replace CID with the CID of the build folder that was returned at the end of the last command:

You will receive confirmation that your files have been pinned:

The folder will be present in your Filebase bucket from the dashboard:

7. Next, navigate to the Gateways page on the Filebase web console.

Filebase IPFS Dedicated Gateways are a feature only available to paid users. They are not available for users on the free tier.

8. Select the ‘Create Gateway’ button in the upper right corner.

9. A new window will open prompting you to provide a gateway name and select the gateway’s access level.

Gateway names are subject to the same naming restrictions as bucket names. All gateway names must be lowercase, between 3-63 characters, and must be unique.

10. Select ‘Public’, then select ‘Create Gateway’.

11. Next, click on the ‘Buckets’ option from the menu to open the Buckets dashboard.

12. View the IPFS Bucket that you uploaded to your app’s build folder.

13. Then, select the additional options menu for the folder.

14. Select ‘Set as Root’ from the list of options.

15. Then select the dedicated gateway you created earlier, then select ‘Set as Root Gateway’.

16. Now, when you navigate to your dedicated gateway’s URL, your Fauna app will be displayed:

If you have any questions, please join our Discord server, or send us an email at hello@filebase.com

Last updated