Streamlining Golang Development with Garch CLI.

Simplifying Project Initialisation with different Architectures.

Embarking on a journey into Golang development opens doors to a world of speed, efficiency, and versatility. However, the initial setup process for new projects requires developers to create all the folders and files themselves, starting out this can often feel fulfilling and is a great way for new Go developers to familiarize themselves with the language and syntax, for not so new developers, it can often get tiring, cumbersome and time-consuming , detracting from the excitement of diving into code. Fortunately, with the introduction of Garch CLI (Go Architecture - working title), developers now have a powerful tool at their disposal to streamline project initialisation and enhance workflow efficiency. In this article, we will explore the journey of a developer who transitioned from Python to Golang, delved into software development architecture, and ultimately developed Garch to simplify the Golang development process.

I started my backend development journey with Python (Django). When starting up a new project you simply run django-admin startproject <yoursitename> from the command line and a base starter project is provideded for you to work with, it would have been nice to know how everything works but imagine having to write the settings file every time you wanted to start a new project with Django. I never really appreciated boilerplate generation until I started working with Go, the go mod init github/<username>/<project> does a good job of getting you started but not in terms actual projects. I realised the need for boilerplate generation after creating my third API with the same technologies i use all the time. You appreciate it more when you use gRPC in Go, there's a lot of repetitive code that we do not need to worry about when we use Protobuf. In that same sense, I thought to create a CLI tool that generated the boilerplate for me so I wouldn't have to worry about creating my nth cmd/main.go file. However there are a lot of different projects people work on with Go, and they're not all APIs, so I decided the best thing to do is generate boilerplate code for different architectures.

Garch CLI emerges as a solution to the repetitive and tedious task of creating boilerplate code for new Golang projects. This command-line tool empowers developers by automating the setup process, allowing them to focus their time and energy on core project development. With Garch, users can effortlessly select their preferred architecture, specify project details such as the project title, and seamlessly integrate their configured git username into the go.mod file or use a different one if they would like. This streamlined approach to project initialisation sets the stage for a more efficient and productive development experience.

i've written Garch in Rust for 2 reasons; The first is as a joke, I think the rivalry between the Gopher and the Crab is fun and i'm trying to write programs for one language using the other. The second reason is I'm newer to Rust than I am to Go and I need to get comfortable with it by building more projects. Regardless of what its built in the goal is to have an executable that can generate code for the selected architecture.

The code is publicly accessible on github Garch CLI (free to contribute of course). Please note that the code was built for unix like systems in mind You would require Golang (duh) but in case you don't have it already and want to get started please check out the Learn Go. The binary is located at the root folder of the repo, you can close it and test it out with the following coommand:

// Run
./garch gen

// Select Architecture
What architecture would you like to use? input the number of the option (default: hexagonal)
1. hexagonal
2. onion
3. clean

// Add project title
What is the title of this project?

// Github username or custom
Who is the author of this project? (default: username)

At the time of writing this I have just one architecture that can be selected; Hexagonal Architecture, I hope to have finished this mini project in a little bit, my hope is to have many more and come up with the best. I also hope to include code examples for these architectures for new developers, to help them better understand why they're important.