npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsonos

v0.0.2

Published

JSON Operating System - A lightweight framework for building decentralized applications with JSON-LD

Readme

jsonos

JSON Operating System - A lightweight framework for building decentralized applications with JSON-LD

npm version License: AGPL v3

Features

  • Linked Data Native - Built for JSON-LD from the ground up
  • Zero Dependencies - Under 5KB gzipped
  • Format Agnostic - Preserve + Layer pattern keeps original data intact
  • Solid Ready - Works with Solid pods and any HTTP endpoint
  • TypeScript Support - Full type definitions included

Installation

npm install jsonos

Or use directly in the browser:

<script type="module">
  import { JsonOS } from 'https://esm.sh/jsonos';
</script>

Getting Started

import { JsonOS } from 'jsonos';

// Initialize with your storage endpoint
const os = new JsonOS({
  storage: 'https://pod.example/data/'
});

// Read JSON-LD data
const todos = await os.read('/todos.json');
console.log(todos);

// Each item has a computed _view layer
todos.forEach(todo => {
  console.log(todo._view.title);      // Normalized title
  console.log(todo._view.completed);  // Boolean completion status
});

// Write data back
await os.write('/todos.json', todos);

API Reference

new JsonOS(options)

Create a new JsonOS instance.

Options:

  • storage - Base URL for storage operations
  • fetch - Custom fetch function (for authentication)
  • prefixes - Additional prefix mappings for predicate expansion

os.read(path)

Read JSON-LD data from a path. Returns an array with view layer attached.

const data = await os.read('/tasks.json');
// Returns: [{ ...originalData, _view: { title, completed, ... }, _format: 'schema' }]

os.write(path, data)

Write JSON-LD data. Automatically strips view layer before saving.

await os.write('/tasks.json', tasks);

os.delete(path)

Delete a resource.

await os.delete('/tasks.json');

os.extractValue(item, ...predicates)

Extract a value from an item using multiple predicate attempts. Handles JSON-LD value objects and prefix expansion.

const title = os.extractValue(item, 'dc:title', 'dct:title', 'rdfs:label');

os.detectFormat(data)

Detect the format of JSON-LD data. Returns 'schema', 'wf', or 'unknown'.

os.clearCache()

Clear the internal read cache.

The Preserve + Layer Pattern

jsonos uses the "Preserve + Layer" pattern to handle different RDF formats:

// Original data is preserved
{
  "@id": "#task1",
  "@type": ["wf:Open", "wf:Task"],
  "dc:title": "Fix bug",
  "dct:created": "2024-01-15",

  // Computed view layer added
  _view: {
    title: "Fix bug",
    completed: false,
    created: "2024-01-15"
  },
  _format: "wf"
}

This allows you to:

  1. Display any format consistently in your UI
  2. Preserve all original properties
  3. Write back without losing data

Format Support

| Format | Detection | Read | Write | |--------|-----------|------|-------| | Schema.org (Task/Tracker) | ✅ | ✅ | ✅ | | wf: Workflow Ontology | ✅ | ✅ | ❌* | | Unknown JSON-LD | ✅ | ✅ | ✅ |

*wf: format is read-only to preserve original semantics

Using with Solid

import { JsonOS } from 'jsonos';
import { getDefaultSession } from '@inrupt/solid-client-authn-browser';

// After authentication
const session = getDefaultSession();

const os = new JsonOS({
  storage: session.info.webId.replace('/profile/card#me', '/'),
  fetch: session.fetch
});

// Now reads/writes are authenticated
const todos = await os.read('/public/todos.json');

Built-in Prefixes

jsonos expands these prefixes automatically:

| Prefix | URI | |--------|-----| | dc: | http://purl.org/dc/elements/1.1/ | | dct: | http://purl.org/dc/terms/ | | rdfs: | http://www.w3.org/2000/01/rdf-schema# | | schema: | http://schema.org/ | | wf: | http://www.w3.org/2005/01/wf/flow# | | solid: | http://www.w3.org/ns/solid/terms# |

Add custom prefixes:

const os = new JsonOS({
  prefixes: {
    'my:': 'https://example.org/vocab#'
  }
});

Examples

See the examples directory for complete working examples:

License

AGPL-3.0-or-later