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

@pixelpoule/monitoring-setup

v1.0.3

Published

CLI pour installer automatiquement le monitoring Pixel Poule dans une instance Next.js

Readme

🚀 @pixelpoule/monitoring-setup

CLI d'installation automatique du monitoring Pixel Poule pour les instances Next.js.


📦 Installation

Dans n'importe quelle instance Next.js :

npx @pixelpoule/monitoring-setup

C'est tout !


✨ Ce que fait le CLI

  1. ✅ Vérifie que vous êtes dans un projet Next.js
  2. ✅ Pose les questions (instanceId, secret, dashboardUrl)
  3. ✅ Installe automatiquement @pixelpoule/monitoring
  4. ✅ Ajoute les variables dans .env.local
  5. ✅ Configure middleware.ts pour le monitoring automatique
  6. ✅ Affiche un résumé et les prochaines étapes

🎯 Questions posées

Le CLI vous demandera :

  • URL du Dashboard Admin : L'URL de votre dashboard centralisé
  • Instance ID : Fourni lors de la création de l'instance dans le Dashboard
  • Instance Secret : Fourni lors de la création de l'instance dans le Dashboard
  • Activer le monitoring ? : true/false

📝 Exemple d'utilisation

$ npx @pixelpoule/monitoring-setup

📦 Installation du monitoring Pixel Poule

✅ Projet Next.js détecté

? URL du Dashboard Admin : https://admin.pixelpoule.com
? Instance ID : 3c41b7ff-2f55-4dec-a5da-ab66ef374029
? Instance Secret : ••••••••••••••••••••
? Activer le monitoring ? Yes

🔧 Installation en cours...

📦 Installation de @pixelpoule/monitoring...
✅ Package installé

⚙️  Configuration de .env.local...
✅ Fichier .env.local créé

🔧 Configuration du middleware...
✅ Middleware configuré

✨ Installation terminée !

✅ Package @pixelpoule/monitoring installé
✅ Variables d'environnement configurées
✅ Middleware configuré

📋 Prochaines étapes :

1. Vérifiez votre fichier .env.local
2. Vérifiez votre fichier middleware.ts
3. Lancez votre projet : npm run dev
4. Testez une route API
5. Vérifiez le Dashboard : https://admin.pixelpoule.com/monitoring

🔒 Sécurité

  • Les secrets sont demandés en mode password (masqués)
  • Aucune donnée n'est envoyée ailleurs que dans votre projet
  • .env.local n'est jamais commité (dans .gitignore)

🗑️ Désinstallation

Pour retirer le monitoring d'un projet :

# 1. Désinstaller le package
npm uninstall @pixelpoule/monitoring

# 2. Supprimer les variables ADMIN_* de .env.local

# 3. Restaurer l'ancien middleware
mv middleware.ts.backup middleware.ts

📦 Ce qui est installé

votre-projet/
├── .env.local                    # ← Variables ADMIN_* ajoutées
├── middleware.ts                 # ← Modifié pour utiliser le monitoring
├── middleware.ts.backup          # ← Backup de l'ancien middleware
├── node_modules/
│   └── @pixelpoule/monitoring/  # ← Package installé
└── package.json                  # ← Dépendance ajoutée

🎯 Ce qui est surveillé automatiquement

  • Performance de toutes les routes /api/*
  • Erreurs capturées automatiquement
  • Méthodes HTTP : GET, POST, PUT, DELETE, etc.
  • Status codes : 200, 400, 500, etc.
  • Durée de chaque requête

💡 Ajouter plus de contexte aux erreurs

Pour enrichir les logs avec plus de contexte (documentId, userId, etc.) :

import { sendLog } from '@pixelpoule/monitoring';

// Dans un catch block
sendLog({
  type: 'api_error',
  severity: 'critical',
  message: error.message,
  context: {
    endpoint: '/api/process-document',
    documentId: '...',
    errorStep: 'extraction',
  },
  stackTrace: error.stack,
});

🔧 Options avancées

Exclure certaines routes

Modifiez middleware.ts :

export const middleware = createMonitoringMiddleware({
  excludeRoutes: ['/api/health', '/api/ping'],
  // ...
});

📄 Licence

ISC © Pixel Poule