Chapter II · The framework

Ajo Kit

Routes are files. Data is server truth.

A full-stack framework for Ajo: file routes and nested layouts, server loaders and form actions, SQLite migrations through Kysely, and live route updates over server-sent events. Vite runs development; the build stages a closed module graph for the engine.

A small wooden pier linking three cabins over calm water.A small wooden pier linking three cabins over calm water.

What Ajo Kit gives you

In practice

src/notes/[id]/handler.ts

Status Published on npm. Pre-1.0: its API is still being refined.

  • ajo-kit 0.5.0

    File routes, loaders, actions, SQLite migrations and live updates.

  • ajo-kit-auth 0.7.1

    Sessions, CSRF, guards, scoped tokens, passkeys and invitations.

  • ajo-kit-mail 0.4.1

    One validation boundary for mail, with SMTP, HTTP and capture transports.

src/notes/[id]/handler.ts
import { Missing, type Request } from 'ajo-kit'
import { db } from '/src/data'

export async function page(req: Request) {
  req.track?.(`note:${req.params.id}`)
  const note = await db().selectFrom('notes')
    .select(['id', 'text']).where('id', '=', Number(req.params.id))
    .executeTakeFirst()
  if (!note) throw new Missing()
  return { note }
}

export async function head(req: Request) {
  return { title: `Note ${req.params.id}` }
}