Hi devs,
I released a small Go package called noy:
noy is a tiny wrapper around Go’s standard http.ServeMux.
It gives each request a typed state object. Middleware can write request-local data to that state, and handlers can read it as normal Go fields.
For example, auth middleware can set:
state.CurrentUser = user
Then the handler can use:
state.CurrentUser.Name
without using context.WithValue and type assertions.
Why I made it:
In many net/http apps, request-local values like the current user, request ID, or loaded domain objects are passed through context.Context. This works, but the compiler cannot check the key or the type.
noy keeps the standard net/http style, but makes this request-local data explicit and typed.
It is not a full web framework. It only adds typed request state around http.ServeMux.
I would be happy to get feedback on the API, docs, and whether this idea feels useful for real net/http apps.