Skip to content
/ goscaf Public

A command-line interface tool for quickly generating Go web application boilerplate code with a solid scaffolding structure and best practices.

License

Notifications You must be signed in to change notification settings

samznd/goscaf

Repository files navigation

GoScaf CLI

Go Reference GitHub release

GoScaf is a powerful command-line tool for bootstrapping Go web applications with clean architecture, flexible technology combinations, and best practices baked in.

🚀 Features

  • Quick project scaffolding with interactive CLI
  • Modular selection of Web Framework, Database, and ORM
  • Clean and extensible project structure
  • Built-in support for environment configs and Docker
  • Automated dependency installation
  • Consistent and idiomatic Go code generation

📦 Installation

Prerequisites

  • Go 1.16 or higher

Installation

go install github.com/samznd/goscaf@latest

## Getting Started.

### Create a new project

goscaf init

This will start an interactive prompt asking for:

  1. Project name
  2. Web framework selection (Fiber/Gin/Echo/Chi/Iris)
  3. Database system (Postgres/MySQL/SQLite)
  4. ORM preference (Yes/No)
  5. If Yes to ORM, choose between GORM/XORM/Ent

Example

$ goscaf init
? What is your project name? mywebapp
? Choose your web framework: Fiber
? Choose your database system: Postgres
? Would you like to use an ORM? Yes
? Choose your ORM framework: GORM
✅ Project initialized successfully!

Project Structure

The generated project follows a standard Go project layout:

your-project/
├── cmd/
│   └── main.go          # Application entry point
├── config/
│   └── database.go      # Database configuration
├── internal/
│   ├── middleware/      # HTTP middleware
│   ├── models/          # Data models
│   ├── repositories/    # Data access layer
│   ├── services/        # Business logic
│   ├── handlers/        # HTTP request handlers
│   └── routes/          # Route definitions
├── pkg/                 # Public library code
│   ├── utils/           # Utility functions
├── scripts/             # Build and deployment scripts
└── .env                 # Environment variables

Supported Technologies

Web Frameworks

Fiber

  • High-performance, Express-inspired web framework
  • Great for REST APIs
  • Minimal memory allocation
  • Fast HTTP routing

Gin

  • Full-featured web framework
  • Excellent middleware support
  • High performance
  • Wide community adoption

Echo

  • Minimalist web framework
  • High performance
  • Extensible middleware
  • Built-in support for data binding and validation

Chi

  • Lightweight, idiomatic web framework
  • Focused on composability and maintainability
  • Efficient router
  • Middleware support

Iris

  • Fast, full-featured web framework
  • Built-in MVC support
  • Rich routing capabilities
  • Extensive middleware ecosystem

Databases

  • PostgreSQL: Advanced open-source database
  • MySQL: Popular open-source database
  • SQLite: Lightweight file-based database

ORMs

  • GORM: The most popular Go ORM
  • XORM: Simple and powerful ORM
  • Ent: Facebook's entity framework

Development

Requirements

  • Go 1.16+

Building from source

git clone https://github.com/yourusername/goscaf.git
cd goscaf
go build

License

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

Acknowledgments

Roadmap

  • Add support for more web frameworks
  • Add Docker configuration
  • Add GraphQL support
  • Add gRPC support