Skip to content
/ indie Public

A Go stack for indie hacker or early stage projects

License

Notifications You must be signed in to change notification settings

DavidNix/indie

Repository files navigation

Indie

Opinionated Go boilerplate for the indie hacker or early stage projects.

indie-logo.png

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.

Boilerplate

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>

Library

See the sub-packages in the go doc. Go Reference

The Stack

  • 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

Local development

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.

Features

Reasonable Security

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.

Design Decisions

Why Echo?

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.

No ORM or database library?

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.

No AplineJS?

I found writing vanilla JS suited my needs just fine.

About

A Go stack for indie hacker or early stage projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published