requestCore is a Go library for handling RESTful requests with a framework-agnostic core and adapters for Gin, Fiber, and net/http. It provides a unified request/context layer, query execution abstractions, response handling, logging, tracing, and testing utilities.
It is designed to reduce boilerplate around request processing while keeping the implementation composable, interface-driven, and portable across web frameworks.
-
Framework adapters
- Gin
- Fiber
- net/http
- testing support
-
Unified request context
- normalized access to framework context
- request metadata extraction
- trace propagation
- user identity handling
-
Query and DB abstraction
- multi-database support
- query runner abstraction
- mock database mode for tests
-
Request lifecycle helpers
- request initialization
- duplicate request detection
- request insert/update flows
- context-aware request operations
-
Structured logging
slog-based logging support- framework-aware logger integrations
- Splunk-oriented logging support
-
OpenTelemetry support
- trace extraction and propagation
- request context instrumentation
- observability-friendly design
-
Testing utilities
- fake/mock infrastructure
- testing-aware context initialization
- mock DB mode
-
Additional utilities
- validation helpers
- response helpers
- error handling
- crypto/security helpers
- HTTP API calling utilities
- Swagger-related support
requestCore is intended to provide a reusable foundation for handling request-oriented backend workflows such as:
- request parsing and normalization
- request logging and tracing
- request persistence and duplicate checking
- database query execution
- consistent response generation
- integration with multiple HTTP frameworks
The codebase is organized around small interfaces and adapter packages rather than a single large runtime framework.
The repository is centered around a thin root façade and multiple focused subpackages:
requestCore.go- exposes the main
RequestCoreModel - provides access to:
- DB/query runner
- ORM interface
- request tools
- response handler
- parameter interface
- exposes the main
-
libContext- framework-aware context initialization
- tracing extraction
- user and framework metadata handling
-
libRequest- request lifecycle and persistence operations
- initialization paths with and without logging
- duplicate detection
- context-aware updates
-
libQuery- query runner abstraction
- DB mode handling
- execution helpers
- ORM-oriented query support
-
response- response handling
- error response modeling
- sanitization and web handler support
-
libParams- parameter modeling and loading
- networking, logging, DB, and security parameters
libGinlibFiberlibNetHttpwebFramework
libLoggerlibTracinglibErrorlibValidatelibCallApilibCryptohandlersswaggertestingtools
requestCore currently supports:
- Gin
- Fiber
- net/http
- testing
- Go 1.x
- A supported SQL database driver, depending on your chosen DB mode
- Optional:
- OpenTelemetry
- structured logging backend
- ORM integration
go get github.com/hmmftg/requestCoreThen import the package in your project:
import "github.com/hmmftg/requestCore"The exact initialization pattern depends on which framework adapter you use.
The example below shows the intent of the library: create a core model and use it to access request, query, response, and parameter services.
package main
import (
"fmt"
requestcore "github.com/hmmftg/requestCore"
)
func main() {
core := requestcore.NewRequestCore()
fmt.Println(core != nil)
}If your project initializes through a specific framework context, you would typically:
- create the request context
- initialize
libContext - access request/query/response services through the root model
Root façade exposing the main interfaces.
Detects and normalizes framework context, including:
- Gin
- Fiber
- net/http
- testing
Also integrates tracing metadata and user identity extraction.
Request operations such as:
- initialization
- duplicate checking
- request insertion
- updates with context
- no-log initialization path
Database/query layer with support for multiple DB modes, including:
- Oracle
- PostgreSQL
- SQLite
- MySQL
- Mock DB
Response generation and error handling utilities.
Logging utilities, including slog and Splunk-oriented integrations.
OpenTelemetry-related tracing and instrumentation helpers.
Input validation helpers.
Utilities for calling external APIs and handling auth/multi-call scenarios.
Cryptographic and security primitives.
Reusable handler implementations for request, query, DML, pagination, recovery, and API call flows.
Test helpers, mocks, and simulation utilities.
requestCore is observability-friendly and includes support for:
- trace context extraction
- OpenTelemetry integration
- framework-aware logging
- structured logs via
slog - framework-specific logging adapters
This makes it suitable for services that need request-level visibility without hard-coding observability into business logic.
The query layer supports multiple DB modes, including:
- Oracle
- PostgreSQL
- SQLite
- MySQL
- Mock DB
This makes the library suitable for heterogeneous environments and for testing without a real database.
The repository includes a strong testing story:
- framework-aware testing support
- mock DB mode
- fake API helpers
- package-level unit tests
- testing context support
This allows request handling, query execution, and framework adapters to be tested independently.
requestCore appears to follow these principles:
- composition over inheritance
- framework portability
- interface-driven design
- explicit abstractions
- observability by default
- testability first
requestCore/
├── requestCore.go
├── libContext/
├── libRequest/
├── libQuery/
├── libParams/
├── response/
├── libLogger/
├── libTracing/
├── libValidate/
├── libCallApi/
├── libCrypto/
├── handlers/
├── swagger/
├── testingtools/
├── libGin/
├── libFiber/
├── libNetHttp/
└── webFramework/
Additional documentation included in the repository:
OPENTELEMETRY_INTEGRATION.mdNETHTTP_IMPLEMENTATION_COMPLETE.mdDYNAMIC_HEADERS_GUIDE.mdVERSIONING.mdVERSIONING_SETUP.mdSETUP_COMPLETE.md
Contributions are welcome.
Suggested areas for contribution:
- framework adapters
- documentation
- observability enhancements
- request lifecycle helpers
- database integrations
- tests and examples
See LICENSE for license information.
This README is intentionally written to reflect the repository’s actual structure and verified responsibilities. If you want, I can also generate:
- a shorter, polished GitHub README
- a more enterprise-style README
- a README with real code examples based on the exported APIs
- a comparison section vs Kratos / Gin / Fiber / composable stack