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

micro-generate

v1.0.7

Published

Microservices project with Node.js, Express, Mongoose, Redis, and GraphQL

Downloads

703

Readme

🚀 Microservice Generator (micro-generate)

micro-generate es un CLI potente y ligero para crear microservicios listos para producción con Node.js, TypeScript, GraphQL (Apollo Server), MongoDB y Redis.

Olvídate del boilerplate. Genera infraestructuras completas, features modulares, queries y mutaciones en segundos con una arquitectura escalable y las mejores prácticas integradas.


📦 Instalación y Uso

No necesitas instalarlo globalmente. Recomendamos usar npx para ejecutar siempre la última versión:

npx micro-generate <comando>

🛠️ Comandos Disponibles

1. Inicializar un Nuevo Proyecto

Crea la estructura base del microservicio, configurando TypeScript, Docker, Variables de Entorno y el Servidor.

npx micro-generate init
  • Interactivo: Te preguntará el nombre del proyecto y si deseas habilitar MongoDB y/o Redis.
  • Resultado: Un proyecto completo con src/core, src/config, y todo listo para correr npm run dev.

2. Crear una Nueva Feature

Genera un módulo de dominio completo (Vertical Slice Architecture).

npx micro-generate feature
  • Te pedirá: Nombre del feature (ej: users, orders).
  • Genera: Carpeta en src/features/<nombre> con:
    • typeDefs.ts: Esquemas GraphQL.
    • resolvers.ts: Controladores.
    • service.ts: Lógica de negocio.
    • model.ts: Modelo Mongoose (si Mongo está activo).
  • Automático: Registra la feature en el index.ts principal.

3. Agregar una Query (Consulta)

Agrega una nueva consulta GraphQL a una feature existente sin tocar el código manualmente.

npx micro-generate query
  • Flujo: Seleccionas la feature de una lista -> Escribes el nombre -> Defines el tipo de retorno.
  • Magia: Inyecta automáticamente la definición en typeDefs y el esqueleto de la función en resolvers.

4. Agregar una Mutation (Mutación)

Agrega una nueva mutación para modificar datos.

npx micro-generate mutation
  • Similar a query, ideal para operaciones de creación, actualización o eliminación (CRUD).

🔥 Características Principales

  • ⚡ Stack Moderno: Node.js 20+, TypeScript 5, Apollo Server 4.
  • 🧠 GraphQL Modular: Arquitectura basada en features autotencidos.
  • 🛡️ Type-Safety: Validación de variables de entorno con Zod.
  • 🗄️ Bases de Datos:
    • MongoDB (Mongoose) con conexión robusta.
    • Redis para caché y pub/sub (cliente inteligente).
  • 📝 Logging: Implementación de alto rendimiento con Pino (JSON logs).
  • 🛑 Graceful Shutdown: Manejo correcto de señales SIGINT/SIGTERM para evitar conexiones colgadas.
  • 🎮 Playground Control: Habilita/deshabilita el Apollo Sandbox vía variables de entorno.

📂 Estructura Generada

my-service/
├── src/
│   ├── config/          # Configuración de entorno y DBs
│   ├── core/            # Servidor central (MicroserviceServer)
│   ├── features/        # Tu lógica de negocio aquí
│   │   ├── users/       # Ejemplo de Feature
│   │   │   ├── typeDefs.ts
│   │   │   ├── resolvers.ts
│   │   │   └── service.ts
│   │   └── index.ts     # Auto-registro
│   ├── utils/           # Loggers y helpers
│   └── index.ts         # Punto de entrada
├── .env                 # Variables de entorno
├── package.json
└── tsconfig.json

🤝 Contribuyendo

  1. Haz un Fork.
  2. Crea tu rama de feature (git checkout -b feature/amazing-feature).
  3. Commit a tus cambios (git commit -m 'feat: Add amazing feature').
  4. Push a la rama (git push origin feature/amazing-feature).
  5. Abre un Pull Request.

Generado con ❤️ por micro-generate.