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

@devbie/newbie

v1.6.0

Published

newbie backend framework runtime

Readme

@devbie/newbie

npm version license

A batteries-included backend application framework runtime built on top of NestJS 11, Prisma 7 and Express 5. Newbie gives you a production-ready bootstrap in a single call — security middleware, validation, cursor pagination pipes, a layered exception-filter chain, extended Prisma access and optional self-reporting — without forcing you to wire it all together.

Features

  • One-call bootstrap — NewbieFactory.create() configures CORS, cookie parsing, body parsers, the global ValidationPipe, Helmet (production) and Swagger (development), then starts the HTTP server.
  • Global framework module — FrameworkModule.forRoot() installs config loading, rate limiting, HttpModule, a unified response interceptor and a five-layer exception-filter chain.
  • Extended Prisma integration — supply your generated PrismaClient and get a global PrismaService that supports client extensions registered after module initialization.
  • Query parameter pipes — cursor pagination, cursor slug, ordering and select/include/where parsing for Prisma-driven list endpoints.
  • Shared DTOs and utilities — pagination request/response DTOs plus crypto, datetime, array and other common helpers.
  • Observability built in — graceful shutdown with bounded request draining, watch-mode port-race recovery, and env-gated backend monitor probe (BACKEND_MONITOR_ENDPOINT + BACKEND_MONITOR_TOKEN) and module-hub reporter (MODULE_HUB_ENDPOINT + MODULE_HUB_TOKEN).

Requirements

@devbie/newbie is a runtime library; NestJS, Prisma and related packages are declared as peer dependencies so your project controls their versions:

| Peer dependency | Version | | -------------------------- | --------- | | @nestjs/common | ^11.0.0 | | @nestjs/core | ^11.0.0 | | @nestjs/platform-express | ^11.0.0 | | @nestjs/config | ^4.0.0 | | @nestjs/swagger | ^11.0.0 | | @nestjs/throttler | ^6.0.0 | | @nestjs/axios | ^4.0.0 | | @prisma/client | ^7.0.0 | | @prisma/adapter-pg | ^7.0.0 | | express | ^5.0.0 |

Installation

npm install @devbie/newbie

Quick start

Register FrameworkModule.forRoot() in your root module and pass your generated PrismaClient constructor:

// src/application/application.module.ts
import { Module } from "@nestjs/common";
import { FrameworkModule } from "@devbie/newbie";
import { PrismaClient } from "@generated/prisma/client";
import { ApplicationController } from "./application.controller";

@Module({
  imports: [FrameworkModule.forRoot({ prisma: { PrismaClient } })],
  controllers: [ApplicationController],
})
export class ApplicationModule {}

Then bootstrap with NewbieFactory:

// src/main.ts
import { NewbieFactory } from "@devbie/newbie";
import { ApplicationModule } from "./application/application.module";

async function bootstrap(): Promise<void> {
  await NewbieFactory.create(ApplicationModule, {
    swagger: { title: "My API" },
  });
}

void bootstrap();

The fastest way to get this structure is to scaffold a project with the companion CLI:

npx @devbie/newbie-cli create my-app

NewbieFactory options

NewbieFactory.create(rootModule, options) accepts the following options (every field is optional):

| Option | Type | Default | Description | | -------------------- | ----------------- | --------------------------------------- | -------------------------------------------------------------------------------- | | environment | string | ENVIRONMENT or development | development enables Swagger; production enables Helmet. | | port | number | PORT or 3000 | Port the HTTP server listens on. | | corsAllowedOrigins | string[] | ALLOWED_ORIGINS | Allowed CORS origins (credentials enabled). | | corsResolver | function | — | Custom function-style CORS resolver; replaces static origins. | | bodyLimit | string | 10mb | Maximum request body size. | | requestTimeout | number | 60000 | Request timeout in milliseconds. | | keepAliveTimeout | number | — | Keep-alive timeout in milliseconds. | | logger | string[] | LOG_LEVEL or ['log','warn','error'] | NestJS log levels. | | textBodyParser | boolean | false | Also parse text/plain bodies (for sendBeacon endpoints). | | beforeCors | function | — | Express middleware registered before the global CORS middleware. | | swagger | object \| false | enabled in development | Swagger config (title, description, version, path, default path /api). | | portRaceRecovery | boolean | false | Survive port races during nest start --watch under bind mounts. | | shutdownTimeoutMs | number | 10000 | Grace period for in-flight requests on SIGTERM/SIGINT. | | cluster | boolean | false | Run one worker per available CPU core. |

What the framework wires for you

  • cookie-parser, JSON/URL-encoded body parsers (and optional text parser).
  • CORS with credentials, plus the v4 (extended) Express query parser.
  • A global ValidationPipe with transform and whitelist enabled.
  • Helmet in production; Swagger UI (cookie + bearer auth) in development.
  • A global throttler guard (10000 requests / second per endpoint by default).
  • A response-shaping HttpResponseInterceptor.
  • Exception filters in priority order: throttler → Prisma → newbie → HTTP → catch-all, so every failure gets a consistent error envelope.

List endpoints and query pipes

Newbie ships pipes that translate query parameters into Prisma arguments:

  • WherePipe — parse a where query parameter into a Prisma filter.
  • OrderByPipe — parse ordering parameters.
  • SelectIncludePipe — parse select / include parameters.
  • CursorPipe / CursorSlugPipe — keyset (cursor) pagination parameters.

Shared DTOs (CommonListRequestDto, CommonListResponseDto, CommonGetByStringIdRequestDto, CommonGetByNumberIdRequestDto) keep list endpoints consistent across modules. The @Cookies() parameter decorator provides typed access to request cookies.

Environment variables

| Variable | Used for | | --------------------- | --------------------------------------------------------------------------------------------- | | ENVIRONMENT | development or production. | | PORT | HTTP listen port. | | ALLOWED_ORIGINS | Comma-separated CORS origin list. | | LOG_LEVEL | Comma-separated NestJS log levels (e.g. log,warn,error). | | MODULE_HUB_ENDPOINT | Full report URL; enables module-hub self-reporting when set together with MODULE_HUB_TOKEN. | | MODULE_HUB_TOKEN | Token sent to the module hub. |

When both MODULE_HUB_ENDPOINT and MODULE_HUB_TOKEN are present, the framework automatically sends a full snapshot on boot and a ping every 60 seconds. Reporting is fire-and-forget and never blocks application startup.

Related packages

License

MIT