Menu
Libraries |
Category

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:
    1. Compiles Svelte files to client/server JS (NodeJS only needed during development).
    2. Embeds generated code via Go's embed package.
    3. Uses middleware to render components via functions like golte.RenderPage and golte.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

Comments