Common Backend Framework
Last updated
Last updated
Welcome to the Common Backend Framework repository! This project provides a collection of utilities, libraries, and frameworks designed to standardize and streamline the development of backend API services within our organization.
Gitbook:
Github Repo:
This repository serves as a central codebase for common functionalities and utilities used across various backend API projects. By consolidating shared code, we aim to:
Promote consistency and code standardization.
Reduce duplication of effort.
Facilitate easier maintenance and updates.
Accelerate development by providing ready-to-use components.
Include the framework in your project by adding it to your go.mod
file:
Import the Framework
Initialize Components Set up the components you need, such as the logger and tracer, in your application's entry point.
Looking for a real-world implementation?
Provides a structured, context-aware logging interface using logrus. Designed for both development and production environments.
Features:
Configurable log levels.
Structured logging with fields.
Context propagation for tracing (trace_id
, span_id
).
Flexible output destinations (stdout
, files
, etc.).
No-op logger for testing.
Implements distributed tracing capabilities to monitor and debug microservices.
Features:
Integrates with tracing systems like OpenTelemetry.
Captures spans and context propagation.
Minimal performance overhead.
Standardizes error handling and response formatting.
Features:
Consistent error formatting and wrapping.
Error codes and messages.
HTTP status code mapping.
Error response generation.
Handles event-driven workflows, including message parsing and callback mechanisms.
Features:
Integration with HTTP frameworks (like Gin).
Defining and processing event messages with flexible, user-defined payload types.
Generic payload support with Go generics.
A collection of helper functions and common utilities.
Features:
Date and time parsing.
String manipulation.
Configuration loading (e.g., from environment variables, config files).
etc.
Check out the , a clean-architecture-based backend service that demonstrates how to integrate and use the go-common
framework across all layers — config, logging, tracing, error handling, HTTP handlers, use cases, and repositories.
This project is licensed under the .