Skip to content

Migrating from Astro

These tables map Astro to Hamur: its files, its .astro syntax, its client:* directives, the Astro global, its astro:* modules, actions, content collections, middleware, endpoints, integrations and adapters. The tables on pages, data and the server in Migrating from Nuxt apply to any app. hamur migrate astro reads your app and writes hamur-migration.md, the same tables filtered to what the app uses; with --write it turns each endpoint of src/pages/ into a handler. It never rewrites an .astro file, so the tables are also the checklist for those.

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 Hamur has no equivalent today; the row says what to do instead.

The two models

Astro renders pages to HTML and ships no JavaScript unless a component asks for it with a client:* directive. Hamur renders a page on the server and hydrates the whole page in the browser, the way a Nuxt or Next app does. An Astro app is therefore moved in one of two ways:

  • Keep the islands. A page with meta.hydrate: "islands" ships no app entry; only the components you render through Island hydrate. This is the nearest to Astro, and it needs experimental.islands: true. See Island pages.
  • Hydrate the page. A page that is mostly interactive is an ordinary page, and its navigations stay in the browser.

Astro takes components of several UI libraries in one app. A Hamur app has one library. It is react, preact, vue, solid, svelte or html, set by framework in hamur.config.ts and installed as @hamur/adapter-<library>. An html app may host islands of other libraries; see html islands and second-library islands.

Step by step

  1. Run hamur migrate astro in the app. It changes nothing and writes hamur-migration.md: each Astro name the app uses, its Hamur equivalent, the file and line, and whether --write can rewrite it.
  2. Run hamur migrate astro --write. It turns each exported method of an endpoint in src/pages/ (GET, POST, …) into a raw handler of server/routes/, exported from server/index.ts. The original file stays. An endpoint is rewritten only when it reads params, url and request of its context and uses no name of astro; any other endpoint is left with its reason in the report. Pages, layouts, components, content collections, middleware and actions are reported and never moved.
  3. Install Hamur: bun remove astro, then bun add hamur @hamur/adapter-react. Pick the adapter of the library most of your components use.
  4. Write hamur.config.ts from astro.config.* (config keys).
  5. Move src/pages to app/pages, src/layouts to app/layouts and src/components to app/components, then turn each .astro file into a component of your library (Files and folders).
  6. Move what the frontmatter of a page fetches into a handler and a load (Data and the Astro global).
  7. Turn each client:* component into an Island (Islands).
  8. Move actions and middleware to server/ (Actions, Middleware), and the endpoints the report left (Endpoints).
  9. Run hamur dev, open each page, then hamur build.

Files and folders

