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

@saplings/sdk

v0.18.0

Published

Server-side TypeScript SDK for multi-tenant applications. It combines tenant-scoped data, authorization, identity and gateway integration, storage, billing, events, and background jobs behind one configured instance.

Readme

@saplings/sdk

Server-side TypeScript SDK for multi-tenant applications. It combines tenant-scoped data, authorization, identity and gateway integration, storage, billing, events, and background jobs behind one configured instance.

Install

Use Node.js 26.13.1 or newer in the Node.js 26 line. The SDK uses ESM and ships TypeScript declarations.

npm install @saplings/sdk

Create and read a project

Save this as quickstart.mts and run node quickstart.mts. The fixture uses an in-memory store and a server-created actor.

import { createSapling, defineSaplingConfig, type ActorContext } from '@saplings/sdk';

const sdk = createSapling(
  defineSaplingConfig({ app: { id: 'my-app', environment: 'development' } }),
);

const actor: ActorContext = {
  tenantId: 'demo-tenant',
  actorId: 'demo-user',
  permissions: ['projects:read', 'projects:write'],
};

const created = await sdk.projects.create(actor, { name: 'First project' });
console.log(await sdk.projects.get(actor, created.id));
console.log(await sdk.readiness());

For HTTP requests, derive the actor from a verified session or an authentication adapter. Keep tenant and permission decisions on the server. Use sdk.authorize(actor, permission, resource) for application-specific actions and translate SaplingError into the appropriate response for your framework.

SDK signatures

| Entry point | Signature or result | | --- | --- | | defineSaplingConfig | <T extends SaplingConfig>(config: T): T preserves the configuration's inferred type. | | createSapling | (config: SaplingConfig): SaplingSDK creates the SDK instance. | | sdk.projects.create | (ctx: ActorContext, data: JsonRecord): Promise<ResourceRecord> creates a tenant-scoped record. | | sdk.projects.get | (ctx: ActorContext, id: string): Promise<ResourceRecord \| undefined> reads a record in the actor's tenant. | | sdk.projects.list | (ctx: ActorContext, options?: { limit?: number; offset?: number; filter?: JsonRecord }): Promise<ResourceRecord[]> lists visible records. | | sdk.authorize | (ctx: ActorContext, permission: string, resource?: Record<string, unknown>) checks access and throws when denied. | | sdk.invokeCapability | <I extends FeatureId>(ctx: ActorContext, id: I, action: FeatureAction<NoInfer<I>>, input?: JsonRecord) invokes a catalog action. Provider results need application validation. | | sdk.featureManifest | Lists registered feature actions. sdk.getCapability(id) and sdk.listCapabilities() expose catalog metadata. | | sdk.readiness | Runs configured probes and reports a ready, degraded, or unready state. | | sdk.closeRealtime | (): Promise<void> closes the configured realtime hub. |

SaplingConfig starts with app.id and app.environment. Supply infrastructure through providers, application policies through services and access, and verified context through hooks.resolveRequestContext or providers.authentication. The published .d.ts files and SDK source describe the remaining service methods.

Log and trace SDK operations

Use @saplings/observability for backend logs, traces, and metrics. Construct it with your service name and pass the returned object as providers.telemetry to wire SDK log events to the same sink as your application.

Prepare a deployment

  • Inject a durable providers.store such as the Drizzle adapter. Apply the database migrations, run with a restricted database role, and verify tenant isolation.
  • Wire providers for features your application enables. Test provider failures, webhook verification, retries, and idempotency using your deployment configuration.
  • Use sdk.defender.preflight() before bounded request parsing and sdk.middleware() after parsing. Signed webhooks need access to the original request bytes.
  • Register background handlers with sdk.automation.register and run sdk.worker.run in a worker with a trusted tenant context source and a shutdown signal.

See the configuration reference, Saplings Starter, and release validation guide.