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

@vcityio/api-client

v0.2.0

Published

Typed TypeScript SDK for the vcity public API (/api/v1/*).

Readme

@vcityio/api-client

Typed TypeScript SDK for the vcity public API (/api/v1/*). Generated from the live OpenAPI spec via openapi-typescript + openapi-fetch, wrapped with ergonomic resource methods that read like an SDK instead of a raw HTTP client.

Install

npm install @vcityio/api-client
# or
pnpm add @vcityio/api-client
# or
bun add @vcityio/api-client

Requires Node 20+ (uses fetch + WHATWG URL).

Authentication

Two Bearer token types are accepted:

  • vapi_… — long-lived org API keys generated from the vcity dashboard (Settings → API Keys). Use for integrations and server-to-server flows.
  • vcli_… — short-lived user tokens issued via the CLI device flow. Inherit the user's org permissions.

Quick start

import { createVcityClient } from '@vcityio/api-client';

const sdk = createVcityClient({
  token: process.env.VCITY_API_KEY,
  // baseUrl defaults to https://vcity.io
});

// Discover the principal behind the token
const me = await sdk.me.get();

// List products (paginated)
const { data, total, hasMore } = await sdk.products.list('my-org-slug', {
  limit: 50,
  visibility: 'public',
});

// Single product
const product = await sdk.products.get('my-org-slug', data[0].id);

Resources

Every list endpoint returns a paginated envelope: { data, total, skip, limit, hasMore }. Methods throw ApiClientError on any non-2xx response — see Error handling.

| Resource | Methods | |----------|---------| | sdk.me | get() | | sdk.orgs | get(orgId) · listMembers(orgId, opts?) | | sdk.products | list(orgId, opts?) · get(orgId, productId) · create(orgId, body) · update(orgId, productId, body) · delete(orgId, productId) | | sdk.events | list(orgId, opts?) · get(orgId, eventId) · create(orgId, body) · update(orgId, eventId, body) · delete(orgId, eventId) | | sdk.rooms | list(orgId, opts?) · get(orgId, roomId) · create(orgId, body) · update(orgId, roomId, body) · delete(orgId, roomId) | | sdk.bookings | list(orgId, opts?) · get(orgId, bookingId) | | sdk.orders | list(orgId, opts?) · get(orgId, orderId) | | sdk.quotes | list(orgId, opts?) · get(orgId, quoteId) |

Write methods (create / update / delete) require a key with the matching *:write scope. Deletes are soft: the row stays in storage with a deletedAt timestamp and is filtered from subsequent reads.

orgId accepts the org's slug or its tokenized id.

Error handling

import { ApiClientError, createVcityClient } from '@vcityio/api-client';

try {
  const product = await sdk.products.get('acme', 'unknown');
} catch (e) {
  if (e instanceof ApiClientError) {
    console.error(e.status);   // 404
    console.error(e.body);     // { error: { code: 'not_found', message: '…' } }
    console.error(e.url);      // 'https://vcity.io/api/v1/orgs/acme/products/unknown'
  }
}

Escape hatch — raw openapi-fetch client

Need fine-grained control (headers per request, the { data, error, response } tuple pattern, multipart uploads)? Drop down to the raw client:

const { data, error, response } = await sdk.raw.GET('/api/v1/orgs/{orgId}/products', {
  params: { path: { orgId: 'acme' }, query: { limit: 5 } },
});

sdk.raw is a fully-typed openapi-fetch Client<paths>.

Configuration

createVcityClient({
  baseUrl: 'https://staging.vcity.io',     // default 'https://vcity.io'
  token: 'vapi_…',                          // attached as `Authorization: Bearer <token>`
  fetch: customFetch,                       // optional — useful for refresh wrappers or test stubs
  headers: { 'x-trace-id': '…' },           // merged into every request
});

When you provide a custom fetch, the SDK calls it with a Request and expects a Response back. The default Authorization header is still set unless your custom fetch overrides it.

Rate limits

Responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. 429 responses include Retry-After. Quotas are tied to your org's vcity plan:

| Plan | Requests / day | |------|-----------------| | free | 1,000 | | starter | 50,000 | | pro | 500,000 | | enterprise | 5,000,000 |

A per-minute burst budget sits on top.

API reference

Full reference at https://vcity.io/docs/api — generated from the same OpenAPI spec this SDK is built from.

Support

Email [email protected] for SDK issues, feature requests, or API access problems.

Related

  • @vcityio/cli — official vcity command-line tool built on top of this SDK.

License

MIT © Otherwise SAS