LogoPly
Reference

CLI

Generate projects and scaffolding with the Ply CLI.

Ply CLI

Ply provides a command-line interface (CLI) for generating starter projects. The CLI is implemented in Node.js and is separate from the Go module.

Why Node.js

The CLI uses commander, inquirer and chalk to provide:

  • Interactive prompts for project options
  • Support on Windows, macOS and Linux
  • Fast iteration on the generator itself
  • Access to established CLI tooling

Node.js is required only for the CLI. Generated Ply applications do not depend on Node.js at runtime.

Installation

No global install is required:

npx create-ply@latest my-app

The command generates the following project structure:

my-app/
├── features/
│   └── [feature-name]/
│       ├── handler.go       # HTTP handlers
│       ├── service.go       # Business logic
│       ├── repository.go    # Data access
│       └── router.go        # Route registration
├── main.go
├── .env
└── README.md

Feature-based architecture

  • Modular. Each feature is independent and self-contained.
  • Scalable. New features can be added without changing existing ones.
  • Maintainable. Code is organized by feature rather than by layer.
  • Testable. Each layer within a feature can be tested independently.

Use cases

  • Starting a new Ply project
  • Scaffolding repetitive project structure
  • Keeping architecture consistent across a team

After generation

cd myapp
go mod tidy
go run .

Then edit .env to set the database connection and secret values.