Routing & User Flows
Vango scans app/routes and turns files into routes. The right mental model is “render-time selection” rather than “imperative route entry”.
File-Based Routing
Typical mappings:
app/routes/index.go -> /
app/routes/projects/index.go -> /projects
app/routes/projects/id_/index.go -> /projects/:id
app/routes/docs/path___/index.go -> /docs/*path
app/routes/layout.go -> root layout
app/routes/api/*.go -> API endpoints
Use Go-friendly directory names like id_ and path___ instead of bracket syntax.
Page Handlers Stay Thin
Supported shapes:
1func Page(ctx vango.Ctx) *vango.VNode
2func Page(ctx vango.Ctx, p Params) *vango.VNode
Page handlers should:
parse params
choose the component
return the view
They should not:
do blocking I/O
allocate setup.* primitives
perform imperative navigation
Use typed params instead of accepting raw strings and partially validating them in the page:
1type Params struct {
2 ID int `param:"id"`
3}
4
5func Page(ctx vango.Ctx, p Params) *vango.VNode {
6 return ProjectPage(ProjectPageProps{ProjectID: p.ID})
7}
Layouts
Layouts are pure wrappers:
1func Layout(ctx vango.Ctx, children vango.Slot) *vango.VNode
Good layout responsibilities include:
shell structure
navigation
shared assets
persistent banners
runtime script injection
Progressive Forms
For forms that submit back to the current page route, Vango’s preferred path is:
setup.RouteForm(&s, Input{})
a matching page Action
1func Action(ctx vango.ActionCtx, in SignupInput) (*vango.FormResult, error) {
2 if !isAllowedEmail(in.Email) {
3 return vango.Invalid(vango.FormErrors{
4 "email": {"Use a real work email"},
5 }), nil
6 }
7 return vango.RedirectTo("/welcome"), nil
8}
Navigation
Use Link(...) for ordinary page changes.
Use ctx.Navigate(...) for session-driven navigation after an event or effect.
Use ctx.Redirect(...) for server redirects.
Page actions read path and query state with ctx.Param(...) and ctx.QueryParam(...) .
Page actions use ctx.StdContext() for DB and service calls.
Unexpected page-action failures return nil, err ; business validation returns vango.Invalid(...) .
Read Further
Programming Model
Testing & Tooling