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

@themusicdev/bw-serve-client

v0.1.1

Published

Unofficial typed fetch client for the Bitwarden Vault Management API (bw serve)

Readme

@themusicdev/bw-serve-client

npm CI license

Typed, zero-dependency fetch client for the Bitwarden Vault Management API, the local REST server started by bw serve.

Unofficial. Not affiliated with, endorsed by, or sponsored by Bitwarden, Inc. "Bitwarden" is a trademark of Bitwarden, Inc.

  • Plain fetch, no runtime dependencies. Works on Bun, Node 18+, and Deno.
  • Fully typed; ships ESM + .d.ts.
  • Injectable fetch for tests and proxies.
  • Typed errors; secrets never end up in error messages.

Prerequisites

  1. Install the Bitwarden CLI and log in: bw login.
  2. Start the server: bw serve (defaults to http://localhost:8087).
  3. Unlock the vault, either by starting bw serve with BW_SESSION set, or by calling client.unlock(masterPassword).

Install

bun add @themusicdev/bw-serve-client
# or: npm i @themusicdev/bw-serve-client

Usage

import { BwServeClient, BwApiError, BwConnectionError, ItemType } from '@themusicdev/bw-serve-client';

const bw = new BwServeClient(); // { baseUrl, fetch, timeoutMs } all optional

const { status } = await bw.status(); // 'unauthenticated' | 'locked' | 'unlocked'
if (status === 'locked') await bw.unlock(process.env.BW_PASSWORD!);

// read
const logins = await bw.listItems({ search: 'github' });
const password = await bw.getPassword(logins[0]!.id);
const totp = await bw.getTotp(logins[0]!.id);

// write
const item = await bw.createItem({
    type: ItemType.Login,
    name: 'example.com',
    login: { username: 'me', password: await bw.generate({ length: 24 }), totp: null },
});
await bw.deleteItem(item.id); // to trash; { permanent: true } to erase

try {
    await bw.getItem('nope');
} catch (error) {
    if (error instanceof BwApiError && error.isLocked) { /* unlock and retry */ }
    else if (error instanceof BwConnectionError) { /* bw serve is not running */ }
    else throw error;
}

More in examples/.

API

| Area | Methods | |---|---| | Session | status, unlock, lock, sync, lastSync | | Tools | generate, getTemplate | | Items | listItems, getItem, createItem, editItem, deleteItem, restoreItem, archiveItem, moveItem | | Item fields | getPassword, getUsername, getUri, getTotp, getExposed | | Attachments | uploadAttachment, downloadAttachment, deleteAttachment | | Folders | listFolders, getFolder, createFolder, editFolder, deleteFolder | | Organizations | listCollections, listOrganizations, listOrgCollections, listOrgMembers, confirmMember |

Not yet supported: Bitwarden Send. Open an issue if you need it.

editItem replaces the whole item on the server side: fetch it with getItem, change it, and send it back.

Routes mirror oss-serve-configurator.ts in the Bitwarden CLI source.

Security notes

  • bw serve has no authentication. While the vault is unlocked, anything that can reach the port can read every secret. Keep the default localhost binding; never expose it to a network.
  • bw serve rejects requests carrying an Origin header (CSRF protection). Server-side runtimes don't send one, but browsers do, so this client is not meant for browser use.
  • unlock() returns the session key in raw. Don't log it.
  • This client never logs requests or responses, and errors carry only bw's message, status, method and path.

Report vulnerabilities privately: see SECURITY.md.

Development

bun install            # also installs lefthook git hooks
bun run lint           # biome
bun run check:types    # tsc
bun run test           # unit tests (mocked fetch)
bun run build          # tsc -> dist/
bun run check:package  # publint + are-the-types-wrong
BW_SERVE_URL=http://localhost:8087 bun run test:integration   # optional, needs a live bw serve

Commits follow Conventional Commits (enforced by commitlint). Releases are automated by release-please. See CONTRIBUTING.md and PUBLISH.md.

License

MIT