Skip to content

fatkulnurk/foundation

Repository files navigation

Foundation Packages

A collection of reusable Go packages for building modern web applications. These packages provide common functionality with clean interfaces, making it easy to build scalable and maintainable applications.

Available Packages

Package Description
cache Temporary data storage (Redis, in-memory)
container Dependency injection container
httpclient HTTP client with retry and timeout
httprouter HTTP router with middleware
logging Structured logging with log/slog, zap, and etc
mailer Email sending (SMTP, AWS SES)
queue Task queue with Redis
shared Shared utilities
storage File storage (Local, S3)
support Support utilities
validation Data validation with 20+ rules
view Template rendering engine
workerpool Concurrent task processing

Installation

Install all packages:

go get github.com/fatkulnurk/foundation

Or install specific packages:

# Install specific package
go get github.com/fatkulnurk/foundation/cache
go get github.com/fatkulnurk/foundation/queue

Quick Example

// HTTP Router with Cache
r := httprouter.New()
cache := cache.NewRedisCache(config, redisClient)

r.GET("/users", func(w http.ResponseWriter, r *http.Request) {
    users, _ := cache.Get(r.Context(), "users")
    httprouter.WriteJSON(w, http.StatusOK, users)
})

// Background Queue
q, _ := queue.NewQueue(redisClient)
q.Enqueue(ctx, "email:send", payload, queue.MaxRetry(3))

Documentation

Each package has detailed documentation in its README file. Click on the package name in the table above to view its documentation.


About

Collection of modular, reusable backend components. Includes caching, queues, storage (S3/local), logging, mailer, validation, and etc.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages