DEV Community

Aarush Karak
Aarush Karak

Posted on

I Built a Microservice in 10 Minutes with GoFr (and Didn't Touch YAML)

I've built enough Express and Flask APIs to know the drill: router, DB client, logger, metrics, health endpoint, Dockerfile, then three hours of glue. I wanted to see if Go's GoFr framework actually removes that.

Short answer: mostly yes.

What is GoFr?

GoFr (https://gofr.dev) is an opinionated microservice framework for Go. CNCF-listed, 20k+ stars. The pitch: REST standards by default, config management, auth middleware, DB migrations, cron, websockets, Swagger, plus logs/traces/metrics out of the box. K8s-first thinking.

I liked that it doesn't try to be minimal. It tries to be complete.

Hello World in 5 lines

Prereq: Go 1.24+.

go get -u gofr.dev/pkg/gofr
Enter fullscreen mode Exit fullscreen mode

main.go:

package main
import "gofr.dev/pkg/gofr"
func main() {
  app := gofr.New()
  app.GET("/greet", func(ctx *gofr.Context) (any, error) {
    return "Hello World!", nil
  })
  app.Run() // localhost:8000
}
Enter fullscreen mode Exit fullscreen mode

go run main.go, open localhost:8000/greet. Done. No router setup, no server boilerplate.

What surprised me: observability

Terminal logs are pretty-printed with units. JSON logs have the same fields but no time unit on response_time — I hit exactly what issue #2480 discusses. Metrics buckets cap at 30s, so anything above shows as 30s. It's a small papercut, but it shows the project cares about log parity.

Health checks for datasources, built-in tracing, and Swagger rendering are all one-liners in the docs. I didn't need Prometheus client code for basic RED metrics.

What's next: porting my real project

I maintain astro-tasks — a Python CLI dev dashboard on PyPI with GitHub CLI integration and git health checks — and Finance-Hub (live market monitoring + AI predictions).

Both currently poll APIs on a loop and I hand-roll logging. Next step: port Finance-Hub's market poller to GoFr:

  • GET /markets with built-in observability instead of my Python logger
  • GoFr cron for the polling interval instead of while True + sleep
  • Health check for the data source instead of my custom check

Same for my Rust static file server in rust-projects — GoFr's abstracted file systems + Swagger would kill half that code.

If you're a Python/TS dev curious about Go, GoFr is the lowest-friction entry I've found. No YAML hell, just code.

What would you build? I'm thinking URL shortener next.

Built with GoFr, Go 1.24. Repo: https://github.com/gofr-dev/gofr Docs: https://gofr.dev/docs My projects: https://github.com/3ni8ma

Top comments (0)