ar-io-node
ar-io-node copied to clipboard
feat(middleware): mechanism for extending gateway capabilities
Background:
Original conversation started on #27.
There is a desire to extend the gateway core functionality, adding new capabilities, for example like those described in ANS-101, ANS-108, and others. However it's also desirable not to have to modify the gateway core in order to do so. Firstly, because that would require gateway runners to modify core code in order to add capabilities, and secondly, it makes the core less stable and secure.
Problem:
We'd like a solution for adding gateway capabilities that is:
- Self-encapsulated - a capability-implementing module ought to be self-contained, and only have access to do things that core allows it to do
- Allows for sandboxed experimentation - there ought to be a way to add different capabilities and functionality, without affecting other gateway instances.
- Good developer experience - gateway runners ought to be able to add capability-implementing modules to their gateway instances seamlessly, ideally without having to write code.
Additional Notes:
A middleware-based solution seems to be a top contender, as it is by nature self-encapsulated.
I proposed a potential solution based on middleware in https://github.com/ar-io/ar-io-node/issues/27#issuecomment-1671639722 that satisfies 1 & 2 above. As far as 3, a natural extension of my solution could use CLI args to trigger dynamically pulling middleware-implementing code from the internet and to bootstrap the gateway with that middleware, on startup. I'd be happy to implement this in a fork, if it's easier to envision that way.