Skip to content

Migrating from Vike

These tables map Vike to Hamur: its files, every setting and hook of its settings and hooks pages, the pageContext fields and the functions it exports. The tables on pages, data and the server in Migrating from Nuxt apply to any app. none means Hamur has no equivalent today. Hamur has no hamur migrate vike, so the tables are the checklist.

The Status column says how close the Hamur way is: same means the name and the behavior carry over, different means the job has an equivalent that you write another way, and none means there is no equivalent; the row says what to do instead.

The two models

Vike is a router and a renderer that you assemble: you pick a UI extension (vike-react, vike-vue, vike-solid), a server (vike-server with Hono, Express or Fastify, or your own) and the hooks that render the page. Hamur is the whole stack, so most settings that wire the pieces together are not needed:

  • Hamur renders the document. There is no onRenderHtml to write and no onRenderClient. The adapter of your UI library renders and hydrates. To change the document, use a document template (meta.document), a render handler or a server hook.
  • Routing is by file, and in code when you need it. app/pages/ holds one file per route. A route function, a route string or a route table of your own is meta.path, meta.validate, [param=matcher] or app/routes.ts.
  • The server is part of the app. server/index.ts holds handlers, middleware and plugins. A Hono, Express or Connect app mounts into it.
  • One config file. Vike spreads settings over +config.js files in folders. Hamur has hamur.config.ts, and _meta.ts in a folder of app/pages/ for what only that folder shares.

You pick the UI library once: framework in hamur.config.ts, installed as @hamur/adapter-<library>. vike-react becomes @hamur/adapter-react, vike-vue @hamur/adapter-vue and vike-solid @hamur/adapter-solid; see Adapters.

Step by step

  1. Install Hamur: bun remove vike vike-react, then bun add hamur @hamur/adapter-react.
  2. Write hamur.config.ts from the root +config.js and vite.config.ts (Settings).
  3. Move each +Page to app/pages/<route>.tsx (Files and folders).
  4. Turn each +data into a handler and a load (Data and guards).
  5. Turn each +guard into route middleware or a request step, and each +onBeforeRoute into app/reroute.ts.
  6. Move +Head, +title and the other head settings into head and useHead (Head and document).
  7. Move the server to server/index.ts (The server).
  8. Run hamur dev, open each page, then hamur build.

Files and folders

A Vike page is a folder that holds + files. A Hamur page is one file, and what the + files held goes in a file beside it or in hamur.config.ts.

