uf0.0.0-alpha

Build an app

Build an app

For a reader building an application with uf: one guide per thing an application does. Unlike Start, this is not a sequence to read front to back. Read the first two pages, then the one for what you are doing today.

What you need first

A project that runs — Your first project makes one. The tutorial builds one application out of most of the pages below, and is the quickest way to see how they fit before reading any of them in detail.

The pages, in order

  1. Flow, the modern partscomponent, hook, renders, match and enums — and what uf does with them.
  2. RoutingFiles become routes; layouts nest; loaders run before the page.
  3. Rendering modesWhere a document comes from, and what the browser does once it has one.
  4. Server ComponentsThe boundary a directive draws, the graph that resolves it, and a split at the route, not the module.
  5. Async ReactSuspense, transitions and optimistic UI: what waits, what stays visible, and what is only temporary.
  6. Server actionsA function the browser calls by id: what may cross, what is refused, and why it authorizes itself.
  7. StateAtoms, a store, and where this parts company with Jotai.
  8. FormsUncontrolled inputs, narrow subscriptions, and no Proxy.
  9. EffectsFailures in the type, and what Flow costs against Effect-TS.
  10. Headless componentsHeadless primitives: keyboard maps, ARIA contracts, composition types, and no styles at all.
  11. Styling and contentCSS, StyleX, tokens, dark mode, Markdown and MDX.
  12. Images, fonts, icons and cardsResized, self-hosted, subsetted and drawn at build time — and what that stops short of.
  13. CachingA route cache and a fetch cache, opt-in, in memory by default, durable when you say so.
  14. Signing inA contract rather than a provider: PKCE, a single-use state, and a session store you can replace.
  15. LoggingA structured logger, and a request id readable from inside a render.
  16. Web vitalsFive numbers the browser already has, and nothing that leaves the machine unless you ask.

Flow, the modern parts comes first because every example on every other page is written in it, and Routing second because a route is what the rest attaches to: a loader, a layout, a Suspense boundary, a form that posts to an action. Rendering modes decides what each route becomes when you build, which changes what the pages after it can do. From there the order is roughly the order an application needs things in: the split between server and browser, the libraries that hold state, take input and model failure, the interface and what styles it, and last what a deployed application needs around it — caching, signing in, logs and measurements.

Which page answers which question

You want toRead
write components and hooks with component and hookFlow, the modern parts
add a page, a layout, a loader, middleware or a route handlerRouting
choose between prerendering, rendering per request and a client-side applicationRendering modes
decide what runs on the server and what ships to the browserServer Components
show something while data loads or a change is in flightAsync React
call the server from the browserServer actions
share state between componentsState
take input and validate itForms
put failure in a typeEffects
build a tab list, a dialog or a menu that works with a keyboard and a screen readerHeadless components
style it, or write pages in Markdown and MDXStyling and content
resize images, self-host fonts, draw a share cardImages, fonts, icons and cards
cache a route or a fetchCaching
sign somebody in with OAuthSigning in
log what a request didLogging
measure LCP, CLS and INPWeb vitals
test any of itTesting, in The toolchain
look up a component's parts, or which package exports somethingComponents and Packages

When you are done

Targets is where an application goes once it builds: a server or a static host, a single executable file, a phone, a terminal. Testing is in The toolchain, with the other commands you run against what you built.

Next: Flow, the modern parts