{"id":28448450,"url":"https://github.com/barisgit/goflux","last_synced_at":"2025-07-01T02:31:54.989Z","repository":{"id":296404977,"uuid":"993146313","full_name":"barisgit/goflux","owner":"barisgit","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-30T18:40:35.000Z","size":259,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-30T18:59:39.386Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barisgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2025-05-30T09:44:23.000Z","updated_at":"2025-05-30T18:40:39.000Z","dependencies_parsed_at":"2025-05-30T19:01:44.457Z","dependency_job_id":"db00f363-631f-4673-9e87-e0edc1ab268f","html_url":"https://github.com/barisgit/goflux","commit_stats":null,"previous_names":["barisgit/goflux"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/barisgit/goflux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fgoflux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fgoflux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fgoflux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fgoflux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barisgit","download_url":"https://codeload.github.com/barisgit/goflux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fgoflux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262883657,"owners_count":23379235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-06-06T13:08:41.626Z","updated_at":"2025-07-01T02:31:54.975Z","avatar_url":"https://github.com/barisgit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoFlux Framework Packages\n\nThis directory contains minimal, modular utilities that can be imported by GoFlux projects to reduce boilerplate and add common functionality.\n\n## Available Packages\n\n### `goflux/openapi`\n\nOpenAPI specification generation utilities for Huma APIs.\n\n**Functions:**\n\n- `GenerateSpecToFile(api huma.API, outputPath string) error` - Generate and save OpenAPI spec to file\n- `GenerateSpec(api huma.API) ([]byte, error)` - Generate OpenAPI spec as JSON bytes\n- `GenerateSpecYAML(api huma.API) ([]byte, error)` - Generate OpenAPI spec as YAML bytes\n- `GetRouteCount(api huma.API) int` - Count the number of routes in the API\n\n### `goflux/dev`\n\nDevelopment utilities and CLI command helpers.\n\n**Functions:**\n\n- `AddOpenAPICommand(rootCmd *cobra.Command, apiProvider func() huma.API)` - Add OpenAPI generation command to CLI\n\n### `goflux/goflux` (Base Package)\nCore utilities for GoFlux applications.\n\n**Static File Serving:**\n\n- `StaticHandler(assets embed.FS, config StaticConfig) http.Handler` - Configurable static file serving\n- `StaticConfig` - Configuration for static file behavior (SPA mode, dev mode, asset directory, etc.)\n\n**Health Checks:**\n\n- `AddHealthCheck(api huma.API, path, serviceName, version string)` - Add standard health endpoint\n- `CustomHealthCheck(api huma.API, path string, healthFunc func(ctx context.Context) (*HealthResponse, error))` - Add custom health logic\n- `HealthResponse` - Standard health check response structure\n\n**OpenAPI Utilities:**\n\n- `AddOpenAPICommand(rootCmd *cobra.Command, apiProvider func() huma.API)` - Add OpenAPI CLI command\n- All OpenAPI generation functions re-exported from openapi package\n\n## Usage Example\n\n### Basic Health Check\n\n```go\nimport goflux \"github.com/barisgit/goflux\"\n\n// Simple health check\ngoflux.AddHealthCheck(api, \"/api/health\", \"My Service\", \"1.0.0\")\n\n// Custom health check\ngoflux.CustomHealthCheck(api, \"/api/health\", func(ctx context.Context) (*goflux.HealthResponse, error) {\n    // Your custom health logic here\n    resp := \u0026goflux.HealthResponse{}\n    resp.Body.Status = \"ok\"\n    resp.Body.Message = \"Custom health check passed\"\n    return resp, nil\n})\n```\n\n### Static File Serving\n\n```go\nimport (\n    \"embed\"\n    goflux \"github.com/barisgit/goflux\"\n)\n\n//go:embed dist/*\nvar assets embed.FS\n\n// Configure static serving\nstaticHandler := goflux.StaticHandler(assets, goflux.StaticConfig{\n    AssetsDir: \"dist\",\n    SPAMode:   true,  // Enable SPA routing\n    DevMode:   false, // Production mode\n    APIPrefix: \"/api/\",\n})\n\n// Use with any router\nrouter.Handle(\"/*\", staticHandler)\n```\n\n### OpenAPI CLI Command\n\n```go\nimport goflux \"github.com/barisgit/goflux\"\n\n// Add OpenAPI generation command\ngoflux.AddOpenAPICommand(cli.Root(), func() huma.API {\n    return setupAPI() // Your API setup function\n})\n\n// Now supports: ./server openapi -o api.json\n```\n\n## Philosophy\n\nGoFlux utilities follow these principles:\n\n1. **Minimal \u0026 Modular** - Small, focused utilities that users can pick and choose\n2. **User Control** - Users provide their own router setup and configuration  \n3. **No Magic** - Clear, explicit behavior without hidden abstractions\n4. **Framework Agnostic** - Works with any Huma-compatible router (Chi, Gin, Echo, etc.)\n5. **Embedded-First** - Designed for single-binary deployment with embedded assets\n\n## Future Exploration\n\nWe're exploring ideas for enhanced deployment and process management capabilities:\n\n- **Process Management** - Potential `flux serve` command with zero-downtime deployments\n- **Enhanced DI** - Improved dependency injection with lifecycle hooks  \n- **App Builder** - `goflux.NewApp()` for simplified setup\n- **Configuration** - Type-safe config loading with validation\n\nThese are early-stage concepts and not yet implemented.\n\n## Local Development\n\nTo use these packages locally in your projects before publishing:\n\n1. Add this to your project's `go.mod`:\n\n```go\nreplace github.com/barisgit/goflux =\u003e /path/to/your/goflux\n```\n\n2. Import the packages:\n\n```go\nimport goflux \"github.com/barisgit/goflux\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisgit%2Fgoflux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarisgit%2Fgoflux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisgit%2Fgoflux/lists"}