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

spectragraph

v1.0.0

Published

A unified, expressive query language for multiple data sources. Query databases, APIs, and in-memory data with the same syntax, automatic relationship linking, and powerful expressions.

Readme

SpectraGraph

A unified, expressive query language for multiple data sources. Query databases, APIs, and in-memory data with the same syntax, automatic relationship linking, and powerful expressions.

Quick Example

// Same query works across different data sources
const result = await store.query({
	type: "users",
	select: [
		"name",
		"email",
		{
			posts: [
				"title",
				"createdAt",
				{
					comments: [
						"content",
						{
							author: ["name"],
						},
					],
				},
			],
		},
	],
	where: { active: true },
	limit: 10,
});

// Works with: PostgreSQL, SQLite, in-memory data, REST APIs
// Handles relationships automatically with request optimization

Installation

npm install @spectragraph/memory-store
# or choose your store: postgres-store, sqlite-store, etc.

Basic Usage

import { createMemoryStore } from "@spectragraph/memory-store";

// Define your data schema
const schema = {
	resources: {
		users: {
			attributes: {
				name: { type: "string" },
				email: { type: "string" },
			},
			relationships: {
				posts: { type: "posts", cardinality: "hasMany" },
			},
		},
		posts: {
			attributes: {
				title: { type: "string" },
				content: { type: "string" },
			},
			relationships: {
				author: { type: "users", cardinality: "belongsTo" },
			},
		},
	},
};

// Create store with initial data
const store = createMemoryStore(schema, {
	initialData: {
		users: {
			1: {
				id: "1",
				type: "users",
				attributes: { name: "Alice", email: "[email protected]" },
				relationships: { posts: [{ type: "posts", id: "1" }] },
			},
		},
		posts: {
			1: {
				id: "1",
				type: "posts",
				attributes: { title: "Hello World", content: "My first post" },
				relationships: { author: { type: "users", id: "1" } },
			},
		},
	},
});

// Query with expressions
const analytics = await store.query({
	type: "users",
	select: {
		name: "name",
		postCount: { $count: "posts" },
		avgPostLength: { $avg: "posts.$.content.length" },
	},
});

console.log(analytics);
// [{ name: 'Alice', postCount: 1, avgPostLength: 13 }]

Use Cases

Backend Development

  • Database Abstraction - Switch between PostgreSQL, SQLite, or in-memory stores without changing queries
  • API Integration - Combine data from multiple services with unified query syntax
  • Microservice Data - Query across service boundaries with automatic relationship resolution

Frontend Development

  • Multi-API Coordination - Fetch related data from multiple endpoints in one query
  • Request Optimization - Minimize API calls with intelligent batching and caching
  • Data Transformation - Apply computations and aggregations client-side

Data Analysis

  • Expression-Powered Queries - Built-in aggregations, computations, and transformations
  • Cross-Store Analytics - Same analytical queries work on any data source
  • Dynamic Querying - Build queries programmatically for dashboards and reports

Custom Store Development

  • Store Builder Toolkit - Create stores for any data source using @spectragraph/core
  • Unified Interface - Implement once, compatible with entire SpectraGraph ecosystem
  • Query Processing - Built-in validation, normalization, and relationship handling

Available Stores

| Store | Use Case | Status | | --------------------------------------------------------- | ------------------------------------ | --------- | | @spectragraph/memory-store | In-memory data, testing, prototyping | ✅ Stable | | @spectragraph/postgres-store | PostgreSQL databases | ✅ Stable | | @spectragraph/sqlite-store | SQLite databases | ✅ Stable |

Advanced Query Examples

Filtering and Sorting

{
  type: "posts",
  select: ["title", "createdAt"],
  where: {
    published: true,
    createdAt: { $gte: "2024-01-01" }
  },
  order: [{ createdAt: "desc" }],
  limit: 5
}

Complex Expressions

{
  type: "companies",
  select: {
    name: "name",
    avgEmployeeSalary: { $avg: "departments.$.employees.$.salary" },
    topDepartment: {
      $first: {
        $orderBy: ["departments", { $desc: { $avg: "employees.$.performance" } }]
      }
    }
  }
}

Cross-Store Data Composition

// Same query pattern works across different store types
{
  type: "users",
  select: ["name", {
    posts: ["title", "createdAt", {
      comments: {
        select: ["content"],
        limit: 3
      }
    }]
  }],
  where: { active: true }
}

Documentation

Why SpectraGraph?

Instead of store-specific query languages:

-- PostgreSQL
SELECT u.name, p.title, c.content
FROM users u
LEFT JOIN posts p ON u.id = p.user_id
LEFT JOIN comments c ON p.id = c.post_id
WHERE u.active = true;

Write once, run anywhere:

// Same query works on PostgreSQL, SQLite, in-memory, or API stores
const result = await store.query({
	type: "users",
	select: [
		"name",
		{
			posts: [
				"title",
				{
					comments: ["content"],
				},
			],
		},
	],
	where: { active: true },
});

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

MIT © Jake Sower