#I built a production-ready Go monorepo template with a 1-command setup.

21 messages · Page 1 of 1 (latest)

arctic cipher
#

gophereyes I wanted to share a project I've been working on: a Go monorepo template. My goal was to build a solid, production-ready starting point for new projects that eliminates the repetitive setup work.

It's structured to be highly scalable and future-proof, with a clear separation of concerns using cmd, pkg, internal, and services directories. This gives you a great foundation with plenty of room to grow, whether you're building a simple CLI tool or a complex system of microservices.

The best part is the setup workflow. After you fork and clone the repository, you just run a single command:

make change-username

A script will prompt you for your GitHub username and automatically refactor the entire project. It updates the Go module paths, documentation links, and license file, making the template truly yours in seconds.

It comes with:

  • A well-defined, expandable project structure.
  • Working demo applications (a CLI tool and an HTTP server using htmx).
  • A comprehensive Makefile for common tasks like building, testing, and auditing.
  • A pre-configured GitHub Actions workflow for continuous integration.
  • A "standard library first" philosophy, with a few carefully chosen dependencies for things like database access.

I built this to be the template I always wanted for my own projects. I hope it can help some of you get your ideas off the ground faster.

You can check it out on GitHub: https://github.com/dunamismax/go-monorepo-template

I would love to hear any feedback or suggestions you might have. Thanks

tame silo
echo zephyr
#

no docker?

#

also wouldn't a mono repo possibly have more than 1 module (not that I like multiple go.mod nor mono repos, yet asking)

arctic cipher
#

Based on feedback I made many changes/improvements to the monorepo template, added tests, docker, improved the makefile, and simplified the directory structure a bit to align with modern best practices:
https://github.com/dunamismax/go-monorepo-template

GitHub

This repository is a Go Monorepo Template designed to provide a robust and scalable starting point for your projects. It includes a well-defined project structure, a unified build system using a Ma...

echo zephyr
#

cool

arctic cipher
#

Comprehensive tests added and tested

arctic cipher
#

Comprehensive, 100% test coverage added

sharp meadow
#

whats the difference between the two linked repositories go and go-monorepo-template first one is generated as an example out of the template?

arctic cipher
#

Go is my actual personal go repo, where I add my own apps and scripts and actually do development. The go-monorepo-template was created from the go repo and customized to make it a clean reusable and shareable template

#

With my personalized info removed, an easy way to change the username across all files to instantly make the repo your own after you fork it etc

#

“make change-username”

#

I still need to apply some of the changes I’ve made to my go repo to the template repo though

sharp meadow
#

ah okay i get it, thanks!

kindred heron
#

what the commit description