{"id":49877306,"url":"https://github.com/romssc/fluxx","last_synced_at":"2026-05-15T12:43:31.902Z","repository":{"id":314607296,"uuid":"1055520070","full_name":"romssc/fluxx","owner":"romssc","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-13T13:49:16.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-13T15:47:05.450Z","etag":null,"topics":["go","http","middleware","package","server-library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romssc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-09-12T11:40:50.000Z","updated_at":"2025-09-13T13:49:19.000Z","dependencies_parsed_at":"2025-09-13T15:47:08.588Z","dependency_job_id":"378ac768-f87e-4265-b8ee-1c9b4c47f856","html_url":"https://github.com/romssc/fluxx","commit_stats":null,"previous_names":["romssc/fluxx"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/romssc/fluxx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romssc%2Ffluxx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romssc%2Ffluxx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romssc%2Ffluxx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romssc%2Ffluxx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romssc","download_url":"https://codeload.github.com/romssc/fluxx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romssc%2Ffluxx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"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":["go","http","middleware","package","server-library"],"created_at":"2026-05-15T12:43:31.319Z","updated_at":"2026-05-15T12:43:31.892Z","avatar_url":"https://github.com/romssc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"⚠️ ***Status:** package is under development - APIs may change.*\r\n\r\n---\r\n\r\n\u003cimg src=\"https://github.com/user-attachments/assets/d5447791-c42c-421b-9bde-fdbbdad407f1\" alt=\"logo\" width=\"200\"/\u003e\r\n\r\n**Fluxx** is a lightweight, opinionated HTTP library for **Go**. It provides a thin abstraction over the **Go** **[net/http](https://pkg.go.dev/net/http@go1.25.1)** package, with utilities for request reading, response sending, and graceful server lifecycle management.\r\n\r\nDesigned to stay close to the **Go** **[standard library](https://pkg.go.dev/std)**, but with just enough ergonomics to make your web server development simpler!\r\n\r\n## 🕸️ Quick Start\r\n\r\nThis guide will follow you through your first steps to use this package.\r\n\r\n### Get it\r\n\r\n```bash\r\ngo get -u github.com/romssc/fluxx\r\n```\r\n\r\n### Use it\r\n\r\nGetting started with **Fluxx** is easy. Here's a basic example to create a simple web server that responds with \"hello!\" on the root path. This example demonstrates initializing a new **Fluxx** **[App](#typeApp)**, setting up a route, and starting the server.\r\n\r\n```go\r\nfunc main() {\r\n    mux := http.NewServeMux()\r\n\tmux.HandleFunc(\"/\", fluxx.HandlerFuncAdapter(func(c *fluxx.Ctx) {\r\n        c.Send().JSON(http.StatusOK, \"hello!\")\r\n\t}))\r\n\r\n\tapp := fluxx.New(fluxx.Config{\r\n\t\tAddress:      \":8080\",            // or \"localhost:8080\" just like in the standart net/http\r\n\t\tReadTimeout:  5 * time.Second,\r\n\t\tWriteTimeout: 10 * time.Second,\r\n\t\tMux: http.NewServeMux(),          // in this example it's the standart mux, might as well be chi or any other.\r\n\t})\r\n\r\n\tif err := app.Listen(); err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n}\r\n```\r\n\r\n### Run it\r\n\r\n```bash\r\ngo run main.go\r\n```\r\n\r\n### Check out the fancy startup message\r\n\r\nThis message will also contain some of your **[Config](#typeConfig)** settings, just for convenience.\r\n\r\n\u003cimg src=\"https://github.com/user-attachments/assets/7594c989-fc15-4b5a-b1f2-e3d7f9b68252\" alt=\"screenshot\" width=\"300\"/\u003e\r\n\r\n## 🧬 Middleware\r\n\r\nHere is a list of middleware that are included within the **Fluxx**.\r\n\r\n| Title | Description |\r\n| :------- | :------- |\r\n| [rid](https://github.com/romssc/fluxx/tree/9f657007e7c081c3823537b2513ae345f9f593b1/middleware/rid) | Allow to track Request ID, creates one if there's none. |\r\n| [timeout](https://github.com/romssc/fluxx/tree/9f657007e7c081c3823537b2513ae345f9f593b1/middleware/timeout) | Sets a time to handle the request. |\r\n| [key](https://github.com/romssc/fluxx/tree/9f657007e7c081c3823537b2513ae345f9f593b1/middleware/key) | Simple API Key validator. |\r\n\r\n## 📄 Documentation \u003ca name=\"index\"\u003e\u003c/a\u003e\r\n\r\n[Index](#index)\r\n\r\n[Variables](#variables)\r\n\r\n[Functions](#functions)\r\n- [func New(c Config) *App](#funcNew)\r\n- [func HandlerFuncAdapter(h FluxxHandlerFunc) http.HandlerFunc](#funcHandlerFuncAdapter)\r\n\r\n[Types](#types)\r\n- [type App](#typeApp)\r\n    - [func (a *App) Listen() error](#appFuncListen)\r\n    - [func (a *App) ListenTLS(certificate, key string) error](#appFuncListenTLS)\r\n    - [func (a *App) GracefulShutdown(timeout time.Duration) error](#appFuncGracefulShutdown)\r\n- [type Config](#typeConfig)\r\n- [type Ctx](#typeCtx)\r\n    - [func (c *Ctx) Read() *Reader](#ctxFuncRead)\r\n    - [func (c *Ctx) Send() *Sender](#ctxFuncSend)\r\n- [type Reader](#typeReader)\r\n    - [func (r *Reader) QueryParam(key string, defaultValue …string) (string, bool)](#readerFuncQueryParam)\r\n- [type Sender](#typeSender)\r\n    - [func (s *Sender) Error(status int, message string)](#senderFuncError)\r\n    - [func (s *Sender) JSON(status int, data any, customHeaders …map[string]string) error](#senderFuncJSON)\r\n    - [func (s *Sender) File(content, filename, path string, customHeaders …map[string]string)](#senderFuncFile)\r\n- [type FluxxHandlerFunc](#typeFluxxHandlerFunc)\r\n\r\n### Variables \u003ca name=\"variables\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nErrListening    = errors.New(\"[ERROR] fluxx: FAILED WHILE LISTENING\")\r\nErrShuttingDown = errors.New(\"[ERROR] fluxx: FAILED WHILE SHUTTING DOWN\")\r\n```\r\n\r\n*Error values returned by server lifecycle operations.*\r\n\r\n### Functions \u003ca name=\"functions\"\u003e\u003c/a\u003e\r\n\r\n#### func New \u003ca name=\"funcNew\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc New(c Config) *App\r\n```\r\n\r\n#### func HandlerFuncAdapter \u003ca name=\"funcHandlerFuncAdapter\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc HandlerFuncAdapter(h FluxxHandlerFunc) http.HandlerFunc\r\n```\r\n\r\n***HandlerFuncAdapter** adapts a **FluxxHandlerFunc** into a standard **http.HandlerFunc**.*\r\n\r\n### Types \u003ca name=\"types\"\u003e\u003c/a\u003e\r\n\r\n#### type App \u003ca name=\"typeApp\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype App struct {\r\n    // contains filtered or unexported fields\r\n}\r\n```\r\n\r\n***App** represents the **Fluxx** HTTP application. It manages server configuration and lifecycle.*\r\n\r\n#### func Listen \u003ca name=\"appFuncListen\"\u003e\r\n\r\n```go\r\nfunc (a *App) Listen() error\r\n```\r\n\r\n***Listen** starts the HTTP server. It blocks until the server shuts down or fails.*\r\n\r\n#### func ListenTLS \u003ca name=\"appFuncListenTLS\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (a *App) ListenTLS(certificate, key string) error\r\n```\r\n\r\n***ListenTLS** starts the server with TLS enabled.*\r\n\r\n#### func GracefulShutdown \u003ca name=\"appFuncGracefulShutdown\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (a *App) GracefulShutdown(timeout time.Duration) error\r\n```\r\n\r\n***GracefulShutdown** attempts to shut down the server gracefully within the given timeout.*\r\n\r\n#### type Config \u003ca name=\"typeConfig\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype Config struct {\r\n    Address      string\r\n    ReadTimeout  time.Duration\r\n    WriteTimeout time.Duration\r\n    TLS          *tls.Config\r\n    Mux          http.Handler\r\n}\r\n```\r\n\r\n***Config** holds the configuration options for creating a new **App**.*\r\n\r\n#### type Ctx \u003ca name=\"typeCtx\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype Ctx struct {\r\n    // contains filtered or unexported fields\r\n}\r\n```\r\n\r\n***Ctx** wraps the HTTP request and response, providing ergonomic helpers for reading inputs and sending outputs.*\r\n\r\n#### func Read \u003ca name=\"ctxFuncRead\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (c *Ctx) Read() *Reader\r\n```\r\n\r\n***Read** returns the request reader.*\r\n\r\n#### func Send \u003ca name=\"ctxFuncSend\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (c *Ctx) Send() *Sender\r\n```\r\n\r\n***Send** returns the response sender.*\r\n\r\n#### type Reader \u003ca name=\"typeReader\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype Reader struct {\r\n    Request *http.Request\r\n}\r\n```\r\n\r\n***Reader** provides methods for accessing request data.*\r\n\r\n#### func QueryParam \u003ca name=\"readerFuncQueryParam\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (r *Reader) QueryParam(key string, defaultValue ...string) (string, bool)\r\n```\r\n\r\n***QueryParam** returns the query parameter by key. If not present, an optional default value may be used. The second return value indicates whether a value was found or defaulted.*\r\n\r\n#### type Sender \u003ca name=\"typeSender\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype Sender struct {\r\n    Writer http.ResponseWriter\r\n    // contains filtered or unexported fields\r\n}\r\n```\r\n\r\n***Sender** provides methods for writing responses.*\r\n\r\n#### func Error \u003ca name=\"senderFuncError\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (s *Sender) Error(status int, message string)\r\n```\r\n\r\n***Error** sends an HTTP error response with the given status code and message.*\r\n\r\n#### func JSON \u003ca name=\"senderFuncJSON\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (s *Sender) JSON(status int, data any, customHeaders ...map[string]string) error\r\n```\r\n\r\n***JSON** sends a JSON response with the given status code, data, and optional headers.*\r\n\r\n#### func File \u003ca name=\"senderFuncFile\"\u003e\u003c/a\u003e\r\n\r\n```go\r\nfunc (s *Sender) File(content, filename, path string, customHeaders ...map[string]string)\r\n```\r\n\r\n***File** serves a file response with content type and disposition headers.*\r\n\r\n#### type FluxxHandlerFunc \u003ca name=\"typeFluxxHandlerFunc\"\u003e\u003c/a\u003e\r\n\r\n```go\r\ntype FluxxHandlerFunc func(c *Ctx)\r\n```\r\n\r\n***FluxxHandlerFunc** defines a handler that operates on a **Fluxx** context.*\r\n\r\n## 🏴󠁩󠁤󠁳󠁭󠁿 License\r\n\r\n[MIT](https://opensource.org/license/mit)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromssc%2Ffluxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromssc%2Ffluxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromssc%2Ffluxx/lists"}