Introduction
Welcome to the documentation for rfw v2. Use the search box in the top navigation to quickly find what you need.
What is rfw?
rfw (Reactive Framework for the Web) is a framework for building user interfaces with Go and WebAssembly. It extends standard HTML with a declarative, component-based model that lets you write your UI entirely in Go. State in Go is bound directly to the DOM: when values change, rfw updates the page automatically—without a virtual DOM.
Here is the simplest example:
//go:build js && wasm
package main
import (
"embed"
"github.com/rfwlab/rfw/v2/composition"
t "github.com/rfwlab/rfw/v2/types"
)
//go:embed templates
var templates embed.FS
func init() {
composition.RegisterFS(&templates)
}
type Counter struct {
composition.Component
Count t.Int
}
func (c *Counter) Increment() { c.Count.Set(c.Count.Get() + 1) }
func NewCounter() *t.View {
view, _ := composition.New(&Counter{Count: *t.NewInt(0)})
return view
}
<root>
<button @on:click:Increment>Count: @signal:Count</button>
<p>@expr:Count.Get * 2 doubled</p>
</root>
Result: clicking the button increases the counter. The @expr: directive computes derived values inline.
This example shows the core features of rfw v2:
- Type-based composition, field types (
t.Int,*t.Store,*t.Ref, etc.) auto-wire reactivity
- Convention over configuration, templates found by struct name (
Counter→Counter.rtml) orTemplate()method
- Auto-discovered lifecycle,
OnMount()/OnUnmount()methods detected automatically
- Declarative RTML,
@signal:,@on:click:,@expr:bind state and events
Key Concepts
- Signals, reactive values (
t.Int,t.String, etc.) that update the DOM when changed
- Stores, shared state across components, scoped by module and name
- Composition,
composition.New(&struct{})auto-wires everything from field types
- Routing,
router.Page()androuter.Group()for client-side navigation
- SSC, Server-Side Computed: the host renders HTML, Wasm hydrates it
Next Steps
- Quick Start, build your first component in minutes
- Creating an Application, project structure and bootstrap
- Components Basics, components, types, and lifecycle
- Template Syntax, RTML directives and expressions
- API Reference, full API docs
Getting Started
Essentials
- Creating an Application
- Components Basics
- Composition
- Template Syntax
- Reactivity Fundamentals
- Signals, Effects & Watchers
- Event Handling
- Lifecycle Hooks
- Conditional Rendering
- List Rendering
- Computed Properties
- Template Refs
- Class and Style Bindings
Guides
- Router
- SSC (Server-Side Computed)
- State Management
- Store vs Signals
- Provide & Inject
- Features
- Manifest
- CLI