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

bff-cli-tools

v1.0.0

Published

CLI para generar codigo para el Backend for Frontend (BFF)

Downloads

101

Readme

GlobalS1 BFF CLI

CLI para generar codigo para el Backend for Frontend (BFF) de GlobalS1.

Instalacion

# Global
npm install -g globalsone-bff-cli

# O como devDependency
npm install -D globalsone-bff-cli

Uso

# Ver ayuda
bff --help

# Ver version
bff --version

Comandos

Generate Aggregator

Genera agregadores de datos que combinan respuestas de multiples servicios.

# Agregador basico
bff generate aggregator dashboard
bff g a dashboard

# Con servicios especificos
bff g a user-profile --services "user,orders,preferences"

# Con cache
bff g a product-catalog --cache 300

# Para cliente especifico
bff g a mobile-home --client mobile

# Preview
bff g a my-aggregator --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | -s, --services <services> | Servicios a agregar (separados por coma) | | | -c, --cache <ttl> | TTL de cache en segundos | | | --client <type> | Tipo de cliente (web, mobile, tv) | | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Generate Orchestrator

Genera orquestadores de flujos que coordinan operaciones secuenciales.

# Orquestador basico
bff generate orchestrator checkout-flow
bff g o checkout-flow

# Con pasos especificos
bff g o onboarding --steps "validate,create-user,send-email,setup-preferences"

# Con rollback
bff g o payment-process --with-rollback

# Con retry
bff g o import-data --with-retry --max-retries 5

# Preview
bff g o my-flow --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | --steps <steps> | Pasos del flujo (separados por coma) | | | --with-rollback | Incluir logica de rollback | false | | --with-retry | Incluir logica de retry | false | | --max-retries <n> | Numero maximo de reintentos | 3 | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Generate Adapter

Genera adaptadores para comunicarse con servicios externos.

# Adapter basico
bff generate adapter user-service
bff g ad user-service

# Con URL base
bff g ad order-service --base-url "http://localhost:3002"

# Con metodos especificos
bff g ad payment-service --methods "getById,charge,refund"

# Con resiliencia
bff g ad external-api --with-retry --with-circuit-breaker

# Preview
bff g ad my-service --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | -u, --base-url <url> | URL base del servicio | | | -m, --methods <methods> | Metodos a generar (separados por coma) | getById,getAll,create,update,delete | | --timeout <ms> | Timeout en ms | 5000 | | --with-retry | Incluir logica de retry | false | | --with-circuit-breaker | Incluir circuit breaker | false | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Generate Transformer

Genera transformadores para adaptar datos a diferentes formatos.

# Transformer basico
bff generate transformer user
bff g t user

# Para cliente especifico
bff g t product --client mobile

# Con campos especificos
bff g t order --fields "id,total,status"

# Preview
bff g t my-transformer --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | --client <type> | Tipo de cliente (web, mobile, tv) | | | --fields <fields> | Campos a incluir (separados por coma) | | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Generate Cache

Genera estrategias de cache.

# Cache basico
bff generate cache user
bff g c user

# Con estrategia especifica
bff g c product --strategy stale-while-revalidate

# Con TTL custom
bff g c session --ttl 3600

# Con tags para invalidacion
bff g c order --tags "orders,user-data"

# Preview
bff g c my-cache --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | --strategy <strategy> | Estrategia (cache-aside, write-through, stale-while-revalidate) | cache-aside | | --ttl <seconds> | TTL por defecto | 300 | | --tags <tags> | Tags para invalidacion (separados por coma) | | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Generate Endpoint

Genera endpoints HTTP para el BFF.

# Endpoint con agregador
bff generate endpoint /api/dashboard --aggregator dashboard
bff g e /api/dashboard -a dashboard

# Endpoint con orquestador
bff g e /api/checkout -o checkout --method POST

# Endpoint con autenticacion
bff g e /api/profile -a user-profile --auth

# Preview
bff g e /api/test --dry-run

Opciones:

| Opcion | Descripcion | Default | |--------|-------------|---------| | -a, --aggregator <name> | Agregador a usar | | | -o, --orchestrator <name> | Orquestador a usar | | | -m, --method <method> | Metodo HTTP | GET | | --auth | Requiere autenticacion | false | | --dry-run | Preview sin crear archivos | false | | --force | Sobrescribir archivos existentes | false |

Estructura Generada

src/
├── aggregators/
│   ├── {name}.aggregator.ts
│   └── __tests__/
│       └── {name}.aggregator.test.ts
├── orchestrators/
│   ├── {name}.orchestrator.ts
│   └── __tests__/
│       └── {name}.orchestrator.test.ts
├── adapters/
│   ├── {name}.adapter.ts
│   └── __tests__/
│       └── {name}.adapter.test.ts
├── transformers/
│   └── {name}.transformer.ts
├── cache/
│   └── {name}.cache.ts
└── routes/
    └── {name}.routes.ts

Desarrollo

# Clonar repositorio
git clone https://github.com/GlobalS1/globalsone-bff-cli.git
cd globalsone-bff-cli

# Instalar dependencias
npm install

# Build
npm run build

# Desarrollo (watch mode)
npm run dev

# Link local para testing
npm link

Licencia

MIT