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

@pintahub/database-schemas

v5.7.1

Published

Shared Mongoose schema definitions for PintaHub microservices. This package is the single source of truth for all MongoDB data models — services import schemas from here to ensure consistency.

Readme

@pintahub/database-schemas

Shared Mongoose schema definitions for PintaHub microservices. This package is the single source of truth for all MongoDB data models — services import schemas from here to ensure consistency.

Installation

yarn add @pintahub/database-schemas

Peer dependencies (must be installed by the consumer):

  • mongoose ^9.1.3
  • schemis ^2.0.2

Usage

This package does not work standalone — it ships raw schemas that are registered through the schemis library.

1. Set up the database store

// src/connections/database.js
const {createConnection, createStore} = require('schemis')
const schemas = require('@pintahub/database-schemas')

const uri = process.env.MONGODB_URI || 'mongodb://localhost:27017/dev'
const connection = createConnection(uri)

const store = createStore({
    connection,
    schemas
})

module.exports = store

2. Use models in actions

const {getModel} = require('../../connections/database')

const Product = getModel('Product')

const product = await Product.findOne({_id: productId, store: storeId}).lean()
await Product.updateOne(
    {_id: productId},
    {$set: {status: 'active', updated_at: Date.now()}}
)

3. Populate references with explicit model

const {getModel} = require('../../connections/database')

const TransferJob = getModel('TransferJob')
const Product = getModel('Product')
const Store = getModel('Store')

const items = await TransferJob
    .find({store: storeId})
    .populate({path: 'product', model: Product, select: {title: 1, code: 1}})
    .populate({path: 'destination_store', model: Store, select: {name: 1}})
    .lean()

Directory Structure

schemas/              # Main schema files (~60 schemas)
schemas/types/        # Embedded sub-document types (BrandSettings, FacebookObject, …)
schemas/products/     # Product-specific embedded types (MediaObject, SeoObject, VideoObject)
index.js              # Exports the absolute path to schemas/ for schemis to load

Schema Catalog

Field-level documentation lives in JSDoc comments inside each schema file. This catalog is a quick map.

Accounts & Auth

Account, User, Store, Shop, ShopifyAPI

Products

Product, ProductFeature, ProductImage, ProductRaw, ProductType, ProductTag, ProductImport, Customize, CustomField, FieldSetting

Collections & Groups

Collection, Group, GroupItem, GroupArtwork

Orders & Fulfillment

Order, OrderItem, Fulfillment, Payout

Content & Pages

Post, Menu, MenuItem, AnnouncementBar

Media & Assets

Image, Artwork, Media, MediaUpload, TempUpload

Analytics & Tracking

StoreEvent, LatestEvent, RecentView, SearchTerm, FavoriteItem, TrackPage, MarketingCost

Short URLs

ShortUrl, ShortDomain, ShortLog, LogURL

Jobs & Events

ExportJob, TransferJob, WebhookEvent

Settings & Config

StoreSetting, BlockedLocation, Publication, ShopifyObject

Reports

CreatorReport, ProductReport

Reviews

Review

Embedded Types

schemas/types/: BrandSettings, DMCASetting, FacebookObject, FooterSetting, FreeShippingSetting, GoogleAnalytics, KlaviyoObject, MerchizeSettings, SocialsObject, TopBarSettings, TrustpilotObject

schemas/products/: MediaObject, SeoObject, VideoObject

schemas/ (root, embedded): MoneyObject, ImageObject, DimensionObject, PriceRange, FieldSetting

Conventions

  • Each schema file exports a Mongoose Schema (not a Model) — consumers register models themselves via schemis.
  • Multi-tenancy: most domain schemas include a store ObjectId ref, indexed for query performance.
  • Timestamps: schemas use explicit created_at / updated_at Date fields (not Mongoose's timestamps option).
  • Status fields use string enums (e.g. 'active'|'inactive', 'pending'|'completed'|'failed').
  • Embedded types in schemas/types/ and schemas/products/ are declared with {_id: false}.
  • TTL indexes are used for ephemeral data (events, webhooks, page tracking).
  • Text indexes exist on Product (title, alternative_title, code, tags) and Order (name, id, email, phone).
  • The Product schema also exposes a precomputed display_title field (alternative_title || title) for storefront search/display. Consumer services are responsible for setting it at write time.

Querying Tips

  • Use .lean() for read-only queries — returns plain objects instead of Mongoose documents.
  • Use .populate() with an explicit model parameter when crossing collections.
  • Use Promise.all() for independent queries (e.g. find + countDocuments).
  • Always filter by store for multi-tenant data.

Versioning

This package follows semver:

  • Patch — JSDoc / docs only.
  • Minor — new fields, new schemas, new indexes (backward compatible).
  • Major — removing/renaming fields or schemas, changing field types, breaking index changes.

Bump the version in package.json whenever a schema change is committed.