{"id":49803,"library":"y-fdp-storage","title":"y-fdp-storage","description":"Yjs database provider using Swarm Feeds Sequential mechanism for decentralized document synchronization. Current version 0.2.13 (alpha). Released on GitHub with no fixed cadence. Key differentiator: uses Sequential feed (more efficient than Epoch), complete TypeScript implementation, avoids Beeson dependency for simplicity. Integrates with @ethersphere/bee-js and @fairdatasociety/fdp-storage. Suitable for building collaborative applications on Swarm/Ethereum Swarm network.","status":"active","version":"0.2.13","language":"javascript","source_language":"en","source_url":"https://github.com/molekilla/y-fdp-storage","tags":["javascript","web3","swarm","ethereum-swarm"],"install":[{"cmd":"npm install y-fdp-storage","lang":"bash","label":"npm"},{"cmd":"yarn add y-fdp-storage","lang":"bash","label":"yarn"},{"cmd":"pnpm add y-fdp-storage","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for CRDT document model","package":"yjs","optional":false},{"reason":"Required for Bee node connection","package":"@ethersphere/bee-js","optional":false}],"imports":[{"note":"ESM-only; named export from package","wrong":"const { FdpStoragePersistence } = require('y-fdp-storage')","symbol":"FdpStoragePersistence","correct":"import { FdpStoragePersistence } from 'y-fdp-storage'"},{"note":"Utility function to create signer from private key bytes","wrong":"import { makePrivateKeySigner } from 'fdp-storage'","symbol":"makePrivateKeySigner","correct":"import { makePrivateKeySigner } from 'y-fdp-storage'"},{"note":"Helper to convert hex string to Uint8Array","wrong":"import { hexToBytes } from '@ethersphere/bee-js'","symbol":"hexToBytes","correct":"import { hexToBytes } from 'y-fdp-storage'"},{"note":"Yjs default import; Doc is a named export but commonly used via namespace","wrong":"import { Doc } from 'yjs'; const doc = new Doc()","symbol":"Y.Doc","correct":"import * as Y from 'yjs'; const doc = new Y.Doc()"}],"quickstart":{"code":"import * as Y from 'yjs';\nimport { Bee } from '@ethersphere/bee-js';\nimport { hexToBytes, makePrivateKeySigner, FdpStoragePersistence } from 'y-fdp-storage';\n\n// Setup Bee connection\nconst postageBatchId = process.env.BEE_POSTAGE || '1c082c5e642e15d49b6689f5437c2eb9e6aa9c546a8ed1d11d0024b043bca371';\nconst bee = new Bee('http://localhost:1633');\n\n// Identity (private key hex)\nconst testIdentity = {\n  privateKey: '634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd',\n};\nconst wallet = makePrivateKeySigner(hexToBytes(testIdentity.privateKey));\nconst topic = '/crdt/document/test';\n\n// Create persistence\nconst persistence = new FdpStoragePersistence(bee, wallet, topic, postageBatchId);\n\n// Create Yjs document\nconst doc = new Y.Doc();\ndoc.on('update', async update => {\n  await persistence.storeUpdate(update);\n});\ndoc.getText('test').insert(0, 'Hello World');\n\n// Retrieve latest document\nconst latestDoc = await persistence.getYDoc();\nconsole.log(latestDoc.getText('test').toString()); // 'Hello World'","lang":"typescript","description":"Shows how to create a FdpStoragePersistence instance, connect to Bee, and sync Yjs document updates to Swarm Feed."},"warnings":[{"fix":"Update constructor call to include postageBatchId: new FdpStoragePersistence(bee, wallet, topic, batchId)","message":"Constructor signature changed: v0.2.0+ requires postageBatchId as 4th argument","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Use persistence.store(update) instead if you need to handle errors","message":"storeUpdate() method: silently catches errors; use store() for error propagation","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Ensure private key is lowercase and without 0x: '634fb5a8...' not '0x634f...'","message":"hexToBytes expects lowercase hex string without 0x prefix","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Call close() when no longer needed, e.g., on component unmount","message":"subscribe() returns a close function; forgetting to call it may cause memory leaks","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use storeUpdate() and subscribe() to keep a local doc in sync continuously","message":"getYDoc() only returns latest full state; incremental updates not tracked","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.2.13':19 'alpha':20 'applic':54 'avoid':40 'beeson':41 'build':52 'cadenc':27 'collabor':53 'complet':37 'current':17 'databas':6 'decentr':14 'depend':42 'differenti':29 'document':15 'effici':34 'epoch':36 'ethereum':63 'ethereum-swarm':62 'ethersphere/bee-js':47 'fairdatasociety/fdp-storage':49 'fdp':3 'feed':10,32 'fix':26 'github':23 'implement':39 'integr':45 'javascript':59 'key':28 'mechan':12 'network':58 'provid':7 'releas':21 'sequenti':11,31 'simplic':44 'storag':4 'suitabl':50 'swarm':9,57,61,64 'swarm/ethereum':56 'synchron':16 'typescript':38 'use':8,30 'version':18 'web3':60 'y':2 'y-fdp-storag':1 'yjs':5","created_at":"2026-06-07T17:03:40.916832+00:00","updated_at":"2026-06-07T17:03:40.916832+00:00","problems":[{"fix":"Use ES module import: import { FdpStoragePersistence } from 'y-fdp-storage'","cause":"Importing wrong symbol or using CommonJS require with ESM package","error":"TypeError: FdpStoragePersistence is not a constructor"},{"fix":"Ensure private key is exactly 64 hex characters (32 bytes) without 0x prefix","cause":"hexToBytes received hex string of incorrect length or with 0x prefix","error":"Error: Private key must be 32 bytes"},{"fix":"Check that postageBatchId is valid and funded on the Bee node","cause":"Invalid postage batch ID or insufficient batch depth/amount","error":"Request failed with status code 400"},{"fix":"Start Bee node on http://localhost:1633 or update the URL","cause":"Bee node not running or unreachable at the specified URL","error":"Failed to fetch"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/molekilla/y-fdp-storage#readme","github":"https://github.com/molekilla/y-fdp-storage","docs":null,"changelog":null,"pypi":null,"npm":"y-fdp-storage","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}