VikeHamurStatusDifferences
pages/about/+Page.tsxapp/pages/about.tsxdifferentone file per route, default-exporting the component; see Files and routes
pages/index/+Page.tsxapp/pages/index.tsxdifferentsee Files and routes
pages/product/@id/+Page.tsxapp/pages/product/[id].tsxdifferent@id is [id]; a route string /product/@id is the file name. See Files and routes
a route string with * (/docs/*)app/pages/docs/[...path].tsxdifferenta catch-all param is a string[]; [[...path]] also matches the empty path. See Files and routes
pages/_error/+Page.tsxapp/error.<ext>differentthe app error page, rendered without a layout; see The error page
pages/(group)/app/pages/(group)/samea group folder adds nothing to the path; see Pathless group layouts
pages/+config.jshamur.config.tsdifferentsee Settings
pages/admin/+config.jsapp/pages/admin/_meta.tsdifferentrun-time meta keys for every route in the folder and below; see Folder config
renderer/+config.js (a renderer you wrote)framework and @hamur/adapter-<library>nonethe adapter is the renderer. See Adapters
vike and vike-react in package.jsonhamur and @hamur/adapter-reactdifferentsee Adapters
vite.config.tshamur.config.tsdifferentbuild is Bun.build options; a Vite plugin runs through @hamur/vite-compat; see Vite plugins
public/public/samesee Directory structure
dist/.output/differentsee Build output
+Page of a component librarya componentsameimport it by its path. See Co-located components

A Vike page, converted: the page and its data are two files.

tsx
import { useData, useRoute } from "@hamur/adapter-react"

export default function Product() {
  const { product } = useData<{ product: { id: string; name: string } }>()
  const { params, query } = useRoute()
  return (
    <h1>
      {product.name} ({params.id}, {String(query.ref ?? "")})
    </h1>
  )
}

Settings

Each setting of the Vike settings page, in the order it groups them. A setting that Vike sets in a +config.js is a key of hamur.config.ts, a meta key of a page or a folder, or an export of a file beside the page.

VikeHamurStatusDifferences
+Pagethe page file's default exportdifferentsee Files and folders
+routethe file name, meta.path, meta.validate, app/routes.tsdifferentsee Routing
+dataload in x.load.ts, calling a handlerdifferentsee Data and guards
+guardroute middleware, a request step, and a check in the handlerdifferentsee Data and guards
+Layoutapp/layouts/<name>.<ext>, a parent page or a group layoutdifferentsee Layouts
+Wrapperapp/app.<ext>, the root componentdifferentwraps every layout and renders Outlet; see Root component
+Loading_pending.<ext> of the folderdifferentsee Pending components
+HeaduseHead in a component, head in x.load.ts, meta.headdifferentsee Head and document
+title, +description, +image, +favicon, +lang, +viewporttitle, seo, link, htmlAttrs and meta of a head inputdifferentsee Head and document
+htmlAttributes, +bodyAttributeshtmlAttrs, bodyAttrs of a head inputdifferentclass, lang and dir on <html>; see Head
+headHtmlBegin, +headHtmlEnd, +bodyHtmlBegin, +bodyHtmlEndtagPosition: "head", "bodyOpen" or "bodyClose" on a tagdifferentsee Position and priority
+injectScriptsAttagPosition of a scriptdifferentthe entry script is written by Hamur; see Position and priority
+ssrmeta.ssr, or an ssr route rulesamefalse makes a single-page route; "data-only" also exists; see Single-page app pages
+streamthe stream route ruledifferenton by default except in Vue; see The stream rule
+prerenderthe prerender route rule, entries, the static presetdifferentsee Prerendering
+clientRoutingon by defaultdifferent+clientRouting: false is an island page or a script-free page; see Island pages
+hydrationCanBeAbortednonenonean island hydrates on its own; see Lazy hydration
+prefetchStaticAssetsprefetch and prefetchOn of Link, app.speculationRulesdifferentsee Prefetch and Speculation Rules
+keepScrollPositionscroll of Link and navigatedifferentsee Scroll
+passToClientwhat a load returns, useStatedifferentthe payload carries them; see What goes into the payload
+redirectsrouteRules with redirect, or a redirects filedifferentsee Redirects
+trailingSlash, +disableUrlNormalizationapp.trailingSlash, app.caseSensitivedifferentsee Redirects
+baseServerapp.baseURLsameit ends with /. See Configuration
+baseAssetsapp.cdnURLdifferentan absolute URL that serves the client files. See Configuration
+headersResponsea headers route rule, setHeaders in a loaddifferentsee Route rules
+clientapp/plugins/<name>.client.tsdifferentsee App plugins
+serverserver/index.tsdifferentsee The server
+extendsframework, extends (layers) and modulesdifferentsee Layers and Modules
+namename of defineModuledifferenta module has a name; an app has none. See defineModule
+meta (a setting of your own)defineModule options, or meta keys declared with HamurPageMetadifferentsee Page meta
+cumulativenonenonea meta key of a folder replaces the parent's, except middleware, which runs outermost first. See Page meta
+vitebuild, @hamur/vite-compatdifferentsee Vite plugins
+host, +port, +httpsdevServer.port, devServer.https, --hostdifferentsee Dev server
+filesystemRoutingRootprefix of hamur/kit in app/routes.ts, or dir.pagesdifferentsee A route table in code
+onBeforeRouteapp/reroute.tsdifferentsee Hooks
+onBeforePrerenderStartentries, prerender.routesdifferentsee Prerendering
+onCreatePageContext, +onCreateGlobalContextan app plugin, a server plugin, a loaddifferentsee Hooks
+onRenderHtml, +onRenderClientdefineRenderHandler, server hooksdifferentsee Hooks
+onPageTransitionStart, +onPageTransitionEndthe app hooks page:start and page:finishdifferentsee Hooks
+onHookCallnonenonedevServer.timing writes a performance.measure for each loader, middleware and hook under hamur dev; see Configuration

Routing

Vike routes by the file system, a route string or a route function, and one page can use any of them. Hamur routes by the file system and lets you change the result in code.

VikeHamurStatusDifferences
filesystem routingapp/pages/**samesee Files and routes
+route as a string, /product/@idapp/pages/product/[id].tsx, or meta.path: "/product/:id"differentmeta.path replaces the path the file gives and is a literal string the build reads; see Build keys must be literals
+route as a string with an optional part[[id]]differentusers/[[id]].tsx is /users/:id?. See Files and routes
+route as a function, returning { routeParams }[id=integer] with app/params/integer.ts, or meta.validate(route)differenta matcher takes the value or goes on to the next route; validate answers 404; see Param matchers and Params that are checked
+route as a function that reads urlPathnameapp/routes.tsdifferentone function over the scanned records; see A route table in code
a route with several URLsmeta.aliasdifferenta literal string or an array, with the page's params. See Page meta
precedence of a routethe order Hamur givesnonethe best match wins, segment by segment: static, mixed, required param, optional param, catch-all. See Files and routes
+onBeforeRoute returning { pageContext: { urlLogical } }input(url) of app/reroute.tsdifferenta URL maps to an app path on the server and in the browser; useRoute().mask is the address bar's path; see Rewrites
+onBeforeRoute that sets a locale@hamur/i18ndifferentsee Internationalization
nested layouts by foldera parent page that renders Outletdifferentsee Nested routes
a modal routean intercepting routedifferentsee Intercepting routes
parallel routesslotsdifferentsee Slots
+route that uses pageContext.datanonenonea route is decided before any load runs; check the data in the load or in meta.validate. See Params that are checked
ts
import { group, index, prefix, route, type RouteRecord } from "hamur/kit"

export default (scanned: RouteRecord[]): RouteRecord[] => [
  ...scanned,
  index("screens/home.tsx"),
  route("legal", "screens/legal.tsx", [route("terms", "screens/terms.tsx")]),
  group("screens/(shell).tsx", [route("settings", "screens/settings.tsx")]),
  ...prefix("/v2", [route("about", "screens/about.tsx")]),
]

Layouts

VikeHamurStatusDifferences
+Layout in pages/+Layout.tsxapp/layouts/default.<ext>differenta layout renders children; default wraps every page. See Layouts
+Layout in a foldera parent page, or a (group).tsx beside a (group)/ folderdifferenta folder's layout is its parent page, which renders Outlet; a group adds nothing to the path; see Pathless group layouts
several +Layout files that nestnested parent pagesdifferentthe outermost renders first. See Nested routes
a layout that reads pageContext.dataa layout's load in app/layouts/<name>.load.tsdifferentread with useData() in the layout; see Layout loads
+Wrapperapp/app.<ext>differentthe root component around every layout. See Root component
a layout with persistent statea layout or parent page that stays mountedsamea navigation keeps the layout's state. See Layouts

Data and guards

A page reads its data in a load of x.load.ts beside it, which calls a handler. The handler runs only on the server and is a public endpoint, so it checks its input. See Data.

ts
import { createError, defineHandler } from "hamur/server"
import { schema } from "../../migrate-next/server/schema.ts"

const products = new Map([["1", { id: "1", name: "Lamp" }]])

const idInput = schema<{ id: string }>(
  { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
  (value) => {
    const id = (value as { id?: unknown } | undefined)?.id
    return typeof id === "string" && id
      ? { value: { id } }
      : { issues: [{ message: "An id is required", path: ["id"] }] }
  },
)

export const listProducts = defineHandler({
  method: "GET",
  handler: () => [...products.values()],
})

export const getProduct = defineHandler({
  method: "GET",
  input: idInput,
  handler({ id }) {
    const product = products.get(id)
    if (!product) throw createError({ status: 404, message: "Product not found" })
    return product
  },
})
ts
import type { Entries, Load } from "hamur/app"
import { getProduct, listProducts } from "../../../server/index.ts"

export const entries = (async () => (await listProducts()).map(({ id }) => ({ id }))) satisfies Entries
export const dynamicParams = false

export const load = (async ({ params }) => ({ product: await getProduct({ id: params.id as string }) })) satisfies Load
VikeHamurStatusDifferences
+dataload in x.load.tsdifferentit runs on the server for the first render and in the browser for each navigation; it holds no server code of its own, it calls handlers. See Data
+data that reads a databasea handler in server/, exported from server/index.tsdifferentserver/ code never reaches the browser; see Handlers
useData() from vike-react/useDatauseData() of @hamur/adapter-reactsametyped from the load; see Data in components
pageContext.datauseData()samesee Data in components
+data that throws render(404)notFound() from hamur/appdifferentit throws createError({ status: 404 }); the not-found component of the route shows it; see Route boundaries
+data that throws redirect("/x")redirect("/x") from hamur/appsamereturn or throw it. See redirect
+data that reads pageContext.routeParamsparams of the load contextsamesee Data
+data that reads urlParsed.searchquery and search of the load contextdifferentsee Search params
+data that reads pageContext.headersevent.request.headers of the handlerdifferentevent is undefined in the browser; useRequestHeaders() in a component. See Request
+data on a client navigationthe load runs in the browser and calls the handlerdifferentthe call is a request to /_hamur/fn/<id>; see Calling a handler
+guardroute middleware, defineServer({ middleware }) and a check in the handlerdifferentsee below. See Middleware
throw render(401) in +guardunauthorized() from hamur/appsameit throws a 401; forbidden() is the 403. See notFound, forbidden, unauthorized
throw redirect("/login") in +guardredirect("/login")samesee redirect
throw render("/login")rewrite("/login") from hamur/appsamethe address stays and the target renders. See rewrite
+guard that runs on the clientdefineRouteMiddleware from hamur/appdifferentit runs on the server for the document and in the browser for a navigation, and guards no data. See defineRouteMiddleware
pageContext.user set by a server middlewareevent.context.userdifferenta request step writes it, a handler and a load read it. See Middleware

A guard has three places, and a page that matters has two. A request step guards the document under a path. The handler's check guards the data on every call, from the page or from outside. A route middleware only makes a navigation in the browser quick; it never guards data. See A load does not guard anything and Protecting a page and its data.

ts
import { unauthorized } from "hamur/app"
import { defineMiddleware, getCookie } from "hamur/server"

export const admin = defineMiddleware(({ event }) => {
  if (!getCookie(event, "session")) unauthorized()
})
ts
import { defineRouteMiddleware, redirect } from "hamur/app"

export default defineRouteMiddleware((to, from, ctx) => {
  if (!ctx.state.get("user")) return redirect(`/login?next=${encodeURIComponent(to.fullPath)}`)
})
ts
import type { PageMeta } from "hamur/app"
import auth from "../../middleware/auth.ts"

export const meta = { middleware: [auth], layout: "admin" } satisfies PageMeta

Head and document

VikeHamurStatusDifferences
+HeaduseHead(input) from @hamur/adapter-reactdifferenta hook the component calls, not a component; see Head
+Head that reads pageContext.dataa head export of x.load.tsdifferentit receives the load context and the data; see Head from the route
+Head with <title>, <meta>, <link> elementstitle, meta, link of a head input, or HeadTitle, HeadMeta, HeadLinkdifferentsee Head components
+titletitle of a head input, titleTemplatesamea titleTemplate such as %s · Shop goes in app.head. See Title template
+descriptionseo.descriptiondifferentuseSeoMeta and the seo key write the Open Graph and Twitter tags too; see Search and social tags
+imageuseSeoMeta({ ogImage }), or an opengraph-image.png file in app/differenta generated image comes from @hamur/og-image; see Open Graph and Twitter images
+faviconapp/favicon.ico or app/icon.pngdifferenta file in app/ becomes the link on every document; see Icons
+langhtmlAttrs: { lang }, or @hamur/i18ndifferentsee Head
+viewporta meta tag with name: "viewport"differentsee Head
+htmlAttributes, +bodyAttributeshtmlAttrs, bodyAttrssamesee Attributes of <html> and <body>
a head tag only for some pagesmeta.head of a page, head of its loaddifferentsee Head from the route
a +Head of a layoutuseHead in the layoutsamea component's useHead wins over the route's for the same key. See Head
the HTML template of +onRenderHtmlapp/documents/<name>.html, meta.documentdifferenta template with <!--hamur-head--> and <!--hamur-body-->; see Page meta
ts
import type { Load, LoadHead } from "hamur/app"

interface Post {
  title: string
  summary: string
  slug: string
}

async function getPost(slug: string): Promise<Post> {
  return { title: "Hello", summary: "First post", slug }
}

export const load = (async ({ params }) => ({ post: await getPost(params.slug as string) })) satisfies Load

export const head = (({ data }) => ({
  title: data.post.title,
  seo: { description: data.post.summary, ogType: "article" },
  jsonLd: {
    "@type": "BlogPosting",
    "@id": `https://example.com/blog/${data.post.slug}#article`,
    headline: data.post.title,
  },
})) satisfies LoadHead<typeof load>

Hooks

Hamur has no hook that renders; the hooks that remain are for plugins and for the cases that wrap a render.

VikeHamurStatusDifferences
+onBeforeRouteinput(url) of app/reroute.ts, or a request step that returns rewrite(path)differentinput also runs in the browser before each navigation; see Rewrites and Middleware
+guardsee Data and guardsdifferent
+dataloaddifferentsee Data
+onBeforeRender (old)loaddifferentsee Data
+onRenderHtmldefineRenderHandler of hamur/server, and the server hooks render:html, render:stream and render:responsedifferentthe handler wraps the answer; render:html gets the parts of the document; see Change the error answer and the page answer
+onRenderHtml that streamsthe adapter streamsdifferentrender:stream may replace the stream; see Streaming per adapter
+onRenderClientnonenonethe adapter hydrates; the app hooks app:beforeMount and app:mounted run before and after. See App hooks
+onCreatePageContextan app plugin, or a loaddifferenta plugin runs once for each app (one for each request on the server); see App plugins
+onCreateGlobalContextan app plugin, a server plugindifferenta server plugin runs once at start; see Server plugins and hooks
+onPageTransitionStartthe app hook page:start, page:loading:startdifferentsee App hooks
+onPageTransitionEndthe app hook page:finish, page:loading:enddifferentsee App hooks
+onBeforePrerenderStartentries in x.load.ts, prerender.routesdifferentsee Prerendering
+onHookCallnonenonesee Settings
a page transition animationapp.pageTransition, app.viewTransitiondifferentsee Page and layout transitions

A render handler wraps every page answer, the error page included:

ts
import { defineRenderHandler, defineServer } from "hamur/server"
import { admin } from "./guard.ts"

export { getProduct, listProducts } from "./product.ts"

export default defineServer({
  middleware: [{ route: "/admin/**", handler: admin }],
  render: defineRenderHandler(async (_event, { render }) => {
    const response = await render()
    response.headers.set("x-rendered-by", "hamur")
    return response
  }),
})
ts
const slugs: Record<string, string> = { "/de/ueber-uns": "/about", "/fr/a-propos": "/about" }

export function input(url: URL): string | undefined {
  return slugs[url.pathname]
}

export function output(url: URL): string | undefined {
  const match = /^\/tenants\/[^/]+(\/.*)$/.exec(url.pathname)
  if (match) return match[1] + url.search
}

Prerendering

VikeHamurStatusDifferences
+prerender: truepreset: "static", or prerender: true route rulesdifferentstatic prerenders every route; on a server preset a rule names the paths; see Route rules and prerender
+prerender per pagemeta.rules: { prerender: true }differentsee Prerendering a page without params
+onBeforePrerenderStart returning URLsentries in x.load.tsdifferentone object of params per path; dynamicParams = false makes them the only paths; see Pages to prerender
+onBeforePrerenderStart returning URLs with pageContextentries, and a load that reads the datadifferentthe prerender shares the answers of one run. See Pages to prerender
+prerender: { partial: true }a server presetdifferentpages that are not prerendered render on each request; see Prerendered pages
+prerender: { parallel }prerender.workerssameBun workers that render from one queue; see Configuration
vike prerenderhamur generatesamewrites .output/public/; see hamur generate
a crawl of the linksthe prerender crawlsamesee Prerender
+prerender that adds URLs found while renderingpaths found while renderingsamesee Paths found while rendering

Redirects and URLs

VikeHamurStatusDifferences
+redirects: { "/old": "/new" }routeRules["/old"] = { redirect: "/new" }different307 unless you give a status; see Redirect status
a redirect with a param, /old/@id"/old/:id": { redirect: "/new/:id" }differentsee Targets
an external redirect{ redirect: "https://example.com" }samesee Targets
a long list of redirectsredirects: "redirects.json"differentsee The redirects file
+trailingSlashapp.trailingSlashdifferent"ignore", "redirect", "always" or "strict"; see Files and routes
+disableUrlNormalizationapp.trailingSlash: "ignore" and app.caseSensitivedifferentsee Files and routes
+baseServerapp.baseURLsamesee Configuration
+baseAssetsapp.cdnURLdifferentsee Configuration

pageContext

Hamur has no object that holds the request, the route and the data. Each value has its own place, and none of them is global state.

VikeHamurStatusDifferences
pageContext.urlOriginaluseRoute().fullPath, getRequestURL(event) on the serverdifferentfullPath is without app.baseURL. See The router
pageContext.urlPathnameuseRoute().pathsamesee The router
pageContext.urlLogicaluseRoute().pathsamewith app/reroute.ts the path is the target's and useRoute().mask the address bar's. See Rewrites
pageContext.urlParsed.searchuseRoute().querydifferentan object. See Search params
pageContext.urlParsed.hashuseRoute().hashsamesee The router
pageContext.routeParamsuseRoute().paramssamesee Files and routes
pageContext.pageIduseRoute().namedifferentthe name comes from the file. See Files and routes
pageContext.datauseData()samesee Data in components
pageContext.Pagenonenonethe adapter renders the page component. See Adapters
pageContext.configuseRuntimeConfig()differentsee Configuration
pageContext.exportsuseRoute().meta, useRoute().matcheddifferentmatched has one { name, path, meta } for each page, outermost first. See Page meta
pageContext.is404useRoute().status === 404, useError()differentthe error page and the not-found component read the error with useError(); see Errors
pageContext.abortReason, abortStatusCodeuseError(): message, data, statusdifferentsee Errors
pageContext.errorWhileRenderinguseError()differentsee Errors
pageContext.headers, headersOriginaluseRequestHeaders(), event.request.headersdifferentsee Request
pageContext.isHydrationuseRoute().navigationType === "initial"differentsee The router
pageContext.isBackwardNavigationuseRoute().navigationType === "pop"different"pop" is back and forward both. See The router
pageContext.isClientSideimport.meta.clientsametyped boolean | undefined, with import.meta.server. See Environment
pageContext.globalContextuseApp()differentstate, hooks, config, head and what plugins provide. See App plugins
pageContext.user and other keys added by a hookevent.context, useStatedifferentsee State
pageContext.userAgentgetRequestHeader(event, "user-agent")differentsee Request
usePageContext() from vike-reactuseRoute(), useData(), useApp()differentone hook for each value. See Data in components

Functions

VikeHamurStatusDifferences
render(404)notFound() from hamur/app, or createError({ status: 404 })differentsee notFound, forbidden, unauthorized
render(401, "message")unauthorized("message")sameforbidden is 403. See notFound, forbidden, unauthorized
render("/login")rewrite("/login") from hamur/appsamesee rewrite
redirect("/x")redirect("/x") from hamur/appsamestatus is the optional second argument, 302 by default; permanentRedirect is 308. See redirect
navigate("/x") from vike/client/routeruseRouter().navigate("/x"), navigateTo("/x")differentsee The router
navigate("/x", { overwriteLastHistoryEntry: true })useRouter().replace("/x")differentsee The router
navigate with keepScrollPositionnavigate(to, { scroll: false })differentsee Scroll
prefetch("/x")useRouter().prefetch("/x")samesee Prefetch
reload()reloadApp() of hamur/app, useRouter().refresh()differentrefresh() runs the loads again and keeps the component state. See reloadApp
<a href> with client routingLink from @hamur/adapter-reactdifferentsee Links
renderPage(pageContextInit)the request pipeline of defineServernoneHamur handles the request; see Order of a request
vike/server renderPage with Hono, Express or Fastifya mounted fetch app, or an Express or Connect handlerdifferentsee Mount a fetch app and Run an Express or Connect handler
vike prerender, vike build, vike dev, vike previewhamur generate, hamur build, hamur dev, hamur previewsamesee CLI

The server

VikeHamurStatusDifferences
vike-server with a Hono, Express or Fastify appserver/index.ts with defineServerdifferenthandlers, middleware and plugins are Hamur's; a fetch app or an Express handler mounts into it. See Server
a server route in your own servera handler with a routedifferentsee A handler with a route
a server middlewarethe middleware list of defineServerdifferentsee Middleware
pageContext.user from a cookieevent.context.user, useSessiondifferentsee Sessions and security
a Telefunc or tRPC calla handlerdifferenta typed function the page calls; see Handlers
an API route for a form<Form action={fn}>differentworks without JavaScript; see Forms and login
a deploy target (Vercel, Cloudflare, Node)presetdifferentsee Presets

Extensions

VikeHamurStatusDifferences
vike-react, vike-vue, vike-solid@hamur/adapter-react, @hamur/adapter-vue, @hamur/adapter-solidsame@hamur/adapter-preact, @hamur/adapter-svelte and @hamur/adapter-html also exist; see Adapters
a state library of vike-react (a Zustand or Redux extension)the library's own packagenoneinstall it as a dependency; the state of Hamur is useState, see State
+Page with <ClientOnly>ClientOnlysamesee Client-only parts
+Loading_pending.<ext>differentsee Pending components
an +config.js that extends anothera layer in extendsdifferentsee Layers

Config

ts
import { defineConfig } from "hamur"

export default defineConfig({
  framework: "react",
  preset: "node",
  app: { baseURL: "/shop/", trailingSlash: "redirect", head: { titleTemplate: "%s · Shop" } },
  routeRules: {
    "/old/:id": { redirect: { to: "/product/:id", status: 301 } },
    "/product/**": { prerender: true },
    "/account/**": { ssr: false },
  },
})