The JavaScript SDK of the World Library: download and read books stored on Arweave, work with the library’s records, and read the library’s smart contracts on Gnosis.
The Universal MARC format (UNIMARC) is a widely used international standard for the representation and exchange of data in machine-readable form. It covers four metadata schemas for bibliographic, classification, authorities and holdings information.
The primary purpose of UNIMARC is to facilitate the international exchange of data in machine-readable form between national bibliographic agencies. The UNIMARC is maintained by the UNIMARC Committee.
A book, its authors and its subjects are made of the same elements as a UNIMARC record, identified with the same standards (ISBN, Dewey, Library of Congress). The definitions are published once, as @the_library/canonical-schemas, then compiled into @the_library/public, and every record built from them is stored on an immutable blockchain. It becomes a centralised standard for decentralised storage, open to everyone.
Property names in the reader’s language ○Designed
The schema follows i18n best practice, so @the_library/public can be generated in several languages: a French developer writes livre.titre, a Chinese developer 书.标题, for the same field.
LanguageCodeGenerated property
Englishengbook.title
Frenchfrabook.titre
Chinesezhobook.标题
Thaithabook.ชื่อ
Arabicaranot in the schema yet
The names are already in the schema; the published package is English-only for now.
From the Greek βιβλιοθήκη (bibliothḗkē): biblíon, book, and thḗkē, a case or repository. It is the word most languages use for the public institution (bibliothèque, biblioteca, Bibliothek, библиотека), here joined to tech.
Library
From the Latin liber, book, through librarium, a bookcase, and libraria, a bookshop. English is almost alone in using it for the institution: the French librairie, the Italian libreria and the Spanish librería are still bookshops.
Show a cover, then its PDF. Serve file-worker-v2.js and mu-worker-v2.js from dist/downloader/ at your site’s root.
import { preloadWorkersV2, GetImage, GetPdf, GetObjectUrl, revokeObjectUrl } from'@the_library/public/downloader';
import { Book } from'@the_library/public/models/models';
preloadWorkersV2(); // start the workers earlyconstbook=awaitBook.LoadAsync(bookId); // bookId: bigintimg.src =awaitGetObjectUrl(awaitGetImage(book.previewTxId));
constedition=book.getDefaultInstance('eng');
if (edition) frame.src =awaitGetObjectUrl(awaitGetPdf(edition.downloadTxId));
// when the reader closes it: revokeObjectUrl(frame.src)
3
Read records
Read the published registry, then boot the models engine from the collection it points to. Serve patch-worker.js from dist/models/ at the root. Books, people, tags and classification systems then load by ID.
No framework: installVanillaReactivity and subscribeRecord, plus the framework-free downloader.
04 · Entry points
One package. Four areas.
/downloader
+ /sw
Download, cache and render book PDFs, covers and pages; optional offline service worker.
/models
+ /models/models
The record engine: cache, reactivity, patches, search, trash, stats. Generated classes Book, Person, Tag, ClassificationSystem, Post.
/web3
+ /network · /registry · /auth
EVM read and write clients, session, subscriptions, registry manifest, signed consent messages.
/branding
+ /branding/assets/*
Shared branding and contact data, logos and favicon.
05 · The research
A public library as the blueprint.
The design of a public library (one shared collection, a personal copy for every reader, public records, open to everyone) is the blueprint for the framework. Each principle below pairs the library idea with the code that carries it.
01Running
A catalogue built from library standards
Identifiers: ISBN, ISSN, ISNI, ORCID. Classifications: Dewey, Library of Congress, UDC, Chinese, BBK, Thai and Colon. A book, its editions, authors and subjects line up with UNIMARC and MARC 21 bibliographic fields; the correspondence table is in @the_library/canonical-schemas.
No UNIMARC record converter is included.
constdraft=NewBookWithId(newId);
draft.setTitle('A Study in Scarlet','eng');
draft.validateIsbn();
// one validate<Standard>() per standard the model uses
02Running
Sovereign data
The shared catalogue is published on Arweave as compact binary sidecars. Every reader change is a patch saved under the reader’s own account on Gnosis. Book files come from Arweave and are cached in the browser.
awaitaddressLoader.loadManifest('production');
constcorpus=addressLoader.getCollectionCorpus('production');
// Factory.save() writes patches under the reader's account
03Running
One shared collection, your own copy
Everyone starts from the same canonical collection. A reader’s edits change their own copy; other readers receive them only by subscribing to that reader.
Deletions and moves are ordinary patches on the reader’s account, saved publicly on Gnosis. The SDK provides that trail; the ranking itself is computed outside this package. See research 01.
import { trashStore } from'@the_library/public/models';
trashStore.list(Tag.type); // ids currently deleted or !safetrashStore.count(Tag.type);
05Running
Identity: an account, not a person
On-chain, an account is an address, a username, a user ID, a country and a language. Accounts are pseudonymous, not anonymous.
import { useWeb3Session } from'@the_library/public/web3/vue';
const { activeAccount } =useWeb3Session();
// address · username · userId · country · language
06Running
Free to use
No paywalls, login walls or ads. Reading, searching and downloading need no account. Saving needs a member account ($2 (join the club, opens in a new tab), or created in bulk by a library); gas is topped up for members.
Property IDs are permanent, from an append-only dictionary. A storage contract is migrated with every record, never redeployed empty. Book files on Arweave are permanent. No network is hard-coded.
import { DEFAULT_CHAIN_ID } from'@the_library/network-config';
// chains are taken by role: production, staging
08Running
Work offline
An optional service worker answers /ar/<txId> from Cache Storage, so cached books load from plain URLs with or without a network.
Give a coding agent the SDK that runs datapond.earth, @the_library/public, and a short prompt, and it can build a new way into the same collection. This 3D library started from the prompt below.
margin-code · ~/world-library
> Build a futuristic 3D library in the browser, using @the_library/public from datapond.earth as the single source of truth. Give it two rooms: the Great Hall of the Library of Congress and the domed Reading Room of State Library Victoria. Show every classification system the library supports on the walls. Give the visitor a bow: an arrow that hits a wall opens a detailed view of that classification system, and choosing a category opens worldbibliotech.com on that topic.