Lens Protocol: Build a Decentralized Social Media Network Stored on IPFS
Learn how to build a decentralized social media network stored on IPFS.
What is Lens Protocol?
1. First, we need a Filebase IPFS bucket.
2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

4. Next, download and install S3FS-FUSE on a Linux or macOS system.
5. Open a terminal window. Then, set up an Access Key file for use with S3FS-FUSE.
6. Mount your bucket.
7. Now, navigate into the mounted Filebase bucket.
8. Create a new folder for your project, then navigate inside that folder:
9. Clone the GitHub repository for this project:
10. Install and start the app with the command:
11. Navigate to localhost:3000. You will see the default app screen:
localhost:3000. You will see the default app screen:
12. Open the pages/api/api.js file and replace the existing code with the following:
pages/api/api.js file and replace the existing code with the following:13. Next, open the index.js file and replace the existing content with the following code:
index.js file and replace the existing content with the following code:14. Navigate into the components directory, then open the profiles.js file. Update the file’s content with the following code:
components directory, then open the profiles.js file. Update the file’s content with the following code:15. Open the next.config.js file and replace the content with the following:
next.config.js file and replace the content with the following:16. Save all changes. Then, start the app in development mode using the command:

17. If you click on a single profile, you will get an error 404 page, so let’s fix that. Open the pages/api/api.js code and add the following code:
pages/api/api.js code and add the following code:18. Then, open the pages/profiles/[id].js file and insert the following:
pages/profiles/[id].js file and insert the following:19. Now, if you click on an individual profile, you’ll see the user’s information:

20. Lastly, let’s add functionality to view the user’s publications. Open the pages/api/api.js file again and add the following code:
pages/api/api.js file again and add the following code:21. Then, replace the content in the [id].js with the following:
[id].js with the following:22. Now, you can click on a user’s profile and view their existing publications within their profile:

23. From here, you can style the website using TailwindCSS, or play around with comment and following functionality.
Last updated