Skip to content

feat: add Fastify runtime driver and template - #23

Merged
3m1n3nc3 merged 10 commits into
mainfrom
feat/fastify-driver
Nov 5, 2026
Merged

3m1n3nc3 merged 10 commits into
mainfrom
feat/fastify-driver

Conversation

@3m1n3nc3

@3m1n3nc3 3m1n3nc3 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds Fastify as a third runtime next to Express and H3. This was the top item on the roadmap.

Commits

  1. refactor: shared ServerDriver. The Express and H3 drivers each had their own copy of the bind address setup, the ngrok tunnel, the startup lines and the server:start hook. That code now lives in a ServerDriver base in @arkstack/common, and each driver only implements its listen call. The ngrok dependency moves to common. The driver tests now stub ServerDriver.forward instead of mocking @ngrok/ngrok.
  2. feat: @arkstack/driver-fastify.
    • The driver, Router, error handler, and the auth, resora, formdata, requestLogger and limiter middlewares.
    • Middleware positions map to Fastify hooks: global runs on onRequest, before on preHandler, and after on onResponse.
    • A callback middleware's done runs inside the middleware's own async context, so localeMiddleware() still sets the locale for the handler.
    • Fastify plugins come in through a plugins option. Formbody and multipart are on by default, and static files are served with @fastify/static.
    • The error handler is set in createApp(). Fastify fixes a route's error handler when the route is built, and route setup is async, so setting it later missed some routes.
  3. feat: templates/fastify.
    • The same app as the Express template.
    • CORS is set up in src/config/plugins.ts.
    • boot() sets the app up only once, because parasito calls startup() for every request.
    • CI and publish run pnpm prepare for this template, and the release script bumps its version.
  4. feat(create-arkstack). Adds the Fastify option. The Inertia prompt is skipped for Fastify, and an explicit --stack is rejected, because there's no Fastify Inertia adapter yet.
  5. docs. A new runtime guide at docs/guide/fastify-runtime.md, plus updates to the README (Fastify listed as Beta), the roadmap, getting started, AGENTS.md and SKILL.md.

Before this is ready to merge

This PR depends on two upstream fixes:

Once both are released, the @resora/plugin-clear-router, resora and clear-router catalog versions need bumping here.

Tests

  • I ran the local suite against a local Postgres. With both upstream fixes patched into node_modules, all 674 tests pass. Without them, everything passes except the one resora test above.
  • pnpm lint and pnpm build:templates pass.
  • I built and started the Fastify template. These all worked: /api, /api/users against the database, a DELETE through a _method POST, the welcome view, static files, a 404 as an Arkstack JSON error, CORS preflight, and ark route:list.

@3m1n3nc3 3m1n3nc3 self-assigned this Nov 5, 2026
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

@3m1n3nc3
3m1n3nc3 marked this pull request as ready for review November 5, 2026 12:28
@3m1n3nc3
3m1n3nc3 merged commit 8aaaf89 into main Nov 5, 2026
4 checks passed
@3m1n3nc3
3m1n3nc3 deleted the feat/fastify-driver branch November 5, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant