Radical
Reference

Server entry point and native context

Request parsing and bundled CORS exports from @akshatowo/radical/server.

getNativeContext(request)

Reader behaviorContract
ResultEffect<NativeContext> without typed failure
Precedencex-radical-context header whenever present; otherwise radical-context cookie
Invalid URI or schemaBrowser context
TrustNo authentication or origin check
FieldNative valueBrowser value
platform"android" or "ios""browser"
safeArea{ top, right, bottom, left }Zero insets
shellVersionNonempty stringnull

Insets are finite, nonnegative CSS pixel values. Native context is untrusted presentation data.

withBundledRequests(handler, outputs?)

Returns a Promise-based fetch handler. Allows credentialed CORS for https://localhost and capacitor://localhost only. Other callers retain the handler's normal behavior without a CORS grant.

CORS contractValue
handlerRequest to Response | Promise<Response>
outputsPick<AdapterOutputs, "exposedHeaders">; defaults to {}
Allowed preflight204; bypasses handler
Allowed methodsGET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS
Allowed request headersRequested headers
Preflight VaryOrigin, Access-Control-Request-Headers
Handler response VaryAppends Origin for every caller
Response header exposureAppends supplied outputs.exposedHeaders for allowed origins; preserves existing headers
Empty or omitted exposed headersAdds none

The TanStack Start wrapper from @akshatowo/radical/tanstack-start-server supplies the adapter outputs. It exposes x-tss-serialized, x-tss-raw, and x-tss-error to bundled clients.

The wrapper does not authenticate callers or replace the framework's CSRF configuration.

Other server exports

safeAreaStyle(context?, mode?) returns the document CSS variables. Missing context uses browser defaults. SafeArea is an exported type. NativeContext is available from @akshatowo/radical/native-context.

@akshatowo/radical/native-context exports the context schemas, cookie and header constants, encodeNativeContextCookie, safeAreaStyle, zeroSafeArea, and context types. encodeNativeContextCookie returns an Effect encoding a shell context as URI-encoded JSON.

Source: bundled CORS implementation, server entry, context module.

On this page