Askr
Getting Started

Project Structure and Conventions

Use project structure and conventions with the current published Askr packages.

  • @askrjs/askr0.0.59

How to use project structure and conventions

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

Composition root

Askr apps have one obvious place where the app is assembled: the call to `createIsland`, `createSPA`, or `hydrateSPA` from `@askrjs/askr/boot`, which wires a route registry or manifest to a DOM root. Keep that call in one file rather than scattering startup configuration across the app.

Pages and routes

If the project uses `src/pages/**/_routes.tsx` (the CLI's default shape), keep new routes there rather than inventing a parallel route tree. A page file should own URL-reachable shell and composition; domain logic, queries, and mutations belong in a feature folder (e.g. `src/features/<feature>/`), not inline in the page.

Server boundary

Code that talks to request data, auth context, or a database belongs behind the server-facing entrypoints — `@askrjs/askr/ssr`'s `renderRouteRequest` and friends, or route `loader`s — not inside components that also render in the browser. Keep transport and DTO mapping in an adapters layer (`src/adapters/`) so a page component never imports a generated API client directly.

Tests and generated artifacts

Keep tests next to the surface they cover rather than in a separate mirrored tree, matching whatever convention the starter template already uses. Treat `.askr/blueprint.json`, `.askr/builder-brief.md`, and any SSG `outputDir` as generated output — safe to regenerate, and worth committing only when you want a record of what the CLI decided.