https://github.com/samznd/goscaf
A command-line interface tool for quickly generating Go web application boilerplate code with a solid scaffolding structure and best practices.
https://github.com/samznd/goscaf
api backend backend-development boilerplate cli-tool code-generator devtool fiber gin go go-cli go-web golang gorm open-source postgres project-generator restful-api scaffolding web-framework
Last synced: 7 months ago
JSON representation
A command-line interface tool for quickly generating Go web application boilerplate code with a solid scaffolding structure and best practices.
- Host: GitHub
- URL: https://github.com/samznd/goscaf
- Owner: samznd
- License: mit
- Created: 2025-01-31T15:15:04.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-18T09:15:54.000Z (11 months ago)
- Last Synced: 2025-04-18T22:48:27.964Z (10 months ago)
- Topics: api, backend, backend-development, boilerplate, cli-tool, code-generator, devtool, fiber, gin, go, go-cli, go-web, golang, gorm, open-source, postgres, project-generator, restful-api, scaffolding, web-framework
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# GoScaf CLI
[](https://pkg.go.dev/github.com/samznd/goscaf)
[](https://github.com/samznd/goscaf/releases)
**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
```bash
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
```bash
$ 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
```bash
git clone https://github.com/yourusername/goscaf.git
cd goscaf
go build
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- [Standard Go Project Layout](https://github.com/golang-standards/project-layout)
- [Cobra](https://github.com/spf13/cobra)
- [Survey](https://github.com/AlecAivazis/survey)
## Roadmap
- [x] Add support for more web frameworks
- [x] Add Docker configuration
- [ ] Add GraphQL support
- [ ] Add gRPC support