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

@shmaplex/xplant-sdk

v0.1.0

Published

Official JavaScript/TypeScript SDK for the xPlant external API

Downloads

33

Readme

@shmaplex/xplant-sdk

Official JavaScript/TypeScript SDK for the xPlant external API.

Connect sensors, Raspberry Pis, Arduino devices, scripts, and external tools to your xPlant lab workspace.

npm version CI License: CSL v1.1

Note: This package is temporarily published as @shmaplex/xplant-sdk. It will be re-published as @xplant/sdk once the @xplant npm org is available. A deprecation notice and migration guide will be added at that time — no API changes required.


Installation

npm install @shmaplex/xplant-sdk
yarn add @shmaplex/xplant-sdk
pnpm add @shmaplex/xplant-sdk

Requires Node.js 18+. Works in browser environments too (uses the native fetch API).


Quick start

1. Get an API key

Go to xPlant → Settings → Integrations → API Keys and create a key with the scopes your integration needs.

Keep your key out of version control — use an environment variable:

export XPLANT_API_KEY="xpk_live_your_key_here"

2. Install and use

import { XPlantClient } from "@shmaplex/xplant-sdk";

const client = new XPlantClient({
  apiKey: process.env.XPLANT_API_KEY!,
});

// Post a temperature reading from a sensor
await client.sensorReadings.create({
  device_id: "your-device-uuid",
  type: "temperature",
  value: 24.5,
  unit: "C",
});

// Send a heartbeat to confirm the device is online
await client.devices.heartbeat("your-device-uuid");

// Read plants in your workspace
const plants = await client.plants.list();

Resources

client.sensorReadings

// Post a reading (write:sensor_readings scope)
await client.sensorReadings.create({
  device_id: string;
  type: "temperature" | "humidity" | "co2" | "lux" | "ph" | "ec" | string;
  value: number;
  unit: string;        // "C", "%", "ppm", "lux", "pH", "ms/cm", etc.
  timestamp?: string;  // ISO 8601 — defaults to now
  location_id?: string;
  notes?: string;
});

// List recent readings for a device (read:sensor_readings scope)
const readings = await client.sensorReadings.list("device-uuid");

client.devices

// Heartbeat — confirms device is online (write:device_events scope)
await client.devices.heartbeat("device-uuid");

// Register a new device
await client.devices.register({
  name: "Growth Room 1 — Temp/Humidity",
  type: "sensor",
  hardware: "esp32",
});

// Get device metadata
const device = await client.devices.get("device-uuid");

client.plants

// List plants (read:plants scope)
const plants = await client.plants.list({ limit: 50 });

// Get a single plant
const plant = await client.plants.get("plant-uuid");

client.tasks

// List due tasks (read:tasks scope)
const tasks = await client.tasks.list({ due: "today" });

client.labels

// Resolve a QR/barcode scan to an xPlant record (read:labels scope)
const result = await client.labels.resolve("QR_CODE_STRING");
// result.entity_type → "plant" | "explant" | "media_batch" | ...
// result.entity_id   → UUID of the matched record

Error handling

import { XPlantClient, XPlantError } from "@shmaplex/xplant-sdk";

try {
  await client.sensorReadings.create({ ... });
} catch (err) {
  if (err instanceof XPlantError) {
    console.error(`API error ${err.status}:`, err.body);
    // err.status === 401 → check your API key
    // err.status === 403 → key missing required scope
    // err.status === 429 → rate limit exceeded
  }
  throw err;
}

TypeScript

Full type definitions are included — no @types/ package needed.

import type {
  SensorReadingPayload,
  SensorReading,
  PlantSummary,
  TaskSummary,
  LabelResolveResult,
  XPlantApiResponse,
} from "@shmaplex/xplant-sdk";

Hardware examples

See the xplant_os repository for complete hardware examples:

  • ESP32 + DHT22/BME280 — temperature and humidity sensor posting to xPlant
  • Raspberry Pi gateway — Python bridge for MQTT/serial sensors
  • ESPHome — YAML config templates
  • Tasmota — webhook rules

Contributing

See CONTRIBUTING.md. Issues and PRs welcome.


License

Licensed under the Common Sense License (CSL) v1.1.

  • Free for individuals, nonprofits, researchers, and businesses under $10M revenue.
  • Large-scale commercial users must contribute back proportionally (13.37% of attributable revenue).
  • Ethical use restrictions apply.
Copyright (C) 2025 Shmaplex

This source code is licensed under the Common Sense License (CSL) v1.1.
You may obtain a copy of the license at: https://github.com/shmaplex/csl