{"id":16497038,"url":"https://github.com/codelieutenant/uberfx-common","last_synced_at":"2026-01-18T13:28:23.791Z","repository":{"id":217347324,"uuid":"743649454","full_name":"CodeLieutenant/uberfx-common","owner":"CodeLieutenant","description":"GoFiber with UberFx ","archived":false,"fork":false,"pushed_at":"2025-08-04T22:03:57.000Z","size":310,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-12T14:35:16.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeLieutenant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["CodeLieutenant"],"ko-fi":"codelieutenant"}},"created_at":"2024-01-15T17:29:09.000Z","updated_at":"2025-10-28T20:51:16.000Z","dependencies_parsed_at":"2024-02-27T12:42:27.130Z","dependency_job_id":"b5c8f190-e009-4e38-ac45-ad944b220e66","html_url":"https://github.com/CodeLieutenant/uberfx-common","commit_stats":null,"previous_names":["dmalusev/fiberfx","codelieutenant/uberfx-common","dmalusev/uberfx-common"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/CodeLieutenant/uberfx-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLieutenant%2Fuberfx-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLieutenant%2Fuberfx-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLieutenant%2Fuberfx-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLieutenant%2Fuberfx-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeLieutenant","download_url":"https://codeload.github.com/CodeLieutenant/uberfx-common/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeLieutenant%2Fuberfx-common/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T13:04:05.990Z","status":"ssl_error","status_checked_at":"2026-01-18T13:01:44.092Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T14:37:51.669Z","updated_at":"2026-01-18T13:28:23.776Z","avatar_url":"https://github.com/CodeLieutenant.png","language":"Go","funding_links":["https://github.com/sponsors/CodeLieutenant","codelieutenant"],"categories":[],"sub_categories":[],"readme":"# UberFX Common Bindings\n\n[![Testing](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/test.yml/badge.svg)](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/test.yml)\n[![Linting](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/lint.yml/badge.svg)](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/lint.yml)\n[![Security](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/security.yml/badge.svg)](https://github.com/CodeLieutenant/uberfx-common/actions/workflows/security.yml)\n[![codecov](https://codecov.io/gh/CodeLieutenant/uberfx-common/graph/badge.svg?token=opB123xE25)](https://codecov.io/gh/CodeLieutenant/uberfx-common)\n[![Go Report Card](https://goreportcard.com/badge/github.com/CodeLieutenant/uberfx-common)](https://goreportcard.com/report/github.com/CodeLieutenant/uberfx-common)\n\nA collection of common modules and utilities for building Go applications with [Uber FX](https://github.com/uber-go/fx) dependency injection framework. This library provides ready-to-use FX modules for configuration, logging, database connections, HTTP servers, and AMQP messaging.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Modules](#modules)\n  - [configfx](#configfx)\n  - [loggerfx](#loggerfx)\n  - [databasesfx](#databasesfx)\n  - [http/fiber/fiberfx](#httpfiberfiberfx)\n  - [amqpfx](#amqpfx)\n- [Examples](#examples)\n- [License](#license)\n- [Contributing](#contributing)\n\n## Installation\n\nThis library requires Go 1.24 or later.\n\n```bash\ngo get github.com/CodeLieutenant/uberfx-common/v3\n```\n\n## Modules\n\n### configfx\n\nThe `configfx` module provides configuration management using [Viper](https://github.com/spf13/viper), integrated with Uber FX.\n\nFeatures:\n\n- Type-safe configuration with generics\n- Automatic loading from standard locations\n- Easy integration with FX dependency injection\n\nExample:\n\n```go\ntype AppConfig struct {\n    Port int `mapstructure:\"port\" yaml:\"port\" default:\"8080\"`\n    LogLevel string `mapstructure:\"log_level\" yaml:\"log_level\" default:\"info\"`\n}\n\nfunc main() {\n    app := fx.New(\n        // Load configuration\n        fx.Provide(func() (AppConfig, error) {\n            return configfx.New[AppConfig](\"myapp\")\n        }),\n\n        // Create a module with the loaded configuration\n        fx.Invoke(func(cfg AppConfig) {\n            // Use configuration\n        }),\n    )\n\n    app.Run()\n}\n```\n\n### loggerfx\n\nThe `loggerfx` module provides logging functionality using [zerolog](https://github.com/rs/zerolog), integrated with Uber FX.\n\nFeatures:\n\n- Multiple output sinks (stdout, stderr, file, buffered I/O)\n- Pretty printing option for development\n- Proper lifecycle management\n\nExample:\n\n```go\nfunc main() {\n    app := fx.New(\n        // Configure logging\n        loggerfx.ZerologModule(loggerfx.Sink{\n            Level:       \"info\",\n            Type:        loggerfx.Stdout,\n            PrettyPrint: true,\n        }),\n\n        // Use the logger\n        fx.Invoke(func(log zerolog.Logger) {\n            log.Info().Msg(\"Application started\")\n        }),\n    )\n\n    app.Run()\n}\n```\n\n### databasesfx\n\nThe `databasesfx` module provides PostgreSQL database integration using [pgx](https://github.com/jackc/pgx), with support for migrations via [golang-migrate](https://github.com/golang-migrate/migrate).\n\nFeatures:\n\n- Connection pooling\n- Configuration via struct\n- Database migrations\n- Proper lifecycle management\n\nExample:\n\n```go\nfunc main() {\n    app := fx.New(\n        // Configure and provide PostgreSQL connection\n        databasesfx.PostgresModule(databasesfx.PostgresConfig{\n            ApplicationName:    \"myapp\",\n            DBName:             \"mydatabase\",\n            Host:               \"localhost\",\n            Port:               5432,\n            Username:           \"postgres\",\n            Password:           \"password\",\n            MaxOpenConnections: 10,\n            // ... other configuration options\n        }),\n\n        // Use the database connection\n        fx.Invoke(func(pool *pgxpool.Pool) {\n            // Use the connection pool\n        }),\n    )\n\n    app.Run()\n}\n```\n\n### http/fiber/fiberfx\n\nThe `http/fiber/fiberfx` module provides integration with the [Fiber](https://github.com/gofiber/fiber) web framework.\n\nFeatures:\n\n- Easy route definition\n- Middleware support\n- Proper lifecycle management\n- Type-safe handler registration\n\nExample:\n\n```go\nfunc HelloHandler(c *fiber.Ctx) error {\n    return c.SendString(\"Hello, World!\")\n}\n\nfunc main() {\n    app := fx.New(\n        // Create the Fiber app\n        fiberfx.App(\n            \"myapp\",\n            fiberfx.Routes(\n                []fiberfx.RouteFx{\n                    fiberfx.Get(\"/hello\", HelloHandler),\n                    fiberfx.Get(\"/users/:id\", UserHandler),\n                },\n            ),\n        ),\n\n        // Run the app\n        fiberfx.RunApp(\":3000\", \"myapp\", 5*time.Second),\n    )\n\n    app.Run()\n}\n```\n\n### amqpfx\n\nThe `amqpfx` module provides integration with AMQP (RabbitMQ) for messaging, using [go-amqp](https://github.com/nano-interactive/go-amqp).\n\nFeatures:\n\n- Consumer and publisher support\n- Type-safe message handling with generics\n- Proper lifecycle management\n- Multiple consumer types (function-based, interface-based, raw)\n\nExample:\n\n```go\ntype Message struct {\n    Content string `json:\"content\"`\n}\n\nfunc handleMessage(ctx context.Context, msg Message) error {\n    // Process the message\n    return nil\n}\n\nfunc main() {\n    app := fx.New(\n        // Configure and provide AMQP consumer\n        amqpfx.ConsumerModuleFunc(\n            handleMessage,\n            consumer.QueueDeclare{\n                QueueName: \"my-queue\",\n                Durable:   true,\n            },\n            connection.Config{\n                ConnectionName: \"my-connection\",\n                URI:            \"amqp://guest:guest@localhost:5672/\",\n            },\n        ),\n\n        // Configure and provide AMQP publisher\n        amqpfx.PublisherModule[Message](\n            connection.Config{\n                ConnectionName: \"my-connection\",\n                URI:            \"amqp://guest:guest@localhost:5672/\",\n            },\n            \"my-exchange\",\n        ),\n\n        // Use the publisher\n        fx.Invoke(func(pub *publisher.Publisher[Message]) {\n            // Publish messages\n        }),\n    )\n\n    app.Run()\n}\n```\n\n## Examples\n\nThe repository includes several examples demonstrating how to use the various modules:\n\n- [Basic Fiber Example](examples/http/fiberfx/basic/main.go): A simple HTTP server using Fiber\n- [Middleware Example](examples/http/fiberfx/middleware/main.go): Using middleware with Fiber\n- [Route Middleware Example](examples/http/fiberfx/route_middleware/main.go): Applying middleware to specific routes\n- [Middleware with Dependencies Example](examples/http/fiberfx/middleware_with_deps/main.go): Using middleware with FX dependencies\n\n## License\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelieutenant%2Fuberfx-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelieutenant%2Fuberfx-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelieutenant%2Fuberfx-common/lists"}