language

Neutron Go

A Go framework for concurrent services with auth, real-time, and database already finished. Goroutine-native handlers, pgx/v5 transport, typed Nucleus client. One binary, zero runtime.

Go's concurrency, without bringing your own auth.

Available
OAuth2+ WebAuthn Passkeys
pgx/v5Native Transport
14Data Models
1Static Binary

Auth is already done.

The reason Go backends get abandoned halfway isn't the language — it's the hour on day three when you realize you need OAuth and there's no batteries-included option. Neutron Go ships neutronauth with OAuth2 for GitHub, Google, and Discord (PKCE-first), WebAuthn passkeys (P-256 ECDSA), JWT signing and verification, session handling, and CSRF. You wire a provider, register a callback, and you're done.

main.go
package main

import (
    "github.com/neutron-dev/neutron-go/neutron"
    "github.com/neutron-dev/neutron-go/neutronauth"
    "github.com/neutron-dev/neutron-go/nucleus"
)

func main() {
    db := nucleus.Connect("postgres://localhost/app")
    auth := neutronauth.New(neutronauth.Config{
        GitHub:    neutronauth.OAuth{ClientID: env("GH_ID"), Secret: env("GH_SECRET")},
        Google:    neutronauth.OAuth{ClientID: env("GG_ID"), Secret: env("GG_SECRET")},
        WebAuthn:  neutronauth.WebAuthnConfig{RPID: "example.com", Origin: "https://example.com"},
        SessionDB: db.KV("sessions"),
    })

    app := neutron.New()
    app.Mount("/auth", auth.Routes())
    app.GET("/me", auth.Required(), func(c *neutron.Ctx) error {
        return c.JSON(200, auth.User(c))
    })
    app.Listen(":8080")
}
Real OAuth + WebAuthn wiring. 20 lines.
Goroutine-native handlers
Every request gets its own goroutine. 100K+ concurrent connections on one server, with Go's work-stealing scheduler doing the scheduling.
Idiomatic routing
Built on Go 1.22+ ServeMux with pattern matching. Composable groups, OpenAPI 3.1 generation, type-safe path params.
OAuth2 + WebAuthn
Full social-auth flows with PKCE. Passkey registration and assertion. Session stores backed by Nucleus KV or in-memory.
pgx/v5 native
The fastest Postgres driver in Go, wired straight to Nucleus. Pool lifecycle, prepared statements, context cancellation — all defaulted right.
Typed middleware
Auth, CORS, rate limiting, compression, logging, tracing. Chain at global or route level; Go's type system enforces contracts.
gRPC + WebSocket
First-class gRPC service hosting alongside REST. WebSocket with goroutine-per-connection. Real-time without complexity.

All 14 data models, one connection.

The nucleus package gives you typed accessors for every model Nucleus supports — no separate library per storage engine, no version skew.

recommend.go
func recommend(c *neutron.Ctx) error {
    var q struct {
        Prompt string ``json:"prompt"``
        K      int    ``json:"k"``
    }
    if err := c.Bind(&q); err != nil { return err }

    emb, err := embed(c.Context(), q.Prompt)
    if err != nil { return err }

    tx, _ := db.Begin(c.Context())
    defer tx.Rollback(c.Context())

    hits, _ := tx.Vector("articles").Search(emb).K(q.K).Do(c.Context())
    enriched, _ := tx.SQL().Query(
        "SELECT id, title, author FROM articles WHERE id = ANY($1)",
        hitIDs(hits),
    ).All(c.Context())

    tx.Commit(c.Context())
    return c.JSON(200, enriched)
}
Vector search + SQL join in one transaction.

What's in the box

HTTP
Go 1.22 ServeMux + typed middleware
Auth
OAuth2 + WebAuthn + JWT + CSRF
Nucleus
pgx/v5, all 14 models, pool-aware
gRPC
First-class alongside REST
Deploy
Single static binary, scratch image

Deploy. Done.

Compile to one static binary with go build. No runtime to install, no dependency tree to vendor, no golang:1.21-alpine base image. The binary is the artifact.

deploy.sh
# Build for Linux, copy to server, restart systemd unit.
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o app .
scp app prod:/usr/local/bin/myapp
ssh prod systemctl restart myapp

What it's for

API gateways handling millions of requests. Microservice architectures with gRPC between services. Cloud infrastructure tooling — CLIs, controllers, Kubernetes operators. Real-time services with WebSocket fan-out. Background job workers. Anywhere you want Go's concurrency story and would rather not reimplement a login screen.

Why Go for services?

Goroutines give you concurrency without callbacks or async runtimes. The type system catches errors at compile time without generics-heavy ceremony. Single-binary deployment means no runtime install, no dependency hell, no container layer audit. And it compiles in seconds.

Part of a bigger system

Neutron TypeScript on the edge. Neutron Go for the services. Neutron Rust where performance wins. All three talk to the same Nucleus database through the same contract — same wire protocol, same RFC 7807 errors, same health endpoints. Add what you need without rearchitecting.