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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@breadisbuns/anpan

v1.3.2

Published

<p align="center"> <img src="https://raw.githubusercontent.com/oslabs-beta/anpan/dev/assets/anpan-logo.png" /> </p>

Readme

Table of Contents

  1. Description
  2. Getting Started
  3. Query
  4. Additional Methods
  5. Open Source Information
  6. Authors
  7. License

Description

anpan is a lightweight Redis Object Mapper (OM) library built for the Bun runtime. Bun is an up-and-coming runtime environment for Javascript and Typescript that replaces Node.js. Bun’s v1.0 was released on September 8th, 2023, and has since demonstrated that they are 4x faster than Node.js and 2x faster than Deno. Since their release, many developers, like those working with a Redis database, are seeking to run their code in Bun for its speed and efficiency. Unfortunately, no Redis-specific library currently runs in the Bun runtime environment. anpan is a Redis OM that bridges the gap for developers working in Bun with a Redis database. anpan works to abstract away hard-to-understand and write syntax, that, when paired with the anpan webpage, helps even a new user learn Redis right away. anpan brings the familiarity of other databases and libraries, like MongoDB and Mongoose, allowing other NoSQL database users easy access and navigation.

Getting Started

Be sure that you have the Bun runtime installed and configured.

Quick Start

In your application, install the package from the NPM module.

bun i @breadisbuns/anpan

Next, require in the anpan module into your codebase.

const { Schema, Repository } = require('@breadisbuns/anpan');

Connect to your Database

Open a connection by requiring in createClient from Redis with the Redis cloud link found in your Redis dashboard, and using the connect method from Redis.

const { createClient } = require('redis');

const { client } = createClient({
  password: 'YOUR PASSWORD HERE',
  socket: {
    host: 'LINK TO CLOUD',
    port: 12179,
  },
});

await client.connect().then(console.log('Connected to Redis'));

Define Your Schema

Now, you can define your schema with the Schema method as shown below or by utilizing the schema generator on the anpan webpage:

const bakerySchema = new Schema('bakery', {
  name: { type: 'string', isRequired: true },
  owner: { type: 'string', isRequired: true },
  dateCreated: { type: 'date' },
  bakeryNum: { type: 'number' },
  location: { type: 'point' },
  bunsOffered: { type: 'string[]' },
});

Valid Datatypes include:

  • boolean
  • date
  • number
  • number[]
  • point
  • string
  • string[]
  • text

Create Your Repository

Set up a repository by invoking the Respository method with your schema name and client:

const theBakeries = new Repository(bakerySchema, client);

Add to Your Repository

You can now add to the repository by creating entities with your data as outlined in your schema:

const anpanBun = {
  name: 'Buns Unlimited',
  owner: 'May',
  dateCreated: new Date(2023, 1, 14),
  bakeryNum: 1,
  location: { longitude: 1, latitude: 1 },
  bunsOffered: ['Hotcross', 'Hotdog', 'Steamed'],
};

const mayBakery = await theBakeries.save(anpanBun); //adds entity to Redis database

Make a Query

Now, you can search and find items in your model. For example, if you wanted to look at the buns offered at May's Buns Unlimited bakery, you can fetch by ULID:

//---Targeting a ULID---
const mayULID = mayBakery.entityKeyName;
console.log(mayULID); //displays ULID in your console to fetch

//---Fetching w/ULID---
let fetchMay = await theBakeries.fetch(mayULID);
console.log(fetchMay); //will log fetched mayBakery

Congratulations! You have successfully imported anpan, connected to Redis client, created a schema and a repository, added an entitiy to your Redis database, and fetched May's bakery. Explore the rest of the README.md for more detailed instructions on how to use anpan.

Query

All queries in anpan are performed using repositories. All query methods are listed below:

  • getAllEntities
const allBakeries = await theBakeries.getAllEntities();
console.log(allBakeries); //Will log all stored bakeries!
  • getByString
const findString = await theBakeries.getByString('Kevin');
console.log(findString); //Will log all bakeries containing queried string
  • getByNumber
const findNumber = await theBakeries.getByNumber(1);
console.log(findNumber); //Will log all bakeries containing queried number

Additional Methods

Additional features and methods include:

  • update with save()
//---Update with save()---
fetchMay.bunsOffered.push('Melonpan');
fetchMay = await theBakeries.save(fetchMay);
console.log(fetchMay); //Will log with additional bun offered
  • remove with ULID
//---Remove w/ULID---
const dillonULID = dillonBakery.entityKeyName;
const deleteDillon = await theBakeries.remove(dillonULID);
console.log(deleteDillon); //Will log undefined
  • expire with ULID
//---Expire w/ULID---
const kellsyULID = kellsyBakery.entityKeyName;
const expireKellsy = await theBakeries.expire(kellsyULID, 10); //Will show countdown in RedisInsight, logs undefined after expiration

Open Source Information

If you would like to contribute to our product, let us know! Below are features and methods we would have liked to implement in our library. If you would like to propose a new feature or method, send us a message.

Contribution Guidelines

To contribute, fork and clone our repository. Once set up, any changes will need to be approved via Pull Requests. We ask that you include as much information and documentation for any changes made when you create a PR.

Running the library tests in dev mode

Once cloned, run the command:

bun test

Features and Methods:

| Feature | Status | | ------------------------------- | ------ | | Point search functionality | 🙏🏻 | | Pagination search functionality | 🙏🏻 | | Sorting functionality | 🙏🏻 |

  • ✅ = Ready to use
  • ⏳ = In progress
  • 🙏🏻 = Looking for contributors

Authors

  • May Wilcher

  • Kellsy Nava-López

  • Dillon Hale

  • Kevin Murphy

License

This product is licensed under the MIT License - see the LICENSE file for details.

This is an open-source product.

This product is accelerated by OS Labs.