Photon

Streaming-first
HTTP for Go.

Server-sent events, cancellation, and back-pressure built into a small net/http server. Your handlers and middleware stay the same.

go get github.com/agenticmarket/photon

Go 1.24+ · Zero dependencies · Apache 2.0

Go
app := photon.New()

app.POST("/chat", photon.SSE(func(
    s *photon.Stream, r *http.Request,
) error {
    for token := range model.Stream(r.Context()) {
        if err := s.Event("token", []byte(token)); err != nil {
            return err
        }
    }
    return s.Event("done", nil)
}))

app.Run(":8080")
// model.Stream is your token producer

Streaming built in

SSE, NDJSON, and raw streams. Events flush immediately. Heartbeats keep idle connections alive.

Documentation

Cancellation that propagates

Client disconnects cancel the request context. Stop upstream work when there’s no one left to receive it.

Documentation

Bounded by default

Per-stream buffers, back-pressure, and connection limits. Slow clients stay within a defined memory budget.

Documentation

Standard Go interfaces

Plain net/http handlers and middleware. HTTP/2 support. No runtime, adapters, or third-party dependencies.

Documentation

Measured over
a real connection.

Switch the stream count to compare published SSE results. Select a framework to inspect its throughput and measured process memory.

Ordinary HTTP requests tie within measurement noise. These results measure streaming over loopback, rather than production capacity.

Methodology & raw results

Ryzen 7 6800HS · Go 1.27.1 · Windows 11
Node.js 24.19 · client and server on the same machine.

SSE throughputevents / second

Photon10 concurrent streams

Events / second
1.84 M
Process memory (RSS)
18 MB

Published medians · higher throughput is better. Memory was measured at 10 streams only.

Start with a working project.

Scaffold an agent backend, an OpenAI-compatible proxy, or a plain HTTP API.

Installation guide

$ go install github.com/agenticmarket/photon/cmd/photon@latest

$ photon init my-agent -template agent

$ cd my-agent && go mod tidy && go run .