{"id":29219880,"url":"https://github.com/protofire/op-middleware","last_synced_at":"2025-07-03T02:07:44.595Z","repository":{"id":42815520,"uuid":"268512481","full_name":"protofire/op-middleware","owner":"protofire","description":"POC middleware to use Filecoin as a storage strategy.","archived":false,"fork":false,"pushed_at":"2023-01-24T02:51:16.000Z","size":717,"stargazers_count":2,"open_issues_count":20,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-04-10T04:54:32.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/protofire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-01T12:12:46.000Z","updated_at":"2021-09-14T06:42:31.000Z","dependencies_parsed_at":"2023-02-13T13:30:45.596Z","dependency_job_id":null,"html_url":"https://github.com/protofire/op-middleware","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/protofire/op-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fop-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fop-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fop-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fop-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protofire","download_url":"https://codeload.github.com/protofire/op-middleware/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protofire%2Fop-middleware/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245313,"owners_count":23436515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-03T02:07:43.737Z","updated_at":"2025-07-03T02:07:44.576Z","avatar_url":"https://github.com/protofire.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# op-middleware\n\nPOC middleware to [allow Ocean Protocol Commons marketplace back IPFS files in Filecoin network](https://gist.github.com/mgarciap/63914166df3946b344a54f88318cbc22).\n\nThe middleware is meant to run alongside with Ocean Protocol Commons. To that end a special fork has been created to make evident what the middleware does and the interaction with Filecoin (a deeper and full integration can be performed at the Brizo level, which may be more suitable for private/special marketplaces).\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Environmental assumptions](#Environmental-assumptions)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Install\n\nClone the repository and install dependencies:\n\n```\ngit clone https://github.com/protofire/op-middleware.git\nnpm install\n```\n\n## Usage\n\nop-middleware is an express/nodejs application that relies on Textile's Powergate and MongoDB (via Mongoose).\n\nThe development environment is assumed to be running [Powergate's devnet setup](https://docs.textile.io/powergate/devnet/#devnet-with-powergate) plus a MongoDB instance. At the moment of writing this documentation, Powergate's tag [`v0.0.1-beta.10`](https://github.com/textileio/powergate/releases/tag/v0.0.1-beta.10) is assumed to be used.\n\nA separate file in this repository describes [how to setup the development environment](DEVELOPMENT_ENVIRONMENT_SETUP.md).\n\nTo configure the port that `op-middleware` will use to expect requests, the Powergate server URI, MongoDB connection URI and other environmental variables create a copy of the file `.env.example` named `.env` and edit the corresponding values.\n\n```sh\ncp .env.example .env\n```\n\nOnce the development environment is ready, `op-middleware` can be started in development mode running the following:\n\n```sh\nnpm run start:dev\n```\n\nRun unit tests/run tests in watch mode:\n\n```sh\nnpm test\nnpm run test:watch\n```\n\nBuild the project and run it:\n\n```sh\nnpm run start\n```\n\nFor further information about the npm scripts, check the `script` attribute in the `package.json` file.\n\nAlternatively, one can build and run the project using the following docker-compose command that will also spin up a MongoDB instance. Note that the environment variables defined in `docker-compose.yaml` will affect the `op-middleware` instance started this way:\n\n```sh\ndocker-compose -p op-middleware -f docker-compose.yaml up\n```\n\n## API\n\nThe file `op-middleware.postman_collection.json` in the root of the project is a [Postman](https://www.postman.com/) collection that details how the requests and endpoints work.\n\n## Environmental assumptions\n\n### About FIL management and Powergate settings\n\nop-middleware relies on the features provided by Powergate's FFS module: when an FFS instance is created a wallet is generated and assigned to it with a configurable funds amount from a master address (also configurable). These settings should be configured accordingly to fund the middleware actions.\n\nTo limit the FIL expenditure the following was considered:\n\n- File size limit: `op-middleware` env variable, should limit the kind of files that will be stored on Filecoin and pinned in the IPFS node.\n- Initial wallet funding: by configuring a master wallet or setting the corresponding FFS wallet funds.\n- Cid configuration: Powergate may be configured in a conservatibe-way and the following features will be disabled by default to prevent automatic deals and FIL expenses,\n  - store multiple replicas of the files in Filecoin\n  - trigger retrieval-deal when a managed file (cid) is not found on the hot storage\n  - repair/renew storage deals\n\n### Interacting with Filecoin remote network\n\nThe *local-devnet* (configured by _Textile's devnet_) is used for development but the environment that resembles the final/main network is non-local or known as \"remote network\". At the time of writing this documentation there are two remote (and public) Filecoin networks: the [`Testnet`](https://docs.lotu.sh/en+join-testnet) and the [`Devnet`](https://docs.filecoin.io/how-to/build-interacting-with-the-network/#devnet). Powergate aims for the latest code on Lotus/master so a _Testnet_ node should be used when configuring the environment for op-middleware + a remote network.\n\nAfter setting the Lotus node and syncing with the network, FIL can be requested for the corresponding wallet(s) using the Faucet linked on the instructions web. All the details about \"remote network\" can be consulted on the [Filecoin Docs - Interacting with the network](https://docs.filecoin.io/how-to/build-interacting-with-the-network/#running-your-own-remote-network)\n\n## Maintainers\n\n[@protofire](https://github.com/protofire)\n\n## Contributing\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\nMIT © 2020 ProtoFire\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fop-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotofire%2Fop-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotofire%2Fop-middleware/lists"}