Opinionated Go boilerplate for the indie hacker or early stage projects.
Why does JS, Rails, Django, and Phoenix have all the fun?
Let's use a Go stack for quickly building ideas.
After you create your project, use or discard what you wish.
This is used as a boilerplate and library.
Install the experimental gonew command.
go install golang.org/x/tools/cmd/gonew@latest
Then in a fresh directory:
gonew github.com/DavidNix/indie github.com/<YOUR_USER>/<YOUR_PROJECT_NAME>
See the sub-packages in the go doc.
- Go (of course)
- Cobra for cli
- Echo for web server and router
- HTMX for dynamic web pages (although I'm considering moving to datastar)
- Templ for HTML templates
- Overmind for local development (a lightweight docker compose that doesn't need docker)
- Tailwind CSS for the utility-first CSS framework
- DaisyUI 5 for tailwind components because Daisy doesn't need JS
All funneled through make
.
To see what you can do:
make
Then (assumes you have homebrew installed):
make setup
Generate code:
make gen
Live reload:
make watch
Caveat: Any ent (data model) changes will require a manual restart.
The license still stands that this software is provided as-is with no warranty.
But I've tried to make reasonable security decisions such as server timeouts, CSRF protection, and secure headers.
I like Echo's handler signature where you return an error. They also have nice middleware.
I first tried Fiber which uses fasthttp as the
router. Unfortunately, fasthttp has a nasty race condition
when using database/sql. Also, Fiber makes you choose between c.Context()
and c.UserContext()
which is confusing.
Also, Echo is one of the older Go http frameworks, so has the Lindy Effect.
BYO database implementation. There's an example of how I like to do migrations with sqlite.
I typically don't like ORMs, but sometimes I use ent if I need speed of development. Also, ORMs let you compose dynamic queries a bit easier than compiled solutions like sqlc.
Many prefer sqlc. Or, if simple enough, just use database/sql
.
I found writing vanilla JS suited my needs just fine.