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

tmg-gw

v0.0.7

Published

`tmg-gw` คือ CLI สำหรับ generate โปรเจกต์ NestJS GraphQL Gateway ที่เชื่อมต่อ backend ผ่าน gRPC

Downloads

69

Readme

tmg-gw

tmg-gw คือ CLI สำหรับ generate โปรเจกต์ NestJS GraphQL Gateway ที่เชื่อมต่อ backend ผ่าน gRPC

สิ่งที่ generate ให้

  • โครงสร้างโปรเจกต์ NestJS แบบพร้อมรัน
  • GraphQL endpoint ที่ /graphql
  • ไฟล์ .env.example
  • ค่าเชื่อมต่อ gRPC เริ่มต้นสำหรับ TMG_B_GRPC_URL และ MY_SERVICE_GRPC_URL

วิธีใช้งาน CLI

ติดตั้ง dependencies และ build ตัว CLI

npm i -g tmg-gw

options ที่ใช้ได้

  • --outDir <path> ตำแหน่งโฟลเดอร์ปลายทาง (default: current directory)
  • --overwrite เขียนทับโฟลเดอร์เดิมถ้ามีอยู่แล้ว
  • -s, --service <serviceName...> ระบุรายชื่อ service ที่ต้องการ integrate (ใส่ได้หลายตัว)
  • -sdir, --sdir, --servicesDir <path> ระบุโฟลเดอร์ services (default: services)

ตัวอย่าง:

tmg-gw g my-gateway --outDir ./apps --overwrite

ตัวอย่าง integrate หลาย service:

tmg-gw g my-gateway \
  -s my-service users-service wallet-service \
  -sdir services \
  --outDir gateways \
  --overwrite

ขั้นตอนหลัง generate

cd my-gateway
npm install
cp .env.example .env
npm run start:dev

เมื่อรันสำเร็จ จะเห็น log:

  • Gateway is running at http://localhost:<PORT>
  • GraphQL endpoint available at http://localhost:<PORT>/graphql

ค่าใน .env

  • PORT พอร์ตของ gateway (default: 3000)
  • TMG_B_GRPC_URL ปลายทาง gRPC service หลัก (default: localhost:50051)
  • MY_SERVICE_GRPC_URL ปลายทาง gRPC อีก service (default: localhost:50051)

Service Integration (-s, -sdir)

เมื่อระบุ -s ตอน generate ระบบจะ:

  • เพิ่ม env ต่อ service ใน .env.example เช่น USERS_SERVICE_GRPC_URL=localhost:50051
  • ค้นหาไฟล์ proto จาก <servicesDir>/<service>/proto/*.proto
  • คัดลอกไฟล์ .proto ไปไว้ใน <gateway>/proto

ตัวอย่างโครงสร้าง:

projectA/
  gateways/
  services/
    my-service/
    users-service/
    wallet-service/

หมายเหตุ project name

ชื่อโปรเจกต์ต้องเป็นตัวพิมพ์เล็กเท่านั้น และใช้ได้เฉพาะ:

  • a-z
  • 0-9
  • -