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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hobo-db

v1.0.2

Published

<img src="docs/static/logo.gif" width="256px" alt="the logo (needs to be a logo, right?)"/>

Downloads

2

Readme

HoboDB: Json Storage on AWS SimpleDB

Want to store JSON objects in a database on AWS but don't want to spend a trillion dollars per year? 🤯🫰💰

It's easy with HoboDB and AWS SimpleDB! 🥰💖

AWS SimpleDB is a highly available NoSQL data store service that is very affordable because it does not have continuous infrastructure costs like other AWS database services. You just pay (a tiny amount) for each query.

HoboDB (this package) is a tiny zero-dependency Javascript library providing mechanisms to store arbitrary JSON objects in AWS SimpleDB, preserving as much of the hierarchical structure as possible within the SimpleDB service limits.

While AWS SimpleDB it is dead-simple to maintain, as the name implies, it is not simple to use. SimpleDB comes with a series of arcane and easily-exceeded limits, as described in the appropriately titled documentation page: "Limits".

These limits mean developers need to think carefully about the textual size of the items they store in this database, so it's best suited for use cases like metadata indexing (like storing a record and pointer each time an S3 object is created). Out of the box, these limits are really strict:

  • There cannot be more than 256 key/value pairs in an Item (database entry)
  • The item values cannot be longer than 256 characters.
  • Nested values are not supported (only an array of key / value pairs)

If you want to store arbitrary JSON objects as items in SimpleDB without losing heirarchy or searchability, you need to flatten and serialize the object to efficiently use the space and capacity available.

Features

  • Flattens JSON object to a series of key-value pairs 'Attributes' expected by SimpleDB
  • Automatically 'explodes' long string values into multiple numbered attributes
  • Follows spec for encoding invalid characters

Install

npm install hobo-db

Usage

Just import the deserialize and serialize functions into your Javascript application:

import { serialize, deserialize } from "hobo-db"

To write a JSON object to SimpleDB as an Item:

let serializedItemAttributes = serialize(YOUR_ITEM)

SDB.putAttributes({
    DomainName: YOUR_SDB_DOMAIN,
    ItemName: YOUR_ITEM_NAME,
    Attributes: serializedItemAttributes
  })

To retrieve and deserialize a JSON object from a SimpleDB Item:

let RETRIEVED_ITEM = await SDB.getAttributes({
    ItemName: YOUR_ITEM_NAME,
    DomainName: YOUR_SDB_DOMAIN
  })
    .promise()
    .then(deserialize)

Usage with SDB.select() and Array.map() for an array of items returned by a query:

let res = await SDB.select({
SelectExpression: `select * from \`${YOUR_SDB_DOMAIN}\``
}).promise()
  .then(data => data.map(deserialize))

Contributing

Of course I would love to receive feedback and pull requests to make this tiny library better. 💙

Kudos

Thanks to Diana Pinchuk (@pinchukdiana) for organizing the amazing Open Source Day event at Zivver which encouraged me to open-source this library.

Thanks to Samuel Prevost @usr-ein for the branding / project name ideas and the cool SVG animation tooling with Crayon!