Closed guybedford closed 1 year ago
The window for the viability of this specific project collaboration has now closed. Further work in this space is still very much on the roadmap, albeit longer term without there being a clear funding model in place. I'm always happy to discuss this space, if and when there is any interest.
Hi @guybedford, thank you for sending an update regarding the project window. Do you have an interest in submitting a revised proposal that aligns with your current roadmap? If so, I would be very happy to include this in our next review cycle this month (as opposed to it being added to our queue).
Hi @ErinOCon thanks for the suggestion here. The proposal would need to be reworked quite a bit for there no longer being this collaboration in place, but an alternative simpler project might be possible. Can you let me know what the deadline would be for submitting this new proposal? Would this repo still be the right place for that?
Hi @guybedford, the next review cycle is expected to begin in the next couple weeks, but we would be happy to work with you if more time is needed.
If the updated submission is geared more towards a new project instead of a revised project, I recommend submitting a new proposal and sending notice on this thread when it is ready for review.
Happy to discuss further as needed!
Open Grant Proposal:
Universal Optimized Dynamic Module Linking with IPFS, Import Maps & JSPM
Name of Project: JSPM IPFS Integration
Proposal Category:
integration-adoption
Proposer: Guy Bedford on behalf of the JSPM Foundation
(Optional) Technical Sponsor:
If you have previously discussed this project with a member of the IPFS or Filecoin project teams and they have agreed to be a technical sponsor, include their name and/or github handle here
Do you agree to open source all work you do on behalf of this RFP and dual-license under MIT, APACHE2, or GPL licenses?: Yes
Project Description
JSPM Project Background
The JSPM JavaScript ES module CDN has been running for almost 10 years, and serves more than 3.5TB of optimized executable JavaScript directly to the browser with over 600m+ JavaScript module requests to 10m+ unique IPs per month.
JSPM uses the relatively new web browser feature, Import Maps, to directly map dependencies on the npm package ecosystem to their optimized edge-cached versions on the JSPM CDN, working directly with the native ES module loader in the browser. In this way JavaScript becomes not only a dynamically executed language, but also a dynamically linked language against universal executable URLs at runtime. The benefit of this approach is that instead of browsers downloading multi-megabyte bundles of JS that often contain 90% duplications of existing dependency code, shared dependency code loading can be maintained through localized edge caching directly to the browser.
Project Proposal
The JSPM CDN uses unique URLs with far-future expires for all requests, and previously support was added to the JSPM generator import map generation system to allow generating import maps directly from code hosted on IPFS URLs (https://github.com/jspm/generator/pull/79).
Extending this technique to supporting npm dependencies being loaded directly from IPFS shows promise as a future CDN model, since JSPM is a push-based package builder and not pull-based, there is a clear technical congruency on this path for the current JSPM CDN to migrate from being a centralized CDN system to become a fully decentralized universal module delivery system on top of Filecoin and IPFS.
The project proposal would be to create a version of the JSPM CDN npm package builder and CDN codebase that can also serve as a Filecoin and IPFS service based on integrating this support into the existing CDN codebase that is already running the JSPM CDN today. Further, the proposal is to set up this node infrastructure to be fully decentralized such that anyone could run a distributed node in the system, with optional sharding rules for contributing to only a subset of the 2m+ packages available on npm for smaller nodes.
The proposed project would therefore, as a side effect, involve fully open sourcing the JSPM builder code base, an intricate job given the nature of the project’s development over many years. The combined announcement would be a major milestone for the project as a whole.
This vision would only fully come into its own with support for IPFS and IPFS URLS in import maps in browsers (dependent on having “ipfs://” listed as a “fetch scheme” in the browser). In the mean time, the project would rely on demonstrating the use of IPFS CDN mirrors, server-side workflows via Node.js / Deno / Bun IPFS URL support, and in custom browser builds with direct IPFS support, fully implementing and sharing these workflows as deliverables of the project.
Value
The benefit of the project would be proving out an entirely fundamentally new model of distributed link-time execution with shared edge caching without the need for a centralized CDN. The JSPM CDN as it exists today is a centralized service and point of trust. While it does support a multi-CDN model for users choosing to use any CDN provider, ideally hash-integrity should be maintained for all requests, based on an initial user verification phase during import map creation. IPFS is ideally and uniquely suited to this role.
One risk might be failing to generate enough excitement and providing a poor implementation - if execution is not done to a high enough standard, and users appreciate but decide the concept is not good enough in practise, then that could lead to a bad impression of import maps and this type of dynamic linking approach resulting in users sticking to more traditional CDN approaches instead.
The project is made difficult due to the lack of browser support for IPFS URLs. As described in the proposal section, we can provide demonstrations through custom browser implementations and instrumentation of Node.js with import maps support. The benefit here might then be driving awareness and in turn specification work and adoption in browsers.
Deliverables
The project can be divided into three main parts - the distributed node architecture, the import map generation support, and the workflow demo creation and marketing of the concept.
JSPM CDN Distributed Node with an IPFS “flag”
In order to get optimized npm dependencies on IPFS, this would be a new open source project, open sourcing the “JSPM package builder” in a way that anyone can run a distributed node. The node would have configuration options for sharding or push or pull-based builds. In addition it could run a traditional server or it could be passed an IPFS flag to run an IPFS Node serving the same package content over IPFS. This forms the bulk of the project as a large infrastructure integration, including getting the open source project to a full release-ready state including comprehensive testing, polishing and documentation.
Implement IPFS as a “provider layer” in the JSPM Generator project.
The JSPM Generator project is the open source tool that creates import maps against the JSPM CDN. It implements a distributed version of the Node.js module resolution algorithm, and was created by Guy Bedford who was one of the main developers of the Node.js modern module resolution algorithm. While the JSPM Generator project already supports the generation of import maps against code hosted on IPFS URLs, these import maps themselves still reference the JSPM CDN. The deliverable would thus be to add support for the generation of import maps that reference dependencies on IPFS URLs.
Workflow Demos
Workflow demos will be constructed to show:
Development Roadmap
Month 1 - Setting up the Distributed CDN Package Builder Project Structure
Month 2 - Distributed Builder MVP Completion
Month 3 - IPFS Workflow Bootstrapping
Month 4 - Complete & Polish Workflow Demonstrations
Month 5 - Project Launch
Fully integrate these new workflows into the JSPM project and core technical documentation, including:
Exact timeframes will vary by milestone.
Total Budget Requested
The JSPM CDN currently builds every single package on npm, which costs over $2000 worth of Google Cloud compute each month. We have sponsorships from 37 Signals, TeleportHQ, Socket.io, Framer, and Scrimba, which just covers exactly this amount, but this cost is gradually increasing while there are also remaining overheads of the foundation such that there is still negative cash flow of the region of -$1000 per month.
A portion of the grant ($10,000) would go towards sponsoring the JSPM Foundation directly. Guy Bedford does not take any salary or compensation from the JSPM Foundation, and will not be taking any fee for project management and the running of regular meetings with Guy Paterson-Jones so this would entirely go towards infrastructure costs for the JSPM project.
$30,000 / $5000 per month for 5 months.
Maintenance and Upgrade Plans
Since this project integrates IPFS into the JSPM core product, the JSPM CDN builder, maintenance will be guaranteed by the JSPM Foundation which is set up to ensure the sustainable maintenance and support of the entire JSPM project for the long-term. The project has been going for 10 years already, so there is some precedent for long-term support.
The project will not guarantee the hosting of an IPFS mirror of the JSPM CDN permanently on the JSPM infrastructure however, since this would add unnecessary costs to the already large infrastructure costs of the project. But the IPFS integration in the CDN node architecture as an option would continue to be maintained over time with the goal to switch over to it eventually in future as a long-term goal of the project to fully migrate to this approach.
Team
Team Members
Project-specific members:
The JSPM Foundation itself consists of the following members:
Team Member LinkedIn Profiles
Team Website
https://jspm.org
Relevant Experience
Guy Bedford has been involved closely with the growth of JavaScript modules in browsers. As a TC39 member he wrote the specification for top-level await and as a Node.js core contributor provided a significant amount of the implementation of Node.js’s integration of JavaScript modules, including implementing a lot of the Node.js module resolver code for ES modules. He has also been a long-time contributor to the import maps specification and is also the author of the import maps polyfill in browsers, ES Module Shims. Previously he created the SystemJS module loader for browsers. He is the creator of the JSPM project, the longest running dedicated native modules CDN for JavaScript, and the first to provide a CDN for import maps.
Guy Patterson-Jones collaborated with Guy Bedford on JSPM back in 2015, and while Patterson-Jones can usually be found climbing the mountains of Switzerland or thinking about Mathematical logic has been looking for a new project to get his teeth into recently. His recent experience working on the Bacalhau compute project make him uniquely suited in having experience in both the JSPM project and the Filecoin and IPFS projects.
Team code repositories
JSPM Projects
Guy Bedford Open Source
Guy Patterson-Jones Open Source
Additional Information
I’ve been a long-time follower of IPFS, and this has been on my mind for a very long time.
Contact guybedford@gmail.com to discuss the grant agreement and next steps.
I’m happy to arrange a meeting anytime to discuss the project details further. And questions / feedback / refinements to the proposal are also very welcome.