Skip to main content

0.13.0

Fastify 5

Starting with Sonamu 0.13, the framework runs on Fastify 5 and the matching major versions of the @fastify/* plugins. Fastify and its plugins are dependencies of sonamu, so bumping sonamu and re-running pnpm install upgrades them together. If your project declares fastify directly, align it to ^5 or remove it. Everything Sonamu provides (@api, @websocket, @stream, auth, file upload, and so on) works without code changes. Review the three places below only if your project uses them directly.
1

server.plugins.ws.errorHandler

From @fastify/websocket 11, the second argument is the ws.WebSocket instance instead of a { socket } wrapper. Replace connection.socket with socket.
2

server.plugins.custom, lifecycle.onError

Fastify 4-only APIs (request.routerPath, reply.context, reply.getResponseTime(), the reply.redirect(code, url) argument order, and others) were removed or changed. See the Fastify 5 migration guide. The server.fastify option no longer accepts logger; Sonamu configures the logger through loggerInstance.
3

request.hostname

In Fastify 5, request.hostname no longer includes the port. Use request.port or request.headers.host when you need it.

Peer dependency changes

These sonamu peer dependency ranges changed in 0.13.0. Align the catalog in your project’s pnpm-workspace.yaml to the same ranges. fastify is covered in the Fastify 5 section above. All other peer ranges are unchanged. The template project’s dev dependencies moved as well. vitest 5 (with @vitest/coverage-v8) enables clearMocks by default, so tests that rely on mock call history from earlier tests will fail. vite 8.3 and dotenv 18 need no attention.

Projects generated with create-sonamu

A generated project’s pnpm-workspace.yaml pins seroval to 1.4.2. That version has a deserialization vulnerability, so change the override to:
pnpm-workspace.yaml
web/tsconfig.node.json typechecks vite.config.ts, and the Vite plugins’ type declarations reference optional bundlers that are not installed (webpack, rollup, and others), which makes the web typecheck step of sonamu build fail. Add skipLibCheck, as tsconfig.app.json already does:
web/tsconfig.node.json
Upgrading TanStack Router to 1.170.45 or later is also recommended. The 1.170 generator rewrites routeTree.gen.ts in a new format; commit that change after the first sonamu dev run. Newly generated projects already include both changes.