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

service-generator-cli

v1.0.1

Published

CLI tool to generate microservice boilerplates for Java, Go, and JavaScript

Readme

Service Generator CLI

CLI tool để generate microservice boilerplates cho Java, Go, và JavaScript với gRPC support.

🚀 Tính năng

  • Multi-language support: Java (Spring Boot), Go, JavaScript (Node.js)
  • gRPC ready: Tích hợp sẵn gRPC cho high-performance communication
  • Clean Architecture: Repository pattern, service layer, dependency injection
  • Production ready: Docker, testing, logging, monitoring
  • Interactive mode: Hướng dẫn từng bước
  • Customizable: Dễ dàng mở rộng templates

📦 Cài đặt

Cài đặt globally

npm install -g service-generator-cli

Cài đặt locally

npm install service-generator-cli
npx service-generator new --language=java --name=my-service

Từ source

git clone https://github.com/your-username/service-generator-cli.git
cd service-generator-cli
npm install
npm link

🎯 Sử dụng

Interactive mode (Khuyến nghị)

service-generator new --interactive

Command line

# Generate Java service
service-generator new --language=java --name=user-service

# Generate Go service
service-generator new --language=go --name=payment-service

# Generate JavaScript service
service-generator new --language=js --name=notification-service

# Specify output directory
service-generator new --language=java --name=my-service --output=/path/to/projects

Xem danh sách templates

service-generator list

📋 Options

| Option | Short | Description | Default | | --------------- | ----- | ----------------------------------- | -------- | | --language | -l | Programming language (java, go, js) | java | | --name | -n | Service name | required | | --output | -o | Output directory | . | | --interactive | -i | Interactive mode | false |

🏗️ Generated Structure

Java (Spring Boot + gRPC)

user-service/
├── src/main/
│   ├── java/com/example/
│   │   ├── controller/      # gRPC Controllers
│   │   ├── service/         # Business Logic
│   │   ├── repository/      # Data Access
│   │   ├── model/           # Domain Models
│   │   └── SampleJavaServiceApplication.java
│   ├── proto/               # gRPC Protocol Buffers
│   └── resources/
│       └── application.yml  # Configuration
├── src/test/                # Unit Tests
├── pom.xml                  # Maven config
└── README.md               # Documentation

Go (gRPC + HTTP Gateway)

payment-service/
├── cmd/server/              # Entry point
├── internal/
│   ├── config/             # Configuration
│   ├── handler/            # gRPC handlers
│   ├── service/            # Business logic
│   ├── repository/         # Data access
│   └── model/              # Domain models
├── proto/                  # Protocol Buffers
├── config/                 # Config files
├── Dockerfile              # Multi-stage build
├── Makefile                # Development commands
├── go.mod                  # Go modules
└── README.md              # Documentation

JavaScript (Node.js + Express + gRPC)

notification-service/
├── src/
│   ├── proto/              # gRPC Protocol Buffers
│   ├── controllers/        # gRPC Controllers
│   ├── services/           # Business Logic
│   ├── repositories/       # Data Access
│   ├── models/             # Domain Models
│   ├── index.js            # Express server
│   └── server.js           # gRPC server
├── package.json            # Dependencies
├── .eslintrc.json          # ESLint config
├── .prettierrc             # Prettier config
└── README.md              # Documentation

🔧 Development

Setup development environment

git clone https://github.com/your-username/service-generator-cli.git
cd service-generator-cli
npm install
npm link

Test locally

# Test interactive mode
service-generator new --interactive

# Test specific language
service-generator new --language=java --name=test-service

Add new templates

  1. Create template file in src/templates/
  2. Add template function in src/templates.js
  3. Update generator logic in src/generator.js

📚 Templates

Java Template Features

  • Spring Boot 3.2.5
  • gRPC with Spring Boot starter
  • Clean Architecture pattern
  • Maven with plugins (protobuf, checkstyle, spotless)
  • Unit testing with JUnit 5 + Mockito
  • Docker ready

Go Template Features

  • Go 1.21+
  • gRPC + HTTP Gateway
  • Clean Architecture
  • Structured logging (Zap)
  • Configuration management (Viper)
  • Testing with testify
  • Multi-stage Docker build
  • Makefile with development commands

JavaScript Template Features

  • Node.js 14+
  • Express.js
  • gRPC with @grpc/grpc-js
  • ES6 modules
  • ESLint + Prettier
  • Babel for transpilation
  • Hot reload with nodemon

🚀 Quick Start

# 1. Install CLI
npm install -g service-generator-cli

# 2. Generate service
service-generator new --interactive

# 3. Follow prompts
# Choose language: Java
# Enter name: user-service
# Output directory: .

# 4. Navigate to generated service
cd user-service

# 5. Start development
# For Java: mvn spring-boot:run
# For Go: make dev
# For JS: npm start

🔄 Workflow

  1. Generate: Tạo boilerplate với CLI
  2. Customize: Thêm business logic và models
  3. Test: Chạy unit tests và integration tests
  4. Deploy: Build và deploy với Docker/Kubernetes

🤝 Contributing

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

Development Guidelines

  • Follow existing code style
  • Add tests for new features
  • Update documentation
  • Test with multiple languages

📝 License

MIT License - see LICENSE file for details

🆘 Support

🔮 Roadmap

  • [ ] Add more languages (Python, Rust, C#)
  • [ ] Database integration templates
  • [ ] Kubernetes manifests
  • [ ] CI/CD pipeline templates
  • [ ] Custom template support
  • [ ] Plugin system
  • [ ] Template marketplace

📊 Statistics

  • Languages: 3 (Java, Go, JavaScript)
  • Templates: 50+ files per language
  • Features: gRPC, HTTP, Testing, Docker, CI/CD
  • Architecture: Clean Architecture, Repository Pattern