# Decisions

> Status: implemented are markup as HTML, components of the server, their results, `Response`
> going up, `Content<T>`, component values with a result, decorators with guards, wrappers that
> take the body and the request context, routes, and `rooklang/server`; the server of the site, `site/server/main.rk`, is written
> with them, and the guide has a section on them. The decisions are collected at the end of the
> document, together with what is not decided yet. Server markup, components and `rooklang/server`
> remain **experimental** in 1.x and may change between releases.

> This document builds on [components.md](https://github.com/QWERN-9876r/RookLang/blob/HEAD/docs/components.md): components, decorators, context,
> components as values. It describes only what is different on the server.

1. **The mode is a setting of the package,** `"rook": { "markup": "html" }`, not a keyword or a
   name of a file: a file is either for the browser or for the server, and the setting already
   finds its package.
2. **A component of the server returns any value,** inferred or written after the properties: an
   API and pages are the same tree.
3. **A `Response` among children goes up** and becomes the answer, so a guard can stand at any
   depth without passing anything up by hand.
4. **Children are lazy, `Content<T>`,** and a wrapper is generic: a middleware does not run what it
   does not let through, and its type is that of what it wraps.
5. **Context is a decorator of a component above, available through its public members:** typed, one
   instance per request, and no new concept besides what decorators are.
6. **A guard is an early `return` in the body of a decorator.**
7. **The entry is `serve(App)` and `handler(App)` of `rooklang/server`,** on the web standard
   `Request` and `Response`, so one server runs in Node, Bun, Deno and Workers.
8. **An error boundary is a wrapper that takes `Content<T>`,** not a decorator of the language:
   the wrapper gets the body to run, and `@fallback` is a few lines of Rook.
9. **Routes are `route("/users/:id", UserPage)`,** a function whose literal path the compiler
   checks against the properties of the page; the router stays Rook code.

