Modular, reusable Go packages for backend applications. Each package is its own module with a small interface surface so you can pull in only what you need.
| Package | Description |
|---|---|
| cache | Key-value cache (Redis + in-memory) |
| container | Thread-safe service locator |
| httpclient | Fluent HTTP client with retry and timeout |
| httprouter | HTTP router on net/http (Go 1.22+ patterns) |
| logging | Structured logging (slog / zap) |
| mailer | Email delivery (SMTP, AWS SES) |
| queue | Background jobs on Redis (asynq) |
| storage | File storage (local filesystem, S3) |
| support | Env helpers and size formatting |
| validation | Struct, map, and field validation |
| view | HTML template engine with layouts |
| workerpool | In-process concurrent job pool |
- Go 1.25+
- Optional services depending on the package (Redis, AWS, SMTP)
This repo is a multi-module workspace. Install a package by path:
go get github.com/fatkulnurk/foundation/cache@v0.3.0
go get github.com/fatkulnurk/foundation/logging@v0.3.0
go get github.com/fatkulnurk/foundation/queue@v0.3.0Prefer a version tag (@v0.3.0) or @latest. Do not go get github.com/fatkulnurk/foundation alone — the root module has no library code.
package main
import (
"context"
"net/http"
"github.com/fatkulnurk/foundation/cache"
"github.com/fatkulnurk/foundation/httprouter"
"github.com/fatkulnurk/foundation/logging"
)
func main() {
logging.InitLogging(logging.NewSlogLogger(nil))
c := cache.NewLocalCache(&cache.Config{Prefix: "app:"})
if lc, ok := c.(*cache.LocalCache); ok {
defer lc.Close()
}
r := httprouter.New()
r.GET("/health", func(w http.ResponseWriter, req *http.Request) {
_ = c.Set(req.Context(), "ok", "1", 60)
httprouter.WriteJSON(w, http.StatusOK, map[string]string{"status": "up"})
})
logging.Info(context.Background(), "listening", logging.NewField("addr", ":8080"))
http.ListenAndServe(":8080", r)
}git clone https://github.com/fatkulnurk/foundation.git
cd foundation
make test # unit tests for all modules
make test-race # with race detector
make gen-mocks # regenerate interface mocks
make tidy # go mod tidy per moduleWorkspace file: go.work. CI runs on every push/PR via GitHub Actions.
Tags are cut at the repository root (e.g. v0.3.0). For multi-module consumers, install each package at the same tag when possible.