Skip to content

A powerful command-line tool for scaffolding new Go projects with multiple templates based on popular Go project setups.

License

Notifications You must be signed in to change notification settings

raythurman2386/go_scaffold

Repository files navigation

Go Scaffold Tool

A powerful command-line tool for scaffolding new Go projects with multiple templates based on popular Go project setups.

🚀 Features

  • Multiple Templates: Choose from full-stack, CLI, API, or library templates
  • Clean Architecture: Templates follow Go best practices
  • Go Best Practices: Standard Go project layout conventions
  • Web-Ready: Full-stack template includes basic HTTP server setup
  • Dependency Management: Automatically initializes Go modules
  • Cross-Platform: Works on Windows, macOS, and Linux

📁 Available Templates

Full Template (default)

Complete web application with API, services, repositories, and templates.

your-project-name/
├── cmd/
│   └── main.go              # Application entry point
├── internal/
│   ├── api/                 # API handlers and controllers
│   ├── service/             # Business logic layer
│   ├── repository/          # Data access layer
│   └── domain/              # Core business models
├── pkg/                     # Public libraries and utilities
├── configs/
│   └── config.yaml          # Configuration files
├── web/
│   └── templates/           # HTML templates
├── scripts/                 # Build and deployment scripts
├── .gitignore               # Git ignore rules
├── README.md                # Project documentation
└── go.mod                   # Go module file

CLI Template

Simple command-line interface tool.

your-project-name/
├── cmd/
│   └── main.go              # CLI entry point
├── pkg/                     # Utilities
├── .gitignore
├── README.md
└── go.mod

API Template

REST API server with clean architecture.

your-project-name/
├── cmd/
│   └── main.go              # Server entry point
├── internal/
│   ├── api/                 # API handlers
│   ├── service/             # Business logic
│   ├── repository/          # Data access
│   └── domain/              # Models
├── pkg/
├── configs/
│   └── config.yaml
├── .gitignore
├── README.md
└── go.mod

Lib Template

Go library/package.

your-project-name/
├── pkg/
│   └── example.go           # Library code
├── .gitignore
├── README.md
└── go.mod

📁 Project Structure (Scaffold Tool)

go_scaffold/
├── cmd/
│   └── main.go              # Cobra CLI application entry point
├── internal/
│   └── templates/           # Template implementations
│       ├── templates.go     # Base template interface and utilities
│       ├── registry.go      # Template registry
│       ├── full.go          # Full-stack template
│       ├── cli.go           # CLI template
│       ├── api.go           # API template
│       └── lib.go           # Library template
├── bin/                     # Built executables
├── configs/                 # Configuration files
├── scripts/                 # Build scripts
├── .gitignore
├── README.md
├── go.mod
└── go.sum

🛠️ Installation

Prerequisites

  • Go 1.19 or later
  • Git

Build from Source

  1. Clone or download this project
  2. Navigate to the project directory
  3. Build the executable:
    go build -o bin/go_scaffold ./cmd

📖 Usage

Basic Usage

# Create a full-stack project
go_scaffold full my-web-app

# Create a CLI tool
go_scaffold cli my-cli-tool

# Create an API server
go_scaffold api my-api

# Create a library
go_scaffold lib my-library

# List available templates
go_scaffold list

Help

# General help
go_scaffold --help

# Help for specific template
go_scaffold full --help

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A powerful command-line tool for scaffolding new Go projects with multiple templates based on popular Go project setups.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Languages