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

database

v0.0.2

Published

`database` is an npm module for communicating with databases.

Downloads

3,413

Readme

database

database is an npm module for communicating with databases.

ORMs and ODMs are Evil.

The database package is designed unlike other Node.js Object-Relation-Mappers and Object-Document-Mappers.

Most ORMs ( such as JugglingDB ) create a generic Model Class and API and expect developers to create adapters that conform to this generic Model Class specifcation.

This is a faultly design.

Different databases have different APIs for a reason. Trying to create a unified Model Class for every database in existence does not make sense and creates a myriad of software complexity. This approach more often than not will cause more problems then solutions. Most experienced developers will not even consider using solutions like JugglingDB.

Develop for the Database, not the Software Mapper

database is different from other ORMs in that all it really does is provide an extremely small try / require / configuration pattern around existing database modules. Instead of all database adapters trying to conform to a master Model Class, each database adapter is responsible for defining it's own methods and structure.

Instead of enforcing a generic structure on models for all databases, each database can define it's own model API.

Our goal is to create a semi-generic API for all databases where some API methods overlap and some are specific to that database's adapter. This way, the developer can use the API best suited for their desired database.

Why not just require the specific database package on it's own?

There is nothing wrong with this approach. If you readily know which package to use and how to use it, you should require it as a stand-alone module.

The database package at it's core can be considered a curated list of the best database packages available for Node.

Instead of having to search through NPM and Github for packages, you can simply require the database module and know that you will have a stable and working API for communicating with your application's database.

Supported Databases

Currently: None.

We have support for CouchDB in our resource module. We use CouchDB a lot, and our CouchDB adapter is full-featured. We'll be adapting Couch. If you want to add another database, please do so!

Adding new Databases

Adding new databases to the database package is easy. In most cases, it will be only take a few lines to require the database module and expose it's configuration methods.

For example: To add MongoDB support you would install the mongodb package, then map it's exported methods to a small mongodb.js database adapter. A one-to-one mapping of all methods would work. You could also take this opportunity to custom tweak the mongo package API in your wrapper.

License

MIT