🚀 Announcing goCreate: Your New Go-To Open Source CLI Tool for Go Project Scaffolding 🎉

Sachin BorseSachin Borse
5 min read

I am excited to introduce goCreate, my first-ever open-source CLI tool (pre-Launch) designed to automate the process of generating Go project structures with a variety of architectural patterns. As a developer who values efficiency, I created #goCreate to eliminate the repetitive task of setting up new Go projects manually—allowing you to focus on writing code, not structuring files.

In this article, I will walk you through the key features of goCreate, how to install it, and how it can help streamline your Go project development.


What is goCreate?

goCreate is an open-source CLI tool that makes it simple to scaffold a Go project with the architecture of your choice. Whether you’re building a microservice, a monolith, or adhering to Domain-Driven Design, goCreate handles the tedious work of setting up your project structure. This tool supports various architectural patterns, including:

  • Standard Layout

  • Flat Structure

  • Layered Architecture

  • Domain-Driven Design

  • Clean Architecture

  • Microservices Architecture

  • Hexagonal Architecture (Ports and Adapters)


Why Use goCreate?

As developers, we know that setting up a new project can often take valuable time. We spend hours on setting up directory structures, boilerplate code, and ensuring everything is neatly organized before we even write a single line of application logic.

With goCreate, you can:

  • Save Time: Scaffold a project with a single command, without worrying about manual folder creation or file setup.

  • Ensure Consistency: Keep your projects structured uniformly, following best practices for each architecture.

  • Customizable: Tailor your project structure to suit your needs with minimal effort.


How to Install goCreate

Getting started with goCreate is easy! You can install it using the Go toolchain directly from the command line:

go install github.com/devsachinborse/goCreate@latest

Once installed, you’ll have access to the goCreate command, which you can use to generate new projects.


How to Use goCreate

Using goCreate is just as simple as installing it. To create a new project, run the following command:

goCreate create-project <project-name>

After running this, you’ll be presented with an interactive menu to select the architectural pattern for your project:

? Select the architecture for your project:
  â–¸ Standard Layout
    Flat Structure
    Layered Architecture
    Domain-Driven Design
    Clean Architecture
    Microservices Architecture
    Hexagonal Architecture

Once you make your selection, goCreate will automatically generate the folder structure and initial files, such as main.go, README.md, and go.mod, all tailored to the architecture you selected.


Architectures Supported by goCreate

1. Standard Layout

The conventional Go project structure often seen in Go applications. It includes folders for cmd, pkg, and more.

2. Flat Structure

Simpler projects where all code is housed in a single directory with minimal separation. Ideal for small or experimental projects.

3. Layered Architecture

Breaks down the project into clear layers, such as service, repository, and handlers. It separates concerns for better maintainability.

4. Domain-Driven Design

Follows DDD principles, emphasizing a clear domain model and separation of logic through aggregates, entities, and services.

5. Clean Architecture

Implements Uncle Bob’s Clean Architecture, promoting high modularity and separation of concerns between the business logic and external dependencies.

6. Microservices Architecture

Prepares the project for microservices by setting up domain isolation, interfaces, and communication layers.

7. Hexagonal Architecture (Ports and Adapters)

Follows a highly modular approach, decoupling business logic from external factors like databases and APIs, making it easier to swap out adapters.


Example Use Case:

To demonstrate goCreate in action, let’s say you want to create a new Go project using Clean Architecture. The steps are simple:

  1. Run the following command:

     goCreate create-project my-clean-app
    
  2. Select Clean Architecture from the list of options.

  3. goCreate generates the following structure:

     my-clean-app/
     ├── cmd/
     │   └── main.go
     ├── internal/
     │   ├── domain/
     │   ├── service/
     │   └── handler/
     ├── pkg/
     ├── go.mod
     └── README.md
    

Now, you're ready to start writing your application logic!


Roadmap and Future Plans

goCreate is just the beginning. Here’s what’s on the roadmap:

  • Custom Template Support: Soon, you’ll be able to create your own templates for even more flexibility.

  • Advanced Configuration Options: Introduce flags to pass in additional configurations like adding CI/CD files, Docker configurations, and more.

  • Community Contributions: As an open-source project, I’m always looking for feedback and contributions to improve goCreate further.


Getting Involved and Contributing

I believe in the power of community-driven development. goCreate is open source and available on GitHub. If you’d like to contribute or suggest new features, feel free to open an issue or submit a pull request. I’m excited to see how the community can help improve this tool.

Feedback and Support

Your feedback is crucial in shaping goCreate into the best tool it can be. If you run into any issues or have suggestions for improvement, please don’t hesitate to open an issue on GitHub.


Conclusion

Building a Go project from scratch doesn’t have to be tedious. With goCreate, you can set up your project in seconds, follow best practices, and focus on what matters—coding!

Whether you’re working on a small side project or a large-scale microservice, goCreate is here to make your project setup faster and more efficient. I’m thrilled to share this tool with the world, and I can’t wait to hear your thoughts.

Let’s build better Go projects together with goCreate!


Resources:

#GoLang #OpenSource #CLI #ProjectScaffolding #SoftwareDevelopment #CleanArchitecture #Microservices #goCreate

0
Subscribe to my newsletter

Read articles from Sachin Borse directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sachin Borse
Sachin Borse