Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Should we dial the modularization a bit down? Do we all see the value on having everything as a module? #2222

Closed
@daviddias

Description

@daviddias

Disclaimer: This proposal is not about going monorepo. Please read the full thread :)

I've been thinking a lot on building quality, maintainability and robustness on software and taking a peek at other languages and ecosystems to drive inspiration. One of the thoughts out of that journey is the simple question: Do we all see the value on having everything as a module?

For context, I'm one of the main culprits to which IPFS is so modularized. In fact, when I joined the project in 2015, it was pretty much a massive go-ipfs repo, with the exception of multiformats. I then took on js-ipfs as a greenfield project and applied the best of what I understood on modularization as a value which I believed to add a lot to a protocol stack that prioritizes interoperability, future proofing and maintainability. Looking backwards, I'm happy we all onboarded the modularization train as it enables IPFS to run on Node.js and the Browser, use a multitude of transports, some that hadn't been invented yet, and overall sets IPFS and libp2p on the track to iterate and adapt as systems evolve.

All of that said, I do think that there are some artifacts of this modularization goal that actually add cost without any gains. This is specially true when we focus on parts of the "engine" that are unique and integral to the system as a whole and non usable elsewhere.

One of the clear examples is js-libp2p and js-libp2p-switch in which we spent countless hours doing sync releases, duplicating code (the top level API is pretty much the same), duplicating documentation efforts, duplicating tests and adding overhead to the developers that had to tinker with both modules (and repos) at the same time. js-libp2p-switch is an integral part to the js-libp2p dialing engine and would be better off living inside js-libp2p itself.

There are other examples and looking at things such as #1670, we can quickly gauge how much it costs to have this over-modularization.

If this resonates with others, I'll go ahead and make a short proposal of where I believe we could head to reduce overhead/admin work:

IPFS side

  • Merge into js-ipfs, the following modules:
    • ipfs-multipart
    • js-ipfs-mfs
    • js-ipfs-repo
    • js-ipfs-block-service
    • js-ipfs-unixfs-exporter
    • js-ipfs-unixfs-importer

libp2p side

  • Merge into js-libp2p, the following modules:
    • js-libp2p-connection-manager
    • js-libp2p-identify
    • js-libp2p-keychain
    • js-libp2p-nat-mngr
    • js-libp2p-pnet
    • js-libp2p-ping
    • js-libp2p-switch
    • (potentially, need to think more) js-libp2p-circuit
  • Merge into libp2p-websocket-star, the following repo:
    • libp2p-websocket-star-rendezvous
  • Coalesce the multiple libp2p interfaces into js-libp2p-interfaces, these include:
    • interface-connection
    • interface-transport
    • interface-stream-muxer
    • interface-peer-discovery
    • interface-peer-routing
    • interface-content-routing

Looking forward to learn how people think about such transition.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions