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

syntro-sdk

v1.0.3

Published

Official JavaScript/TypeScript SDK for Syntro BaaS

Readme

syntro-sdk

Official JavaScript/TypeScript SDK for Syntro BaaS.

npm install syntro-sdk

Setup

import { Syntro } from 'syntro-sdk';

const syntro = new Syntro('sk_your_api_key', {
  baseUrl: 'https://api.syntro.run' // optional, this is the default
});

Events & Analytics

// Track a custom business event
await syntro.event('CUSTOM', 'cart_add', 'User added product to cart', {
  productId: 'prod_123'
});

// Track an error
await syntro.sendError('checkout_failed', 'Error loading checkout', {
  page: '/checkout',
  statusCode: 500
});

// Get event stats (for analytics dashboard)
const stats = await syntro.getStats();
// { summary: { custom: 12, error: 3, auth: 8, total: 23 }, events: [...] }

// Get stats for a specific type
const errorStats = await syntro.getStats('ERROR');

// List raw events
const { events, total } = await syntro.listEvents({ type: 'ERROR', limit: 20 });

Auth (ProjectUsers)

Register & Login

// Register a new user
const { user, token, error } = await syntro.register(
  'johndoe',           // username
  '[email protected]',  // email
  'password123'        // password (min 6 chars)
);

// Login with username
const { user, token, error } = await syntro.login('johndoe', 'password123');

// Login with email
const { user, token, error } = await syntro.loginWithEmail('[email protected]', 'password123');

Token Verification

// Verify a JWT token (e.g. sent in a request header)
const { valid, user, error } = await syntro.verifyToken(token);

if (valid) {
  console.log('Authenticated user:', user.username);
}

User Info

// Get full user object
const { user } = await syntro.getUser(userId);

// Quick accessors
const username = await syntro.getUsername(userId);  // e.g. "johndoe"
const email    = await syntro.getUserEmail(userId);  // e.g. "[email protected]"
const meta     = await syntro.getMetadata(userId);   // e.g. { plan: "pro", role: "admin" }

User Management

// Update a user's username or metadata (replaces metadata)
await syntro.updateUser(userId, { username: 'new_username' });
await syntro.updateUser(userId, { metadata: { plan: 'pro' } });

// Merge-update metadata (preserves existing keys)
await syntro.updateMetadata(userId, { onboardingDone: true });

// Delete a user
const { success } = await syntro.deleteUser(userId);

// List all users
const { users, total } = await syntro.listUsers({ limit: 50 });

Billing (Stripe Payments)

Accepting Payments in 3 Steps

Step 1: Configure Stripe in Syntro Dashboard

Go to Settings → Stripe in your Syntro project and add:

  • Stripe Secret Key (sk_live_...)
  • Stripe Webhook Secret (whsec_...)

Step 2: Add the Webhook in Stripe Dashboard

In Stripe → Developers → Webhooks, create a new endpoint:

URL: https://api.syntro.run/v1/billing/webhook/<YOUR_PROJECT_ID>
Events to listen for: checkout.session.completed

Step 3: Create a Checkout Session in Your App

const { url, error } = await syntro.createPayment('Premium Plan', 999, {
  currency: 'usd',                                  // optional, default: usd
  successUrl: 'https://yourapp.com/payment/success', // optional
  cancelUrl: 'https://yourapp.com/payment/cancel',   // optional
  customerEmail: '[email protected]',               // optional, pre-fills Stripe form
});

if (error) {
  console.error('Payment error:', error);
  return;
}

// Redirect customer to Stripe Checkout
window.location.href = url!;

Syntro will automatically:

  1. ✅ Verify the Stripe webhook signature
  2. ✅ Record the transaction in the database
  3. ✅ Log a payment_completed CUSTOM event
  4. ✅ Show it in your Transactions dashboard

List Transactions

const { transactions, total } = await syntro.listTransactions({
  limit: 50,
  skip: 0,
  status: 'paid'  // optional filter
});

Verify Payment

Check if a specific customer has already paid for a product. Great for unlocking digital features after payment.

const { paid, transaction, error } = await syntro.verifyPayment('[email protected]', {
  name: 'Premium Plan' // optional: filter by product name
});

if (paid) {
  console.log(`Verified! Customer paid on ${transaction.createdAt}`);
  // Unlock premium features...
}

API Reference

Full interactive documentation: api.syntro.run/docs

All Methods

| Method | Description | |--------|-------------| | event(type, name, message?, meta?, userId?) | Track any event | | sendError(name, message?, meta?) | Shorthand for ERROR events | | getStats(type?) | Get analytics stats | | listEvents(options?) | List raw events | | register(username, email, password) | Register a new user | | login(username, password) | Login with username | | loginWithEmail(email, password) | Login with email | | verifyToken(token) | Verify JWT and get user | | getUser(userId) | Get full user object | | getUsername(userId) | Get just the username | | getUserEmail(userId) | Get just the email | | getMetadata(userId) | Get user metadata object | | updateMetadata(userId, patch) | Merge-update metadata | | updateUser(userId, data) | Update username/metadata | | deleteUser(userId) | Delete a user | | listUsers(options?) | List project users | | createPayment(name, amount, options?) | Create Stripe Checkout → URL | | listTransactions(options?) | List payment transactions | | verifyPayment(email, options?) | Verify if a customer has paid |