Catch errors from the route's render function using a predicate.
Catch errors with a specific _tag from the route's render function.
Add a GET loader and render function to the route.
The loader receives { params, searchParams } and returns data of type A.
The render function receives A directly — fully typed, no cast needed.
The loader's E/R requirements do NOT flow into the Route's E/R — they flow to the Platform's HttpRouter instead.
const UsersRoute = Route.make("/users").pipe(
Route.get(
({}) => Effect.succeed(usersMock),
(users) => UsersPage({ users }),
),
);
const UserRoute = Route.make("/users/:id").pipe(
Route.params(Schema.Struct({ id: Schema.NumberFromString })),
Route.get(
({ params: { id } }) => Effect.gen(function* () {
const db = yield* DatabaseService;
return yield* db.getUser(id);
}),
(user) => UserPage({ user }),
),
);
Check if a value is a Route.
Create a lazy-loaded route.
Create a route definition.
Use combinators to add params, loaders, handlers, and the render function:
const HomeRoute = Route.make("/").pipe(
Route.render(() => HomePage()),
);
const UserRoute = Route.make("/users/:id").pipe(
Route.params(Schema.Struct({ id: Schema.NumberFromString })),
Route.get(
({ params: { id } }) => Effect.gen(function* () {
const db = yield* DatabaseService;
return yield* db.getUser(id);
}),
(user) => UserPage({ user }),
),
);
Add a schema for route params. The schema transforms raw string params to typed values.
Add a POST mutation handler to the route.
The handler receives the parsed request body and returns a result. Platform executes it directly on POST — no component rendering needed.
The handler's E/R requirements do NOT flow into the Route's E/R.
Add a PUT mutation handler to the route.
Same semantics as Route.post() but for PUT requests.
Keep raw string params without schema validation. Useful when you want to handle params manually.
Set the render function for a route without a loader.
Shorthand for routes that don't need data loading.
For routes with loaders, use Route.get(loader, render) instead.
Add a schema for search params (query string).
Add animation options to the route.
Add a guard to the route. The route will only render if the guard condition is true.
Catch all errors from the route's render function. This removes errors from the error channel entirely.