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

@alleen/prisma

v1.0.1

Published

Core NestJS module for alleen-api — dynamic multi-database Prisma registry

Readme

@alleen/prisma

⚠️ Important

This package cannot function on its own.
It is designed as a required dependency for alleen to work properly within a project.

👉 To correctly initialize a compatible project, use the official repository:
https://github.com/olivierAdou/alleen-api.git

Base Prisma service for alleen-api — connection management, retry, health checks.
Tous les services générés par @alleen/cli étendent automatiquement BasePrismaService.


Installation

npm install @alleen/prisma

Ce que ça remplace

Avant @alleen/prisma, chaque service généré avait son propre code de connexion :

// ❌ Avant — dupliqué dans chaque service
async onModuleInit() { await this.$connect(); }
async onModuleDestroy() { await this.$disconnect(); }

Après, le service généré fait juste :

// ✅ Après — 5 lignes, tout le reste est dans BasePrismaService
@Injectable()
export class PhoenixPrismaService extends BasePrismaService {
  constructor() {
    super('phoenix');
  }
}

BasePrismaService gère en interne :

  • Connexion avec retry automatique (3 tentatives par défaut)
  • Timeout de connexion configurable
  • Déconnexion propre au shutdown
  • Health check SELECT 1 par DB
  • Logging structuré par DB

Setup dans app.module.ts

import { AlleenPrismaModule }   from '@alleen/prisma';
import { PhoenixPrismaService } from './prisma/phoenix.service';
import { BulkPrismaService }    from './prisma/bulk.service';

@Module({
  imports: [
    AlleenPrismaModule.forRoot({
      services: [PhoenixPrismaService, BulkPrismaService],
      globalOptions: {
        retryAttempts:     5,
        retryDelay:        2000,
        connectionTimeout: 15000,
        verbose:           false,
      },
    }),
  ],
})
export class AppModule {}

Injection avec @InjectDb

Pour injecter une DB spécifique dans n'importe quel service :

import { Injectable }      from '@nestjs/common';
import { InjectDb, BasePrismaService } from '@alleen/prisma';

@Injectable()
export class OrderService {
  constructor(
    @InjectDb('phoenix') private readonly db: BasePrismaService
  ) {}

  async getOrders() {
    return this.db.order.findMany({ where: { status: 'ACTIVE' } });
  }
}

Health checks

import { PrismaHealthService } from '@alleen/prisma';

@Controller('health')
export class HealthController {
  constructor(private readonly health: PrismaHealthService) {}

  @Get()
  async check() {
    return this.health.checkAll();
  }
}

Réponse :

{
  "overall": "healthy",
  "databases": [
    { "database": "phoenix", "status": "up", "latency": 4, "checkedAt": "..." },
    { "database": "bulk",    "status": "up", "latency": 6, "checkedAt": "..." }
  ],
  "checkedAt": "2026-04-05T10:00:00.000Z"
}

overall vaut "healthy", "degraded" (certaines DBs down), ou "down" (toutes down).


Options de connexion

| Option | Type | Default | Description | |---|---|---|---| | retryAttempts | number | 3 | Tentatives avant d'abandonner | | retryDelay | number | 3000 | Délai entre tentatives (ms) | | connectionTimeout | number | 10000 | Timeout de connexion (ms) | | verbose | boolean | false | Logs Prisma détaillés |


License

MIT © olivier adou