Quick Comparison
| Concept | Other Frameworks | Fuego |
|---|---|---|
| Route file | route.ts / +server.ts | route.go |
| Page file | page.tsx / +page.svelte | page.templ |
| Layout | layout.tsx / +layout.svelte | layout.templ |
| Middleware | middleware.ts | middleware.go |
| Dynamic segment | [id] | [id] |
| Catch-all | [...slug] | [...slug] |
| Optional catch-all | [[...slug]] | [[...slug]] |
| Route groups | (group) | (group) |
Key Differences
Handlers Are Named After HTTP Methods
In JavaScript frameworks, you export named functions likeGET, POST, etc. In Fuego, you define functions with capitalized method names:
Templates Use templ, Not JSX
Instead of JSX/TSX, Fuego uses templ for type-safe HTML:- Compile-time type checking
- No runtime template parsing
- Go code completion in templates
- Smaller binary size than text/template
No Build Step for Go Code
Unlike JavaScript frameworks that require bundling, Fuego compiles to a single binary:node_modules, npm, or a separate build step for your Go code.
HTMX Instead of Client-Side Frameworks
For interactivity, Fuego encourages HTMX over React/Vue/Svelte:- No JavaScript to write
- Server renders HTML
- Smaller page weight
- Works with any backend
Migration Patterns
From Next.js App Router
| Next.js | Fuego |
|---|---|
app/api/users/route.ts | app/api/users/route.go |
export async function GET() | func Get(c *fuego.Context) error |
NextRequest | *fuego.Context |
NextResponse.json() | c.JSON(status, data) |
NextResponse.redirect() | c.Redirect(status, url) |
cookies().get() | c.Cookie("name") |
headers().get() | c.Header("name") |
From Nuxt
| Nuxt | Fuego |
|---|---|
server/api/users.ts | app/api/users/route.go |
defineEventHandler() | func Get(c *fuego.Context) error |
getQuery(event) | c.Query("key") |
readBody(event) | c.Bind(&body) |
setResponseStatus() | c.JSON(status, data) |
From SvelteKit
| SvelteKit | Fuego |
|---|---|
+server.ts | route.go |
+page.svelte | page.templ |
+layout.svelte | layout.templ |
RequestHandler | func Get(c *fuego.Context) error |
json() helper | c.JSON(status, data) |
File Structure Comparison
JavaScript Framework (Next.js style)
Fuego
The structure is nearly identical - just swap the file extensions.Code Comparison
- Next.js
- Fuego
Why Go?
If you’re comfortable with JavaScript frameworks, why use Fuego?| Benefit | Description |
|---|---|
| Performance | Go is significantly faster than Node.js for CPU-bound tasks |
| Memory | Lower memory footprint, important for containers |
| Type safety | Compile-time checks catch errors early |
| Deployment | Single binary, no runtime dependencies |
| Concurrency | Goroutines handle concurrent requests efficiently |
| Simplicity | No package manager drama, stable stdlib |