🚀 [Feature]: Unified binary support out of the box
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 314
- Forks
- 61
- Avg merge
- 4h 35m
- Merged PRs (30d)
- 12
Description
Feature Description
I often create small Fiber apps, and I've been thinking about ways to make them easier to deploy and move around.
One of the main challenges I face is that certain files, like:
- HTML templates,
- CSS files,
- JavaScript files
- other static assets like favicons
are not included in the statically compiled binary. If all these files could be bundled within the binary, it would significantly simplify deployment. A few considerations arise once these assets are included in the binary:
Can CSS files still be served compressed after inclusion?
If so, it would be ideal to compress all static files at startup and store them in cache.
I’ve reviewed the following discussions:
From these, I believe the templ package could be a good solution for embedding HTML templates into the binary. I also read this comment https://github.com/gofiber/template/issues/302#issuecomment-1951425609 but thought it was a bad example. It only demonstrated rendering static text without passing variables, using templates/partials, or including other static files (CSS, JS, icons). It also didn’t address whether those static assets can still be served compressed or cached.
While I'm not specifically set on templ, despite its increasing popularity, what I'd really like is a simple way to bundle HTML templates, CSS, JS, and other static files into the final statically compiled binary for Fiber apps.
I think this is something many developers would find useful. Ideally, it would be as simple as importing a Fiber sub-package or enabling the feature like this:
app := fiber.New(fiber.Config{
IncludeAssets: true,
IncludeTemplates: true,
})
This way, all assets and templates would be included in the binary. I understand implementing this isn’t straightforward, but a possible approach could involve:
- using the
embedpackage, or - using
spf13/afero.
However, I'm not familiar with those libraries.
From what I've gathered from other discussions, it seems that some of these features might already be achievable. However, they wouldn’t work seamlessly with Fiber and would require a considerable amount of workaround to implement effectively.
I would love to have a discussion about and see if that is something the maintainers of fiber are considering beeing useful, or not.
This is not primarily about using templ. The main focus is on finding a easy straightforward way to include all assets - typically residing outside the statically compiled binary - into the binary itself.
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have checked for existing issues that describe my suggestion prior to opening this one.
- I understand that improperly formatted feature requests may be closed without explanation.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name a file, test, or entry point. Start by reviewing the template middleware's current asset and template-loading behavior, then clarify the supported embedding API and whether compression and caching are required. Done means maintainers agree on a scoped design for bundling templates and static assets into Fiber applications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, go, html, javascript
- Domain
- backend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100