Request and returns a Response, which is what createTheAuthHandler from @glinr/theauth/http produces. There is no Waku package.
API routes live in src/pages/_api. The _api directory is not part of the URL, so src/pages/_api/theauth/[...path].ts answers at /theauth/*.
Install
Create the instance once
src/lib/theauth.ts
Mount the handler
src/pages/_api/theauth/[...path].ts
getConfig is needed.
Keep native packages out of the bundle
Waku builds with Vite and Rolldown and bundles server dependencies. Two things then break:better-sqlite3 fails with __dirname is not defined on the first request, and @glinr/theauth carries an optional nodemailer import that Rolldown refuses to leave unresolved. Mark both external:
waku.config.ts
external the same way. With Postgres you would externalize pg instead of better-sqlite3.
Protect your own routes
src/pages/_api/docs.ts
What was run
A scratch Waku project (waku@1.0.0-rc.3, React 19.3, Node 22) with @glinr/theauth installed from a packed tarball. After waku build and waku start: GET /theauth/agents without a session answered 401, an unknown path under the mount answered 404, and GET /docs without a token answered 401. Both failures described above were reproduced before the config was added. The session cookie flow for pages (server components reading the session) was not run.