Skip to content

About

Production-grade Go utility library — reusable packages for REST API services.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Go Toolkit

Go Reference CI Go Report Card License Go Version

A collection of production-grade utility packages for building REST API services in Go. Go Toolkit provides reusable, well-tested building blocks for common backend tasks — from error handling and configuration management to database connections and JWT authentication — so you can focus on your application logic instead of reinventing infrastructure.

Installation

# Core module (lightweight utilities)
go get github.com/alpardfm/go-toolkit

# Heavy module (database, AWS, logging, JWT, etc.)
go get github.com/alpardfm/go-toolkit/heavy

Requires Go 1.21 or later.

Module Structure

The toolkit is split into two Go modules to minimize dependency bloat:

Module Import Path Description
Core github.com/alpardfm/go-toolkit Lightweight utilities with minimal dependencies (operator, convert, errors, codes, concurrency, hash, encrypt, random, format, files, validation, distance, appcontext, language, header, sorter, parser)
Heavy github.com/alpardfm/go-toolkit/heavy Packages requiring large external dependencies (configbuilder, configreader, nosql, sql, smtp, log, tokens, query)

If you only need lightweight utilities like type conversion, error handling, or hashing, import the core module — your project won't pull in AWS SDK, MongoDB driver, or database drivers.

For details on which dependencies each package requires, see DEPENDENCIES.md. If you're migrating from the single-module layout, see MIGRATION.md for updated import paths.

Package Overview

Package Description GoDoc
appcontext Request-scoped context value management GoDoc
codes Error code registry with bilingual messages (EN/ID) GoDoc
concurrency Goroutine worker pool with configurable max workers GoDoc
configbuilder AWS SSM parameter store config generator GoDoc
configreader Viper-based configuration file reader GoDoc
convert Type conversion utilities (int64, float64, string, struct copy) GoDoc
distance Geographic distance calculation GoDoc
encrypt AES-256-GCM encryption/decryption GoDoc
errors Stacktrace-enriched error handling with error codes GoDoc
files File system utilities GoDoc
format Date and string formatting helpers GoDoc
hash Password hashing (argon2, bcrypt, sha256) GoDoc
header HTTP header extraction utilities GoDoc
language Bilingual text support (EN/ID) GoDoc
log Structured logging via zerolog GoDoc
nosql MongoDB client wrapper GoDoc
operator Ternary operator and generic utilities GoDoc
parser JSON marshaling/unmarshaling interface GoDoc
query SQL/GQL query builder from struct tags GoDoc
random Random value generation (int, UUID-based) GoDoc
smtp Email sending via gomail GoDoc
sorter Generic sorting with custom comparators GoDoc
sql Database connection management (leader/follower) GoDoc
tokens JWT token creation and validation GoDoc
validation Input validation utilities (email, etc.) GoDoc

Breaking Changes (v1.0.0)

The following breaking changes were introduced in v1.0.0 to improve safety and correctness:

  • configbuilder: Init() now returns (Interface, error) instead of Interface
  • configreader: Init() now returns (Interface, error) instead of Interface
  • sql: Init() now returns (Interface, error) instead of Interface
  • concurrency: Do() now returns a multi-error (via errors.Join) containing all goroutine errors
  • tokens: JWT library migrated from dgrijalva/jwt-go/v4 to golang-jwt/jwt/v5

See CHANGELOG.md for full details.

Versioning

This project follows Semantic Versioning 2.0.0. Releases are tagged using annotated git tags in the format vMAJOR.MINOR.PATCH.

  • MAJOR version increments indicate breaking API changes
  • MINOR version increments add functionality in a backward-compatible manner
  • PATCH version increments include backward-compatible bug fixes

See CHANGELOG.md for a history of changes by version.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for development setup, coding standards, and the pull request process.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Production-grade Go utility library — reusable packages for REST API services.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages