Askr
Getting Started

Choosing an Application Mode

Use choosing an application mode with the current published Askr packages.

  • @askrjs/askr0.0.59

How to use choosing an application mode

Create a readable starter, run it unchanged, and make one small production build after the first route works.

  1. Choose startkit for the recommended product baseline; choose spa, ssr, ssg, or full-stack only when that delivery boundary is already known.
  2. Run the generated application and read its route registry, scripts, and route-tree test before editing them.
  3. Add one page, update the expected route set, then build and preview the real output.
npx @askrjs/cli@0.0.5 create startkit my-app
cd my-app
npm run dev
npm run build

SPA

`createSPA` from `@askrjs/askr/boot` mounts the app client-side against a route registry or manifest — no server rendering step, so the first paint happens after JavaScript loads. Use this for internal tools, dashboards, or anything where SEO and first-paint latency aren't primary concerns; it's also the simplest mode to reason about since there's no hydration mismatch to worry about.

SSR

Server-side rendering uses `@askrjs/askr/ssr` — `renderRouteRequest` or `resolveRequest` resolve a URL against your route registry and render to HTML on every request, then `hydrateSPA` takes over in the browser. This is the right choice when pages need fresh data on each load or when you need real SEO with dynamic content; it costs a running Node server and more moving parts than SPA or SSG.

SSG

`createStaticGen()` from `@askrjs/askr/ssg` renders your route table to HTML files ahead of time, writing to an `outputDir` with a `metadata.json` describing the run. It supports incremental regeneration keyed by `invalidationKeys` or changed route paths, so a CI rebuild only re-renders what actually changed. Routes with `auth` requirements or runtime `policies` are treated as runtime-only and skipped during prerendering — they need SSR instead.

Full stack and startkit

The `full-stack` template pairs SSR-capable pages with backend API routes in the same project, useful when your frontend and API are developed and deployed together. `startkit` is the broader opinionated starter — more conventions and structure pre-wired — and is generally the safest default if you're not certain yet which rendering mode you'll end up needing; you can still layer SSR or SSG entrypoints on afterward.