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

tuan-cli

v1.0.2

Published

A CLI tool for generating Golang service templates

Readme

Tuan CLI

A powerful CLI tool for generating Golang service templates with support for microservices architecture.

Features

  • Initialize Golang project structure
  • Generate microservice templates with proper Go modules
  • Docker support for containerization
  • Cross-platform support (Windows, macOS, Linux)
  • Interactive prompts for project configuration

Installation

Global Installation

npm install -g tuan-cli

Local Installation

npm install tuan-cli

Usage

Initialize a new project

# Initialize with project name
tuan init MyProject

# Initialize with version
tuan init MyProject --version 2.0.0

# Interactive initialization (will prompt for project name)
tuan init

This creates the following structure:

MyProject/
├── clients/          # Client files
├── docker/           # Docker configurations
├── pkgs/
│   └── gopkg/        # Go packages
├── protoc/
│   └── protogo/
│       └── go.mod    # Protocol buffers go.mod
├── services/         # Microservices directory
└── tuan.json         # Project configuration

Create a microservice

tuan mirsrv UserService

This creates a microservice with the following structure:

services/UserService/
├── apis/              # API handlers
├── daos/              # Data access objects
├── cmd/
│   ├── service/
│   │   └── main.go    # Main service file
│   └── scripts/
│       └── install_test.go  # Database installation test
├── go.mod             # Go module file
└── Dockerfile         # Docker configuration

Configuration File

The tuan.json file stores project configuration:

{
  "project_name": "MyProject",
  "version": "1.0.0"
}

Generated Templates

Main Service Template

The generated main.go includes:

  • CORS middleware
  • gRPC panic handling
  • Sunny framework integration
  • Environment and configuration flags

Go Module Template

The generated go.mod includes:

  • Required dependencies (Gin, Sunny, Logrus, gRPC, GORM)
  • Local package replacements
  • Proper module structure

Docker Template

Multi-stage Dockerfile for optimized builds:

  • Builder stage with Golang Alpine
  • Final stage with minimal Alpine
  • Security certificates and timezone data

Cross-Platform Support

Tuan CLI supports:

  • Windows: Command Prompt and PowerShell
  • macOS: Terminal and iTerm2
  • Linux: All major distributions

Development

Build

npm run build

Development Mode

npm run dev

Run Tests

npm test

Clean Build

npm run clean

Publishing to NPM

# Build and publish
npm run pub

# Or manually
npm run build
npm publish

Requirements

  • Node.js >= 16.0.0
  • npm >= 7.0.0

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Examples

Complete Project Setup

# Initialize new project
tuan init ECommerceApp

# Create microservices
tuan mirsrv UserService
tuan mirsrv OrderService
tuan mirsrv ProductService

# Navigate to a service
cd services/UserService

# Install dependencies
go mod tidy

# Run tests
go test ./cmd/scripts/

# Start the service
go run cmd/service/main.go

Docker Build

# Build Docker image
cd services/UserService
docker build -t user-service .

# Run container
docker run -p 8080:8080 user-service