SPFN 0.4
What changed
One @spfn/core under spfn dev. A project without "type": "module" — every spfn create
scaffold — ran its server source as CommonJS under tsx in development, and tsx loaded a
second copy of each @spfn/* package beside the server's own. The app configured one copy and the
server ran the other. Rate-limit policies and trusted proxy hops did not reach @spfn/auth's
routes, and with a required second factor an account without one got 403 on the very routes that
enrol one, so it was locked out (issue #329). Production builds were not affected. spfn dev now
runs server source as ESM, as spfn build does, and a server process refuses a second copy of
@spfn/core, naming the file that loaded it.
One route map, whichever command writes it. spfn dev's watcher generated the committed route
map under development, while spfn codegen run and spfn build generated it under
production, so the file depended on which command ran last. Code generation now always runs
under production. A router whose generated file would differ under development or test is
refused, whether the difference is a route, a .csrf() declaration, the order of the routes or a
mounted package router.
MCP routes load without the app origin. @spfn/mcp accepts appUrl as a function, called at
the first request instead of when the router is created. An app that mounts the MCP route and
passes appUrl as a function can run spfn codegen run without SPFN_APP_URL set; an app that
passes a string read from the environment behaves as before. A new resourcePath option names
the resource's path in code.
Passkey-only sign-in can be closed. @spfn/auth has a passkeyLogin channel. An app whose rule
is a password plus a passkey sets channels: { passkeyLogin: false }, and the passkey sign-in
routes answer 404. It is on by default.
Security floors. The packages require Next.js ^16.4.5, hono ^4.13.16 and
@hono/node-server ^2.1.6, and the AWS and Google Cloud SDKs they accept have floors whose
lowest versions reach no known advisory. The CHANGELOG lists each range.
What can break, and who must act
- Everyone: 0.3 and 0.4 packages cannot be mixed. Upgrade every
@spfn/*package andspfntogether. - Apps run with
spfn devwithout"type": "module": CommonJS in server source —require,__dirname, a named import from amodule.exportsfile, a CommonJS file that requires@spfn/*— no longer runs in development. All but the named import already failed in production. The CLI README tables each case. - Apps on an older
spfnCLI: the new@spfn/corerefuses to start under it. - Apps with
tsxbelow 4.22.4: raise it; older releases print a deprecation warning on Node 26. - Apps on Next.js below 16.4.5, or installing the KMS, SNS, SES or Cloud Storage SDKs themselves: raise them.
- Routers that register routes, CSRF or mounts by environment: code generation refuses them. Register them unconditionally and branch inside the handler.
- Committed generated files: regenerate once. The
Generated with NODE_ENVheader line is gone. NODE_ENV=development spfn build:next buildand the server build now run underproduction.@spfn/authwith a required second factor and two copies ofhono: the server refuses to start instead of answering 403.
Versions
| Package | From | To |
|---|---|---|
@spfn/core |
0.3.0-beta.38 | 0.4.0-beta.1 |
@spfn/auth |
0.3.0-beta.53 | 0.4.0-beta.1 |
spfn |
0.3.0-beta.22 | 0.4.0-beta.1 |
@spfn/storage |
0.3.0-beta.3 | 0.4.0-beta.1 |
@spfn/cms |
0.3.0-beta.6 | 0.4.0-beta.1 |
@spfn/mcp |
0.3.0-beta.5 | 0.4.0-beta.1 |
@spfn/notification |
0.2.0-beta.13 | 0.3.0-beta.1 |
@spfn/monitor |
0.2.0-beta.5 | 0.3.0-beta.1 |
@spfn/i18n |
0.2.0-beta.10 | 0.3.0-beta.1 |
@spfn/migrate |
0.2.0-beta.1 | 0.3.0-beta.1 |
@spfn/pages-next |
0.1.0-beta.12 | 0.2.0-beta.1 |
@spfn/pages |
0.1.0-beta.4 | 0.2.0-beta.1 |
@spfn/signing |
0.1.0-alpha.3 | 0.2.0-alpha.1 |
@spfn/workflow |
0.2.0-alpha.2 | 0.3.0-alpha.1 |
Upgrading
Upgrading from 0.3 to 0.4 has a table of who is affected, the commands in order, and the error each missed step produces.