Full-Stack Go + React
The sequel to Shipping Go: From Source to Service. That course left you with a routed, tested, SQLite-backed Go service compiled to one static binary. This one puts a real frontend on it: a Vite React SPA that talks to your Go API. You'll draw the API-first boundary between server and client, run the two-server dev loop with Vite proxying to Go (and learn what CORS is actually for), write a typed fetch layer with loading, error, and optimistic-update states, carry auth across the boundary with session cookies and Go middleware, then embed the built SPA into the binary — so the deployable is still exactly one file.
5 lessons · ~2 hours
1. One Binary, Two Worlds
The shape of the app
A Go module root with a web/ Vite app inside it, an /api/ prefix as the boundary, and an API-first rule for deciding what lives server-side vs client-side.
The dev loop
Two dev servers — Go on 8080, Vite on 5173 — joined by Vite's server.proxy, which keeps the browser on one origin and makes CORS a production-only concern.
Talking to the API
One typed fetch helper for the whole app, honest loading/error/data states, and optimistic updates that roll back when the server says no.
Auth across the boundary
An HttpOnly SameSite session cookie beats a localStorage bearer token for a same-origin SPA, Go middleware wraps only the routes that need it, and the fetch helper turns 401 into "go log in".
One deployable
vite build emits dist/, //go:embed bakes it into the binary, a fallback route serves index.html for unknown non-API paths, and CGO_ENABLED=0 ships it all as one file.