This project integrates ResilientDB and IPFS to provide an API for managing file storage and metadata. It extends ResilientDB's functionality to support saving JSON "asset" files and additional file types.
The backend is built using FastAPI, and integrates with a Pinata IPFS node and ResilientDB via the Python SDK.
- Hosted Link: Resilient Files API
- Visit
/docsto view all available API endpoints. - Endpoints Overview: A detailed list of available endpoints can be found here.
Note: Avoid uploading large files bc I have pinata free tier lmao
main_server.py: The main FastAPI server file.main_server_local.py: The local version of the FastAPI server file.servertesting.py: A Python script for testing server functionality.resilientTest.py: A test script for validating ResilientDB integration.requirements.txt: Lists all Python dependencies for the project.
To run the project on custom IPFS Pinata nodes and/or a personal hosted ResilientDB instance:
- Edit
main_server_local.pyto set:db_root_url(ResilientDB URL)
- Modify endpoints as necessary for alternative IPFS configurations.
- If not using a custom setup, skip this step.
- Assuming you have already setup ResilientDB before
- If not, please refer here
- Navigate to the ResilientDB directory:
cd service/tools/kv - Start the Key-Value service:
./start_kv_service.sh
- Build the GraphQL service (first-time setup only):
bazel build service/http_server:crow_service_main
- Run the GraphQL API:
bazel-bin/service/http_server/crow_service_main service/tools/config/interface/client.config service/http_server/server_config.config
-
Download the IPFS binary:
wget https://dist.ipfs.tech/go-ipfs/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz
-
Extract and install IPFS:
tar -xvzf go-ipfs_v0.7.0_linux-amd64.tar.gz cd go-ipfs sudo mv ipfs /usr/local/bin/ -
Verify the installation:
ipfs --version
You should see
ipfs version 0.7.0. -
If running IPFS for the first time, initialize it:
ipfs init
-
Start the IPFS daemon:
ipfs daemon
source venv/bin/activateEnsure all Python dependencies are installed:
pip install -r requirements.txtRun the following command to start the FastAPI server:
uvicorn main_server_local:app --reload- IPFS Connection Issues: Ensure the IPFS daemon is running (
ipfs daemon) and accessible atlocalhost:5001. - ResilientDB Errors: Confirm the Key-Value service and GraphQL API are active and configured correctly.
- Environment Issues: Use a virtual environment to isolate dependencies:
python3 -m venv venv source venv/bin/activate
- The
ipfs-goandipfshttpclientversions must match (e.g.,v0.7.0). - Ensure all services (ResilientDB Key-Value, GraphQL API, and IPFS daemon) are running before launching the application.