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.
# 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/heavyRequires Go 1.21 or later.
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 | Description | GoDoc |
|---|---|---|
| appcontext | Request-scoped context value management | |
| codes | Error code registry with bilingual messages (EN/ID) | |
| concurrency | Goroutine worker pool with configurable max workers | |
| configbuilder | AWS SSM parameter store config generator | |
| configreader | Viper-based configuration file reader | |
| convert | Type conversion utilities (int64, float64, string, struct copy) | |
| distance | Geographic distance calculation | |
| encrypt | AES-256-GCM encryption/decryption | |
| errors | Stacktrace-enriched error handling with error codes | |
| files | File system utilities | |
| format | Date and string formatting helpers | |
| hash | Password hashing (argon2, bcrypt, sha256) | |
| header | HTTP header extraction utilities | |
| language | Bilingual text support (EN/ID) | |
| log | Structured logging via zerolog | |
| nosql | MongoDB client wrapper | |
| operator | Ternary operator and generic utilities | |
| parser | JSON marshaling/unmarshaling interface | |
| query | SQL/GQL query builder from struct tags | |
| random | Random value generation (int, UUID-based) | |
| smtp | Email sending via gomail | |
| sorter | Generic sorting with custom comparators | |
| sql | Database connection management (leader/follower) | |
| tokens | JWT token creation and validation | |
| validation | Input validation utilities (email, etc.) |
The following breaking changes were introduced in v1.0.0 to improve safety and correctness:
- configbuilder:
Init()now returns(Interface, error)instead ofInterface - configreader:
Init()now returns(Interface, error)instead ofInterface - sql:
Init()now returns(Interface, error)instead ofInterface - concurrency:
Do()now returns a multi-error (viaerrors.Join) containing all goroutine errors - tokens: JWT library migrated from
dgrijalva/jwt-go/v4togolang-jwt/jwt/v5
See CHANGELOG.md for full details.
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.
Contributions are welcome! Please read CONTRIBUTING.md for development setup, coding standards, and the pull request process.
This project is licensed under the MIT License. See the LICENSE file for details.