AstroHamurStatusDifferences
astro.config.*hamur.config.tsdifferentwith defineConfig of hamur and framework; the keys are below
astro in package.jsonhamur and @hamur/adapter-<library>differentbun remove astro, then bun add hamur @hamur/adapter-react; see Adapters
src/pages/*.astro and src/pages/**/*.astroapp/pages/**sameone file per route, written as a component of your library; --write leaves it. See Files and routes
src/pages/*.ts, src/pages/**/*.ts, src/pages/*.js and src/pages/**/*.jsdefineHandler({ route, method, raw: true })differentan endpoint; --write writes the handler into server/routes/; see Endpoints
src/pages/blog/[slug].astroapp/pages/blog/[slug].tsxsamethe same [param] syntax, with the extension of your library. See Files and routes
src/pages/[...path].astroapp/pages/[...path].tsxsamea catch-all param is a string[]; [[...path]] also matches the empty path. See Files and routes
src/pages/404.astroapp/pages/[...slug].tsx or app/pages/_not-found.tsxdifferentsee Route conventions and A URL no page matches
src/pages/500.astroapp/error.<ext>differentthe app error page, rendered without a layout; see The error page
src/layouts/**app/layouts/<name>.<ext>differenta layout renders children; a page picks one with meta.layout; see Layouts
src/components/**app/components/**sameimport a component by its path. See Co-located components
src/content/**, src/content.config.ts and src/content.config.jscontent/** and content.config.tsdifferentwith @hamur/content; see Content collections
src/middleware.ts and src/middleware.jsdefineServer({ middleware }) in server/index.tsdifferentsee Middleware
src/actions/index.tshandlers exported from server/index.tsdifferentsee Actions
src/env.d.ts.hamur/ types, written by hamur typegendifferentsee TypeScript
public/public/samesee Directory structure
.astro/.hamur/samegenerated. See Directory structure
dist/.output/differentthe build output; see Build output
<script> in an .astro fileapp/plugins/*.client.ts, or a componentnoneHamur bundles the entry of the app, not a script per page; a script that must run once per page load is a client plugin; see Plugins and hooks

.astro components

Hamur has no .astro syntax. The frontmatter and the template of an .astro file become the data function and the component of your library.

AstroHamurStatusDifferences
the frontmatter fence --- of a pagea load in x.load.ts beside the page, and handlers in server/differentserver code lives in server/, never in app/; see Data
the template of an .astro filethe component of your librarynoneJSX, a Vue or Svelte template, or a string for html; rewrite it by hand. See Adapters
<slot />children (Vue: the default slot, Svelte: the children snippet)differentsee Adapters
<slot name="x" />a prop that takes an element, or a slot of the librarydifferent@x folders are parallel route slots, not component slots; see Slots
<Fragment set:html={html} />the library's raw HTML prop, such as dangerouslySetInnerHTMLdifferentsanitize the string yourself. See Adapters
class:listthe library's own class syntaxnonewrite the string or use a class helper such as clsx. See Styling
<style> scoped to a componentCSS files, CSS modules or the library's scoped styledifferentsee Styling
<style is:global>a global CSS file imported from app/app.<ext> or a layoutdifferentsee Styling
define:varsa CSS variable set through stylenonesee Styling
<head> elements in a layoutuseHead, or the head of hamur.config.tsdifferentthere is no <head> element in a component; see Head
Astro.slotsnonenonepass the content as a prop. See Adapters
<ViewTransitions />, <ClientRouter />app.viewTransition, Link viewTransitiondifferentHamur navigates in the browser and can run each navigation in a view transition; see View transitions
transition:persistpersist on an Island, or a layout that stays mounteddifferentsee State, children and persisted islands
transition:name, transition:animatedata-hamur-view-transition and the CSS of the browserdifferentsee View transitions

Islands

Every row of the client:* directives is an on value of Island. Island takes a component from app/islands/, and its page sets meta.hydrate: "islands". See Islands and Directives.

AstroHamurStatusDifferences
client:loadon="load" of Island from @hamur/adapter-reactsame"load" is the default. See Directives
client:idleon="idle"samerequestIdleCallback, else a 200 ms timer; timeout option. See Lazy hydration
client:visibleon="visible"sameIntersectionObserver; rootMargin option. See Lazy hydration
client:mediaon={{ media: "(max-width: 50em)" }}samesee Lazy hydration
client:onlyon="only"differentrenders fallback on the server and mounts in the browser; the library is the app's adapter. See Directives
a component without a directivea component rendered by the pagedifferenton an island page it renders on the server only; on a full page it hydrates with the page. See Island pages
client:* propsprops of Islanddifferentprops are serialized; a function prop fails the render. See Islands
children of a client:* componentchildren of Islanddifferentrendered on the server only and never hydrated; on="only" takes none. See State, children and persisted islands
components of several libraries on one pageexperimental.islands: { libraries } in an html appdifferentsee html islands and second-library islands; in any other app, one library
server:deferServerIsland from @hamur/adapter-reactsamea component of app/server-islands/ that renders in its own request, with a fallback; see Server islands
a custom client: directive from an integrationaddIslandDirective of hamur/kitsamesee Directives
output: "static" with islandsan island page with routeRules: { "/blog/**": { prerender: true } }samesee Prerendered pages

An island page in code:

tsx
import { Island, useData, useRoute } from "@hamur/adapter-react"
import type { PageMeta } from "hamur/app"
import LikeButton from "../../islands/LikeButton"

export const meta = { hydrate: "islands" } satisfies PageMeta

export default function Post() {
  const { post } = useData<{ post: { slug: string; title: string } }>()
  const { path } = useRoute()
  return (
    <article>
      <h1>{post.title}</h1>
      <p>{path}</p>
      <Island component={LikeButton} props={{ postId: post.slug }} on="visible" />
    </article>
  )
}
tsx
import { useState } from "react"

export default function LikeButton({ postId }: { postId: string }) {
  const [liked, setLiked] = useState(false)
  return (
    <button type="button" aria-label={`Like ${postId}`} onClick={() => setLiked(!liked)}>
      {liked ? "Liked" : "Like"}
    </button>
  )
}

Data and the Astro global

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 posts = new Map([["hello", { slug: "hello", title: "Hello" }]])

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

export const listSlugs = defineHandler({
  method: "GET",
  handler: () => [...posts.keys()],
})

export const getPost = defineHandler({
  method: "GET",
  input: slugInput,
  handler({ slug }) {
    const post = posts.get(slug)
    if (!post) throw createError({ status: 404, message: "Post not found" })
    return post
  },
})
ts
import { redirect } from "hamur/app"
import type { Entries, Load } from "hamur/app"
import { getPost, listSlugs } from "../../../server/index.ts"

export const entries = (async () => (await listSlugs()).map((slug) => ({ slug }))) satisfies Entries

export const load = (async ({ params }) => {
  if (params.slug === "old") return redirect("/blog/hello", 301)
  return { post: await getPost({ slug: params.slug as string }) }
}) satisfies Load
AstroHamurStatusDifferences
Astro.props of a pagemeta.props: true, or useRoute().paramsdifferenta page has no props by default; meta.props: true passes the route's params as props, see Page meta
Astro.props of a componentthe component's own propssamesee Adapters
Astro.paramsuseRoute().params in a component, params of the load contextsamea catch-all is a string[]. See Files and routes
getStaticPaths()entries in the page's x.load.tsdifferentit returns one object of params per path; dynamicParams = false makes them the only paths; see Pages to prerender
getStaticPaths with propsthe load, which reads the data againdifferentthe prerender shares the answers of one run, so a GET handler called with one input runs once. See Shared data
paginate()entries with a page paramnonewrite the pages as entries: [...Array(n).keys()].map((page) => ({ page: String(page + 1) })). See Pages to prerender
Astro.urluseRoute(), url of the load contextdifferentuseRoute() has path, fullPath, query and hash; in a server file getRequestURL(event) of hamur/server. See The router
Astro.url.searchParamsuseRoute().querydifferentan object; see Search params
Astro.requestevent.requestsamea Web Request; event is ctx.event of a handler and of a load on the server. See Handlers
Astro.cookies.get(name)useCookie(name) in a component, getCookie(event, name) on the serverdifferentsee State
Astro.cookies.set(name, value, options)setCookie(event, name, value, options), or useCookiedifferentsetCookie of hamur/server. See State
Astro.cookies.delete(name)deleteCookie(event, name)differentsee State
Astro.localsevent.contextdifferenta middleware writes event.context.user, a handler and a load read it; type the keys with HamurEventContext, see Middleware
Astro.redirect(location, status)redirect("/x", 301) from hamur/appsamereturn or throw it from a load, route middleware, a request step or a handler. See redirect
Astro.rewrite(path)rewrite("/x") from hamur/appsamethe address stays; a loop of six rewrites answers 508; see rewrite
Astro.response.status, statusTextsetResponseStatus(event, status), or createError({ status })differentsee Errors
Astro.response.headerssetHeaders of the load context, event.response.headers in a handlerdifferenta load sets headers on the document only; in a route a headers rule does it by pattern, see Route rules
Astro.clientAddressgetRequestIP(event) of hamur/serverdifferentbehind a proxy, set trustedHops; see getRequestIP
Astro.sitesite.urldifferentwith @hamur/seo; see Site config
Astro.generatornonenonethe page has no generator tag; add one with useHead if you want it. See Head
Astro.currentLocale, Astro.preferredLocaleuseI18n() of @hamur/i18n, event.context.locale on the serverdifferentsee Internationalization
Astro.getActionResult()useAction(fn)differentsee Actions
Astro.selfnone; a component imports itselfnonesee Adapters
Astro.callAction()the handler, called as a function on the serverdifferentsee Calling a handler
export const prerender = truemeta.rules: { prerender: true }, or a prerender route ruledifferentthere is no prerender export; see Prerendering a page without params
export const prerender = falsethe defaultdifferenta page renders on each request unless a rule prerenders it; ssr: false makes it a single-page route. See Rendering modes

Assets and environment

AstroHamurStatusDifferences
Image from astro:assetsImg from @hamur/image/reactdifferentwith @hamur/image in modules; alt is required, width and height default to the file's size; see Showing an image
Picture from astro:assetsPicture from @hamur/image/reactsamesee Picture
getImage()getImage(src, modifiers) from @hamur/image/serversamefor a handler, an OpenGraph tag or a component; see Image URLs in a handler
image.domains, image.remotePatternsimage.domainsdifferentsee Remote images and limits
image.serviceimage.providerdifferentsee Providers
experimental.fonts@hamur/fontsdifferentthe families go under fonts; see Fonts
import.meta.env.PUBLIC_XuseRuntimeConfig().public.x, or #hamur/env/publicdifferentsee Environment
import.meta.env.SECRET#hamur/env/privatedifferentserver only; the build fails if client code imports it. See Private and public values
astro:env/server#hamur/env/private, typed by defineEnv of hamurdifferentsee app/env.ts
astro:env/client#hamur/env/publicdifferentread once, when the page loads. See Private and public values
envField.string({ context: "server", access: "secret" }){ schema } in defineEnv, with no publicdifferentany Standard Schema, or a function that throws on a bad value. See app/env.ts
envField.number({ context: "client", access: "public" }){ public: true, schema }differentsee app/env.ts
envField with optional: true or defaultdefault in the entrysamedefault replaces an unset value, not an empty one. See app/env.ts
getSecret()#hamur/env/privatedifferentthe value is read once, at server start, so an invalid one stops the start. See When the value is read

The environment file is app/env.ts:

ts
import { defineEnv } from "hamur"

const port = (raw: string | undefined): number => {
  const value = Number(raw)
  if (!Number.isInteger(value)) throw new Error("must be a number")
  return value
}

export default defineEnv({
  API_KEY: {},
  PORT: { schema: port, default: "3000", description: "Port of the HTTP server" },
  GA_ID: { public: true, description: "Analytics id" },
  SHOW_DEBUG: { public: true, static: true, schema: (raw) => raw === "true", default: "false" },
})

Actions

An Astro action is a typed function that a form or a script calls. In Hamur it is a handler: a function you write with defineHandler, export from server/index.ts and import in a page from #server. A form posts to it, and it works without JavaScript.

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

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

export const like = defineHandler({
  input: likeInput,
  handler({ postId }, { event }) {
    event.log.info("liked", { postId })
    return { postId, likes: 1 }
  },
})
AstroHamurStatusDifferences
defineAction({ handler })defineHandler({ handler }) from hamur/serverdifferenta module-level export const of server/, written as an object literal; see Defining a handler
input: z.object({})input: schemadifferentany Standard Schema; a failed check answers 400 with data.issues and data.values; see Validation
accept: "form"<Form action={fn}>differentthe form is decoded before the handler; see The Form component
accept: "json"the defaultsamea handler is called with a typed input. See Calling a handler
actions.like(input) in a scriptlike(input), imported from #serverdifferentin the browser the call is a request, on the server a function call. See Calling a handler
actions.like in a <form action><Form action={like}>differentworks without JavaScript: the form posts to the page with ?_fn=<id>. See Without JavaScript
Astro.getActionResult(actions.like)useAction(like)differentstate, failure, error, pending and result of useAction from @hamur/adapter-react. See Pending state and optimistic UI
isInputError(error)failure of useAction(fn)differenta 400 with issues is the failure; see Reading the result
ActionError({ code })throw createError({ status }) from hamur/server, or fail(status, data)differentfail takes 400 to 499 and returns the data to the form; see fail
isActionError(error)isActionFailure(value)differentsee isActionFailure
return redirect() after a formreturn redirect("/x") from hamur/appsamea form post is answered with 303. See Without JavaScript
getActionContext(context)ctx.event of the handlerdifferentsee Defining a handler
actions.blog.like (nested)one export per handlerdifferentthe name is the name of the export. See Id and name
.orThrow()await like(input)samea failed call throws on the client; see Errors and redirects on the client
an action as a public endpoint at /_actions/likea handler with a route, or the one at /_hamur/fn/<id>differentauthorize inside every handler; see Every handler is a public endpoint
security.checkOriginserver.originCheckdifferentserver.originCheck.allow lists extra origins, false turns the check off; see Sessions and security

Content collections

AstroHamurStatusDifferences
src/content.config.ts, defineCollectioncontent.config.ts, defineCollection and defineContentConfig from @hamur/contentdifferentat the app root, with collections in the default export and type: "page" or "data"; see Set it up
loader: glob({ pattern, base })source of the collection, or globsamesource is the glob loader; see Sources and paths
loader: file("data.json")file(path) of @hamur/content, or a sourcesamean array gives one entry per item; see Loaders
a custom loadera loader: { name, load }differentit calls store.set; it runs at build and in hamur dev, never at run time; see Loaders
schema: z.object({})schemasameany Standard Schema; image() is the schema of an image field; see Schemas
reference(name)a field that holds the id, read with a second queryCollectionnonethere is no reference type. See Queries
getCollection(name)queryCollection(name).all() from @hamur/content/querydifferenta query builder; where, order, limit, select, count; see Queries
getCollection(name, filter)queryCollection(name).where(field, op, value)differentsee Queries
getEntry(name, id)queryCollection(name).path(path).first()differentsee Queries
getEntries(refs)queryCollection(name).where("id", "IN", ids).all()differentsee Queries
entry.datathe entry's fieldsdifferentthe fields sit beside id, path and body; collection, id and body are reserved names in frontmatter. See Sources and paths
render(entry)ContentRenderer from @hamur/content/reactdifferentwith value and components; renderEntry(entry) of @hamur/content/render gives { html, headings, ast }; see Render an entry
a catch-all page that calls getEntryuseContentPage(collection)differentsets the head from the entry and throws a 404 when none matches; see A page for each entry
live content collectionslive collectionsdifferentsee Live collections
MDXnonenoneMarkdown components cover the same job; see Why there is no MDX and Markdown components
@astrojs/markdown-remark optionsmarkdowndifferentremark and rehype plugins go under markdown; see Plugins
Shiki code highlightingmarkdown highlightingdifferentsee Highlighting

Middleware

src/middleware.ts becomes the middleware list of defineServer. The list runs before every request, in the order written. There is no sequence: the list is the sequence.

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

export const session = defineMiddleware(({ event }) => {
  event.context.user = getCookie(event, "user") ?? null
})

export const admin = defineMiddleware(({ event }) => {
  if (!event.context.user) throw redirect("/login")
})
ts
import { defineServer } from "hamur/server"
import { admin, session } from "./middleware.ts"

export { getPost, listSlugs } from "./blog.ts"
export { like } from "./like.ts"
export { rss } from "./rss.ts"

export default defineServer({
  middleware: [session, { route: "/admin/**", handler: admin }],
})
AstroHamurStatusDifferences
defineMiddleware((context, next) => …)defineMiddleware(({ event, next }) => …) from hamur/serverdifferentsee Middleware
export const onRequestthe middleware list of defineServerdifferentin server/index.ts. See Middleware
sequence(a, b)middleware: [a, b]sameoutermost first. See Middleware
context.locals.user = …event.context.user = …differentthe handler and the load read it. See Middleware
await next()await next()samethe code after it sees the answer; a returned Response replaces it. See Middleware
return new Response()return a valuesamereturning a value ends the request with it. See Middleware
return context.redirect("/login")throw redirect("/login") from hamur/appdifferenta thrown redirect() redirects. See Middleware
return next("/other"), context.rewrite("/other")return rewrite("/other") from hamur/appsamethe address stays. See rewrite
a check on context.url.pathname{ route: "/admin/**", handler }differentthere is no matcher; a list entry with a route runs only under it. See Middleware
a middleware that guards an actionhandlerMiddleware, or middleware of the handlerdifferenta request step guards the document; the handler's list guards every call; see Handlers: middleware
middleware of a prerendered pagenonenonea prerendered page is a file; a guard on it belongs to the host, or the page is not prerendered. See Rendering modes
context.isPrerenderedimport.meta.prerenderdifferenttrue while hamur generate renders. See import.meta.env and import.meta.prerender

Endpoints

An endpoint file src/pages/rss.xml.ts becomes a handler with a route and raw: true. It gets the request as event.request and returns a Response. hamur migrate astro --write does this for an endpoint that reads only params, url and request: each exported method becomes a handler named <method><Words> (getApiItemsId) in server/routes/, with [id] written as :id and [...path] as **:path. A file or folder that starts with _, a segment such as post-[id], and an ALL export are left for you.

ts
import { defineHandler } from "hamur/server"

export const rss = defineHandler({
  route: "/rss.xml",
  method: "GET",
  raw: true,
  handler: () => new Response('<rss version="2.0"></rss>', { headers: { "content-type": "application/xml" } }),
})
AstroHamurStatusDifferences
src/pages/api/x.ts with export const GETa handler with route: "/api/x" and method: "GET"differentexported from server/index.ts; see A handler with a route
export const POST: APIRoutea handler with method: "POST"differentone handler for each method. See A handler with a route
export const ALLone handler for each methodnonesee A handler with a route
({ request, params, locals }) => Response(input, { event }) => Response with raw: truedifferentevent.request, the route params in getRouterParam(event, name), event.context; see raw
new Response(JSON.stringify(x))return the objectdifferenta handler returns a value, which is sent as JSON; raw: true returns a Response as written. See What a raw handler returns
a static endpoint, built at astro builda GET handler with prerenderdifferentsee Prerender
getStaticPaths of an endpointprerender: { inputs } of the handlerdifferentsee Prerender
export const prerender = false in an endpointthe defaultdifferentsee Prerender
rss() of @astrojs/rssa raw handler, or @hamur/seo feedsdifferentsee Feeds
sitemap() of @astrojs/sitemap@hamur/seodifferentsee Sitemap

Modules

AstroHamurStatusDifferences
defineConfig of astro/configdefineConfig from hamurdifferentthe config is hamur.config.ts; see Config keys
astro:contentqueryCollection of @hamur/content/query, defineCollection of @hamur/contentdifferentsee Content collections
astro:actionsdefineHandler from hamur/serverdifferentsee Actions
astro:middlewaredefineMiddleware from hamur/serverdifferentsee Middleware
astro:transitions, astro:transitions/clientapp.viewTransitiondifferentsee View transitions
astro:i18nuseI18n() of @hamur/i18ndifferentsee Internationalization

Integrations and adapters

AstroHamurStatusDifferences
integrations: [react()]framework: "react" and @hamur/adapter-reactdifferentone library for the app; see Adapters
astro add <name>hamur module add <name>differentsee hamur module
an integration's hooks (astro:config:setup, astro:build:done)defineModule of hamur/kitdifferenta module has setup and build hooks; see Modules
updateConfig, injectRoute, addMiddleware of an integrationthe kit's extendPages, addServerMiddleware and othersdifferentsee The kit
@astrojs/mdxnonenonesee Why there is no MDX
@astrojs/sitemap@hamur/seodifferentsee SEO
@astrojs/db@hamur/dbdifferentSQL migrations; see Database
@astrojs/tailwind and other CSS tools@hamur/cssdifferentsee Styling
@astrojs/node, adapter: node()preset: "node"samesee Presets
@astrojs/cloudflarepreset: "cloudflare"samecloudflare-static and cloudflare-pages also exist; see Presets
@astrojs/vercelpreset: "vercel"samesee Presets
@astrojs/netlifypreset: "netlify"samesee Presets
output: "static"preset: "static"sameevery route is prerendered; see Rendering modes
output: "server"a server presetsamesee Presets
output: "hybrid" (Astro 4) or prerender per pagerouteRules with prerenderdifferentsee Route rules and prerender
i18n routingi18n with @hamur/i18n in modulesdifferentmessages use ICU MessageFormat; see Internationalization
astro devhamur devsamesee Dev server
astro buildhamur buildsamesee CLI
astro previewhamur previewsamesee CLI
astro checkhamur typecheckdifferentsee CLI
the dev toolbar@hamur/devtoolsdifferentsee Devtools

Config keys

ts
import { defineConfig } from "hamur"
import image from "@hamur/image"
import content from "@hamur/content"
import seo from "@hamur/seo"

export default defineConfig({
  framework: "react",
  preset: "node",
  experimental: { islands: true },
  modules: [image, content, seo],
  app: { baseURL: "/docs/", trailingSlash: "redirect" },
  routeRules: {
    "/old/:slug": { redirect: { to: "/blog/:slug", status: 301 } },
    "/blog/**": { prerender: true },
  },
})
AstroHamurStatusDifferences
sitesite.url, with @hamur/seodifferentsee Site config
baseapp.baseURLsameit ends with /. See Configuration
trailingSlashapp.trailingSlashdifferent"ignore", "redirect", "always" or "strict"; see Files and routes
redirectsrouteRules[source] = { redirect }different{ redirect: { to, status } }; a long list is a redirects file
output, adapterpresetdifferentsee Presets
integrationsmodulesdifferentsee Modules
server.port, server.hostdevServer, hamur dev --port, --hostdifferentsee CLI
outDiroutputDirsamesee Build output
publicDirpublicDirsamesee Configuration
srcDirsrcDirsamesee Configuration
vitebuild, or @hamur/vite-compatdifferentbuild is Bun.build options; see Vite plugins
markdownmarkdowndifferentsee The markdown key
imageimagedifferentsee Images
env.schemaapp/env.tsdifferentsee Environment
i18ni18ndifferentsee Set it up
devToolbar@hamur/devtools in modulesdifferentsee Devtools
prefetchapp.link, Link prefetchdifferentsee Prefetch
experimentalexperimentaldifferentsee Experimental