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

@semiont/graph

v0.2.35

Published

Graph database abstraction with Neo4j, Neptune, JanusGraph, and in-memory implementations

Readme

@semiont/graph

Tests codecov npm version npm downloads License

Graph database abstraction with Neo4j, Neptune, JanusGraph, and in-memory implementations.

Installation

npm install @semiont/graph

Then install the peer dependency for your chosen graph database:

# For Neo4j
npm install neo4j-driver

# For Neptune or JanusGraph
npm install gremlin

# For Neptune with AWS SDK
npm install @aws-sdk/client-neptune

# MemoryGraph has no dependencies

Architecture Context

Infrastructure Ownership: In production applications, graph database instances are created and managed by @semiont/make-meaning's startMakeMeaning() function, which serves as the single orchestration point for all infrastructure components (EventStore, GraphDB, RepStore, InferenceClient, JobQueue, Workers).

The examples below show direct usage for testing, CLI tools, or standalone applications. For backend integration, see @semiont/make-meaning.

Quick Start

import { getGraphDatabase } from '@semiont/graph';
import type { EnvironmentConfig } from '@semiont/core';

const envConfig: EnvironmentConfig = {
  services: {
    graph: {
      type: 'neo4j',
      uri: 'bolt://localhost:7687',
      username: 'neo4j',
      password: 'password',
      database: 'neo4j'
    }
  }
};

const graph = await getGraphDatabase(envConfig);
await graph.connect();

// Create a document
const document = await graph.createDocument({
  id: 'doc-123',
  name: 'My Document',
  format: 'text/plain',
  entityTypes: ['Person', 'Organization'],
  archived: false,
  createdAt: new Date().toISOString(),
  updatedAt: new Date().toISOString()
});

// Create an annotation
const annotation = await graph.createAnnotation({
  id: 'anno-456',
  target: { source: 'doc-123' },
  body: [{ value: 'Important note' }],
  creator: 'user-123',
  created: new Date().toISOString()
});

// Query relationships
const annotations = await graph.getAnnotationsForDocument('doc-123');

Features

  • 🔌 Multiple Providers - Neo4j, AWS Neptune, JanusGraph, In-memory
  • 🎯 Unified Interface - Same API across all providers
  • 📊 W3C Compliant - Full Web Annotation Data Model support
  • 🔄 Event-Driven Updates - Sync from Event Store projections
  • 🚀 Optional Projection - Graph is optional, core features work without it
  • 🔍 Rich Queries - Cross-document relationships and entity searches

Documentation

Examples

Supported Implementations

Neo4j

Native graph database with Cypher query language.

const envConfig = {
  services: {
    graph: {
      type: 'neo4j',
      uri: 'bolt://localhost:7687',
      username: 'neo4j',
      password: 'password',
      database: 'neo4j'
    }
  }
};

AWS Neptune

Managed graph database supporting Gremlin.

const envConfig = {
  services: {
    graph: {
      type: 'neptune',
      endpoint: 'wss://your-cluster.neptune.amazonaws.com:8182/gremlin',
      port: 8182,
      region: 'us-east-1'
    }
  }
};

JanusGraph

Open-source distributed graph database.

const envConfig = {
  services: {
    graph: {
      type: 'janusgraph',
      host: 'localhost',
      port: 8182,
      storage: 'cassandra',
      index: 'elasticsearch'
    }
  }
};

MemoryGraph

In-memory implementation for development and testing.

const envConfig = {
  services: {
    graph: {
      type: 'memory'
    }
  }
};

API Overview

Core Operations

// Document operations
await graph.createDocument(document);
await graph.getDocument(id);
await graph.updateDocument(id, updates);
await graph.deleteDocument(id);

// Annotation operations
await graph.createAnnotation(annotation);
await graph.getAnnotation(id);
await graph.updateAnnotation(id, updates);
await graph.deleteAnnotation(id);

// Query operations
await graph.getAnnotationsForDocument(documentId);
await graph.findDocumentsByEntityTypes(['Person']);
await graph.findAnnotationsByTarget(targetId);

// Tag collections
await graph.getEntityTypes();
await graph.addEntityType('NewType');

Graph as Optional Projection

The graph database is designed as an optional read-only projection:

Works WITHOUT Graph

✅ Viewing resources and annotations ✅ Creating/updating/deleting annotations ✅ Single-document workflows ✅ Real-time SSE updates

Requires Graph

❌ Cross-document relationship queries ❌ Entity-based search across resources ❌ Graph visualization ❌ Network analysis

See Architecture Documentation for details.

Performance

| Provider | Setup | Speed | Scalability | Persistence | |----------|-------|-------|-------------|-------------| | Neo4j | Medium | Fast | High | Yes | | Neptune | Complex | Medium | Very High | Yes | | JanusGraph | Complex | Medium | Very High | Yes | | Memory | None | Very Fast | Low | No |

Development

# Install dependencies
npm install

# Build package
npm run build

# Run tests
npm test

# Type checking
npm run typecheck

License

Apache-2.0