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

@tulipes/mongoose

v0.1.1

Published

Mongoose models provider for Tulipes apps: connection, model registration and bootstrap behind core's models capability

Readme

@tulipes/mongoose

The Mongoose models provider for Tulipes apps. It connects, compiles every module's models/*.model.ts on the boot's own connection, runs bootstrap/*.bootstrap.ts, and closes the connection under core's shutdown deadline. Core itself no longer installs or imports Mongoose; an app without a database declares no provider and never pays for one.

Requires Node 24.x, mongoose@^8 as the app's own dependency (peer — the app's schemas and this provider must share one instance) and a core that ships the provider contract.

Select it

One line in the app's root package.json:

{ "tulipes": { "providers": { "models": "@tulipes/mongoose" } } }

and MONGO_URI declared by the app's sys core module (meta.variables.json) and set. Modules with models/ or bootstrap/ directories require the provider automatically; a module that only reads models declares "tulipes": { "requires": ["models"] } in its own manifest. Boot refuses an unmet requirement before any module code is imported. Installing this package without the declaration selects nothing; a MONGO_URI on its own connects nothing.

Use it

// modules/users/models/user.model.ts
import { Schema } from "mongoose";
import type { ModelDef } from "@tulipes/mongoose";

const userSchema = new Schema({ email: { type: String, required: true } });
export default { name: "User", schema: userSchema } satisfies ModelDef;

// anywhere after phase 8
const User = requireModels(ctx).get<UserDoc>("User");   // typed once this package is in the compilation
ctx.models.connection;                                   // the boot's own mongoose Connection

ModelDef, BootstrapFn and ModelStore moved here from @tulipes/core/db; ctx.models, requireModels and DatabaseCtx stay in @tulipes/core/boot.

Behavior

  • One connection per boot, serverSelectionTimeoutMS: 5000; ownership is registered with core before the connection is awaited, so a database that never answers is still closed by the failed-boot cleanup.
  • Models register in module load order; a second module registering the same name is a boot error naming both. def.schema must be a Schema from the same mongoose instance.
  • Bootstrap tasks run in backend and worker processes, never in script mode or runtime inspection, and only when registration reported nothing.
  • Global plugins (mongoose.plugin(...)) remain application code and apply because the app and this provider share the instance.

Versions

0.1.0-rc.2 (no source change since rc.1; republished with core 0.10.0-rc.2) requires core ^0.10.0-rc.1, the candidate that introduced the provider seam; install both with @next. See core's MIGRATING.md.