How Golte works: SSR and Hydration
masterGolte enables Server-Side Rendering (SSR) and hydration for Svelte components within a Go application without requiring NodeJS in production.
The Workflow:
- Compilation: During development, Svelte source files are compiled to client and server JavaScript (requires NodeJS).
- Embedding: The generated code is embedded into your Go binary using Go's
embedpackage. - Middleware: A middleware is generated from the build, which you register with your Go router.
- Rendering: You use functions like
golte.RenderPageandgolte.AddLayoutto serve components. - Deployment: After
go build, you get a single, self-contained binary containing the full web app.