golte
- Purpose: Enables rendering Svelte components in Go HTTP handlers with SSR+hydration capabilities, eliminating the need for NodeJS in production.
- Key Features:
- SSR + Hydration support
- No NodeJS required in production
- Layouts as middleware (nestable)
- Custom error pages
- Compatible with Go stdlib and popular routers (
gorilla/mux
,chi
,gin
,echo
, etc.) - Compiles to a single self-contained executable
- How It Works:
- Compiles Svelte files to client/server JS (NodeJS only needed during development).
- Embeds generated code via Go's
embed
package. - Uses middleware to render components via functions like
golte.RenderPage
andgolte.AddLayout
.
- Svelte Support: Primary framework for frontend components (with SSR/hydration).
- Target Audience: Developers wanting to build Svelte frontends with Go backends, prioritizing SSR and single-binary deployment.
- Configuration: Customizable via
golte.config.[js|mjs|ts|mts]
(e.g., template paths, directories). - JavaScript Utilities:
preload
: Svelte action for client-side navigation.url
: Svelte store for current URL.
- Motivation: Created to address limitations in existing solutions (e.g., Bud's rigid structure, Inertia.js's NodeJS dependency).
For more details, see the package docs fa-solid fa-up-right-from-square.
gogolangsvelte
Author
Featured Stories
No featured articles here. Navigate to an article, then pick the Feature on menu button