gofiber/template is a Developer Tools project on GitHub, written primarily in Go. It has 313 stars. 🧬 Template engine middleware for Fiber
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
This package provides universal methods to use multiple template engines with the Fiber web framework using the new Views interface that is available from > v1.11.1. Special thanks to @bdtomlin & @arsmn for helping!
9 template engines are supported:
ace
amber
django
handlebars
html
jet
mustache
pug
slim
Installation
Go version support: We only support the latest two versions of Go. Visit https://go.dev/doc/devel/release for more information.
go get -u github.com/gofiber/fiber/v3
go get -u github.com/gofiber/template/any_template_engine/vX
Example
package main
import (
"log"
"github.com/gofiber/fiber/v3"
// To use a specific template engine, import as shown below:
// "github.com/gofiber/template/pug/v3"
// "github.com/gofiber/template/mustache/v3"
// etc..
// In this example we use the html template engine
"github.com/gofiber/template/html/v3"
)
func main() {
// Create a new engine by passing the template folder
// and template extension using <engine>.New(dir, ext string)
engine := html.New("./views", ".html")
// We also support the http.FileSystem interface
// See examples below to load templates from embedded files
engine := html.NewFileSystem(http.Dir("./views"), ".html")
// Reload the templates on each render, good for development
engine.Reload(true) // Optional. Default: false
// Debug will print each template that is parsed, good for debugging
engine.Debug(true) // Optional. Default: false
// Layout defines the variable name that is used to yield templates within layouts
engine.Layout("embed") // Optional. Default: "embed"
// Delims sets the action delimiters to the specified strings
engine.Delims("{{", "}}") // Optional. Default: engine delimiters
// AddFunc adds a function to the template's global function map.
engine.AddFunc("greet", func(name string) string {
return "Hello, " + name + "!"
})
// After you created your engine, you can pass it to Fiber's Views Engine
app := fiber.New(fiber.Config{
Views: engine,
})
// To render a template, you can call the ctx.Render function
// Render(tmpl string, values interface{}, layout ...string)
app.Get("/", func(c fiber.Ctx) error {
return c.Render("index", fiber.Map{
"Title": "Hello, World!",
})
})
// Render with layout example
app.Get("/layout", func(c fiber.Ctx) error {
return c.Render("index", fiber.Map{
"Title": "Hello, World!",
}, "layouts/main")
})
log.Fatal(app.Listen(":3000"))
}
More Examples
To view more specific examples, you could visit each engine folder to learn more
ace
amber
django
handlebars
html
jet
mustache
pug
slim
embedded Systems
We support the http.FileSystem interface, so you can use different libraries to load the templates from embedded binaries.
package main
import (
"log"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/template/html/v3"
// your generated package
"github.com/<user>/<repo>/static"
)
func main() {
engine := html.NewFileSystem(static.HTTP, ".html")
app := fiber.New(fiber.Config{
Views: engine,
})
// Read the documentation on how to use fileb0x
}
Benchmarks
See the benchmarks under https://gofiber.github.io/template/benchmarks
Simple
Extended
Benchmarks were ran on Apple Macbook M1. Each engine was benchmarked 20 times and the results averaged into a single xlsx file. Mustache was excluded from the extended benchmark
☕ Supporters
Fiber is an open-source project that runs on donations to pay the bills, e.g., our domain name, hosting, and serverless infrastructure. If you want to support Fiber, please become a GitHub Sponsor.
Tool Sponsors - supporting Fiber with free IDE licenses and AI credits
The most recent commit recorded on gofiber/template was 5 days ago, based on the GitHub push timestamp. The repository has 61 forks — one of the better signals of community interest.
How many stars does gofiber/template have?
gofiber/template has 313 GitHub stars — refresh the page for the live number, or check github.com/gofiber/template. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is gofiber/template written in?
gofiber/template is written primarily in Go. GitHub's language field is based on the largest share of bytes in the default branch.
What license does gofiber/template use?
gofiber/template is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
What topics is gofiber/template associated with?
GitHub's repository topics for gofiber/template: "fiber", "middleware", "template", "template-engine". TopGit's editorial category is Developer Tools.
Where can I see gofiber/template in action?
The project maintains a homepage at https://docs.gofiber.io/guide/templates. The README tab on this page also usually contains screenshots and a quickstart.
Where do I read more about gofiber/template?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/gofiber/template is the definitive source.
Read full README in the tab above.
Curious whether template is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about template.