Build Web Apps with Pure Go (No JavaScript Required!)



This content originally appeared on DEV Community and was authored by Hasan Gursoy

I’m excited to share gofred, a framework I’ve been working on that lets you build responsive web applications using only Go – no JavaScript required! Your Go code compiles directly to WebAssembly and runs natively in the browser.

🌟 What makes gofred special?

Pure Go Development: Write your entire web app in Go – frontend, backend, everything. No need to learn JavaScript, TypeScript, or React.

WebAssembly Performance: Near-native performance in the browser with Go’s excellent concurrency model.

Modern UI Components: Rich widget library with responsive design built-in:

  • Layout widgets (Container, Column, Row, Grid)
  • Interactive components (Buttons, Links, Forms)
  • Content widgets (Text, Icons, Images)
  • Navigation (Drawers, Headers, Footers)

Responsive by Default: Built-in breakpoint system (XS, SM, MD, LG, XL, XXL) for mobile-first design.

Developer Experience: Hot reload, comprehensive documentation, and great tooling.

🚀 Live Demo

Check out the live website: https://gofred.io

The entire website is built with gofred itself – it’s a perfect example of what you can create!

📖 Quick Example

Here’s how simple it is to create a responsive web app:

package main

import (
    "github.com/gofred-io/gofred/application"
    "github.com/gofred-io/gofred/breakpoint"
    "github.com/gofred-io/gofred/foundation/button"
    "github.com/gofred-io/gofred/foundation/column"
    "github.com/gofred-io/gofred/foundation/container"
    "github.com/gofred-io/gofred/foundation/text"
    "github.com/gofred-io/gofred/options"
    "github.com/gofred-io/gofred/options/spacing"
    "github.com/gofred-io/gofred/widget"
)

func main() {
    application.Run(
        container.New(
            column.New(
                []widget.BaseWidget{
                    text.New(
                        "Hello, gofred!",
                        text.FontSize(32),
                        text.FontWeight("600"),
                    ),
                    button.New(
                        text.New("Click me!"),
                        button.OnClick(func(this widget.BaseWidget, e widget.Event) {
                            // Handle click event
                        }),
                    ),
                },
                column.Gap(16),
                column.CrossAxisAlignment(options.AxisAlignmentTypeCenter),
            ),
            container.Padding(breakpoint.All(spacing.All(32))),
        ),
    )
}

🏗 Architecture

gofred uses a widget-based architecture where everything is a composable component:

  • Foundation widgets: Basic building blocks
  • Layout system: Flexbox-inspired responsive layouts
  • State management: Reactive state with automatic UI updates
  • Event handling: Click, hover, form events, etc.
  • Styling: CSS-in-Go with responsive breakpoints

📚 Documentation & Resources

🎯 Perfect for:

  • Go developers who want to build web apps
  • Teams looking to reduce JavaScript complexity
  • Projects that need high performance
  • Developers who prefer strongly-typed languages
  • Anyone who wants to leverage Go’s ecosystem for web development

🚀 Getting Started

# Create a new project
mkdir my-gofred-app
cd my-gofred-app

# Initialize with go mod
go mod init my-gofred-app
go get github.com/gofred-io/gofred

# Start building!

🤔 Why did I build this?

As a Go developer, I was frustrated with the complexity of modern web development. You need to learn JavaScript, TypeScript, React, Vue, or Angular just to build a simple web app. I wanted something that would let me use Go’s simplicity and power for web development.

gofred is my answer to that problem – it brings Go’s elegance to web development while maintaining the performance and developer experience we love.

🔮 What’s next?

  • More UI components and widgets
  • Better tooling and IDE support
  • A powerful CLI tool that will help developers quickly scaffold new gofred projects with pre-configured templates, project structure, and development tools
  • Performance optimizations
  • Community examples and templates
  • Integration with popular Go libraries

💬 Questions?

I’d love to hear your thoughts! Have you tried building web apps with Go before? What features would you like to see in gofred? Any feedback or suggestions?

Links:

Thanks for checking it out! 🚀


This content originally appeared on DEV Community and was authored by Hasan Gursoy