Welcome to FIL-Frame, a starter repository designed to help developers quickly get started with building decentralized applications (dApps) on the Filecoin network. This repository provides various integration options, including an example template using Lighthouse.
- FIL-Frame
FIL-Frame is a monorepo that includes two main packages:
hardhat
: Manages the blockchain-related aspects, including smart contract development, deployment, and testing.
nextjs
: Handles the frontend and API aspects of the project using Next.js.
This repository is designed to be a quickstart for developers new to the Filecoin ecosystem, providing various integration options to suit different needs.
FIL-Frame unlocks several unique features that make it an ideal starting point for developers looking to build decentralized applications (dApps) on the Filecoin network:
-
On-Chain File Storage Deals: FIL-Frame enables developers to create and manage file storage deals directly on the blockchain (FVM) via smart contracts. This ensures transparency, security, and immutability for storage transactions.
-
Seamless Integration with FVM: The repository provides built-in support for Filecoin's EVM compatible network, allowing developers to easily interact with the Filecoin network and leverage its decentralized storage capabilities, using tooling they're already familiar with.
-
Multiple Storage Onramp Options: FIL-Frame offers various storage onramp options, including Lighthouse, Storacha and Akave, giving developers the flexibility to choose the solution that best fits their needs.
-
Comprehensive Smart Contract Management: With Hardhat integration, developers can efficiently develop, deploy, and test smart contracts, easing the workflow for developers.
-
User-Friendly Frontend: The Next.js frontend provides a modern and responsive interface for interacting with the blockchain, making it easier for users to engage with the dApp.
These features make FIL-Frame a powerful and versatile tool for developers entering the Filecoin ecosystem, providing all the necessary components to build robust and scalable decentralized applications.
Ensure you have the following installed:
- Clone the repository
git clone https://github.com/FIL-Builders/fil-frame
cd fil-frame
- (Optional) Switch to a different starter kit branch Available branches include:
lighthouse-nfts
: Integration with Lighthouse for decentralized storage.
storacha-nfts
: Integration with Storacha for decentralized storage.
akave-integration
: Integration with Akave for decentralized storage.
- Install dependencies
yarn install
or
npm install
- Copy the sample environment files, and fill in the required values:
cp packages/hardhat/.env.example packages/hardhat/.env
cp packages/nextjs/.env.example packages/nextjs/.env.local
- Update the environment variables in the
.env
files with your own values.
The create-filecoin-app
CLI tool helps you quickly set up a Filecoin-ready repository. It offers two modes: interactive mode and flag mode.
To use the interactive mode, simply run:
npx create-filecoin-app
You will be prompted to answer a series of questions to configure your new project. This includes your project name, and selecting your preferred storage onramp option (Lighthouse, or Storacha).
If you prefer to skip the prompts, you can use the flag mode to specify your options directly. For example, to initialise a project named my-app
, with lighthouse as the storage onramp:
npx create-filecoin-app my-app --lighthouse
This command initializes a new repository named my-app
with Lighthouse as the storage onramp.
The flags available currently include:
--lighthouse
: this initializes a project using lighthouse as the storage onramp--storacha
: this initializes a project using storacha as the storage onramp--akave
: this initializes a project using akave as the storage onramp
- Lighthouse: Decentralized storage solution for NFTs and other data.
- Storacha: Decentralized hot storage network - the dazzling revitalization of Web3.Storage.
- Akave: L2 storage chain powering on-chain data lakes for scalable, secure, and cost-effective data management.
After running the CLI, your new project will be set up and ready for development with your chosen storage onramp.
- Copy the sample environment files, and fill in the required values:
cp packages/hardhat/.env.example packages/hardhat/.env
cp packages/nextjs/.env.example packages/nextjs/.env.local
- Update the environment variables in the
.env
files with your own values. (Note that theNEXT_PUBLIC_ALCHEMY_API_KEY
value is optional)
To compile and deploy the smart contracts:
yarn compile
yarn deploy
or
npm compile
npm deploy
To start the Next.js frontend:
yarn dev
or
npm run dev
The application will be available at
https://localhost:3000
Fil-Frame, with the Lighthouse integration.
The repository includes a template which makes use of Lighthouse for decentralized storage, and is available in the lighthouse-nfts
branch.
To use this integration:
- Login to Lighthouse and generage an lighthouse API key.
- Ensure you add the Lighthouse API key set in your
.env.local
file:LIGHTHOUSE_API_KEY=your_lighthouse_api_key
- then you can started the fil-frame app with command:
yarn dev
ornpm run dev
- Use the provided integration to upload files to Lighthouse
Coming soon.
To use fil-frame with Akave integration, you need to follow the instructions to setup the env to use Akave to store data for your projects.
- Make sure you install and run docker in your machine.
- Pull the akavelink docker image using
docker pull akave/akavelink:latest
. - Run the docker container to spin up a Akave local api endpoint that can be used for bucket and file operations. Learn more on Akave docs.
docker run -d \ -p 8000:3000 \ -e NODE_ADDRESS="connect.akave.ai:5500" \ -e PRIVATE_KEY="your_wallet_private_key" \ akave/akavelink:latest
- In case you're using a different port for your api make sure you update
AKAVE_BACKEND_URL
in your .env file.
To learn more how to use Akave to create bucket and upload on front-end, visit Akave docs.
my-app/
βββ packages/
β βββ hardhat/
β β βββ contracts
β β βββ deploy
β β βββ scripts
β β βββ .env.example
β β βββ README.md
β β βββ package.json
β β βββ ...
β βββ nextjs/
β βββ app
β βββ components
β βββ contracts
β βββ hooks/fil-frame
β βββ utils/fil-frame
β βββ .env.example
β βββ package.json
β βββ ...
β
βββ LICENSE
βββ package.json
βββ README.md
βββ ...
We welcome contributions!
This project is licensed under the MIT license. See the LICENSE file for details.