Changelog
SelfAuth is 0.x: minor versions may change generated code and behavior, and each change below says what to do. Security fixes ship as patch releases. See diff and upgrade for how to take a release.
The full history of every package is in the repository: CLI, spec and migration. The list below is the CLI's changelog, which is the one that describes generated code.
0.17.0
Minor Changes
b0cc30b:
selfauth db planno longer asks for approval when you create a table or add a column or index to your own tables. It used to report every change to a table outside SelfAuth's list asnot_ownedand refuse to migrate without--approve-destructive, which taught people to approve without reading. The ownership rule now works the way it was meant to: a migration SelfAuth ships may only change SelfAuth's tables (not_ownedotherwise), a migration you write may change your own tables freely, and changing a SelfAuth table (auth_…) from your own migration is reported as the newselfauth_tablefinding. Statements that lose data (drops, type changes, renames, deletes) still need approval for every table. Every finding now prints a sentence saying what it means, and a locked or failed migration prints the tool's own output.368fd3d: Gin projects get the same migration safety review as Prisma ones:
selfauth db planandselfauth db migratenow read the SQL indb/migrations/, flag changes that lose data or touch SelfAuth's tables, andmigraterefuses them without--approve-destructive. Also for Gin: a handler that callsc.Error(err)now answers a 500 in the standard error format (with the error in the server log) instead of an empty 200; the server binds its port before printing "Listening", and a busy port is one clear error; generated Go files are gofmt-clean whatever the module name sorts like; and in a project with a frontend,npm run db:seed,db:create-admin,db:migrateanddb:statusloadserver/.envlikenpm run devdoes. Fastify reports a failed start in one line (for example a busy port) instead of a stack trace.0eb5b0b: Your routes now get the database.
mountRoutes(app, auth, db)(Express and Fastify) receives the Prisma client, or the Mongoose connection on MongoDB, that SelfAuth already uses, so your own tables need no second client. Gin'sroutes.Register(r, a, db)receives astore.DBwithSQL(*sql.DBon PostgreSQL, MySQL and SQLite) orMongo(*mongo.Database).dbis undefined (Gin: empty) on the in-memory store. The example/api/helloroute also says whether a database is connected.Upgrading: if you edited
src/routes/index.ts(Gin:internal/routes/routes.go),selfauth upgradekeeps your file and writes a.selfauth-newproposal; add thedbparameter to yourmountRoutes/Registersignature so it matches the updatedserver.ts/cmd/server/main.go.
Patch Changes
- 84f63fe: Generated projects now ignore SQLite database files (
*.db,*-journal,*-shm,*-wal) in.gitignore, so a development database is never committed. The Express server now reports a failed start (for example "Could not start on port 3000: … address already in use") and exits with code 1, instead of printing "Listening" and quitting.selfauth db migratenow prints the migration tool's own output when a migration fails, and explains a locked SQLite database (stop the running server, then migrate). - a9a6c6b: Fix
npm installfailing at once on Windows duringselfauth init,addandadd-frontend. Windows runsnpm,pnpmandyarnas.cmdscripts, which Node cannot start without a shell, so the install never ran and no reason was shown. The commands now go through the shell with quoted arguments, and a failure says why. - Updated dependencies [b0cc30b]
- @selfauth/migration@0.17.0
- @selfauth/spec@0.17.0
0.16.0
Minor Changes
- 8afd018:
selfauth init --backend ginnow works with every database: PostgreSQL, MySQL, SQLite and MongoDB as well as the in-memory store. MySQL and SQLite share adatabase/sqlstore (the schema is the one derived from the PostgreSQL reference, written todb/migrations); MongoDB has its own store with the same collections and documents as the TypeScript one and creates indexes instead of migrations. Only the code of the database you choose is generated. All 90 conformance cases pass on each (MySQL and SQLite verified locally, MongoDB in CI), andselfauth db,doctor,validate,diffandupgradework with them. - f690bcc:
selfauth init --backend gin --frontend vue|reactnow works. The Go module goes inserver/next to the frontend inclient/, with a thin npm root (npm run devstarts both,db:*,build,typecheckandtestwrap the Go commands) and ascripts/dev-server.mjsthat loadsserver/.envfor the Go server.doctor,validate,diff,upgradeanddbwork on it. The browser end-to-end suite now also runs against the Go server for both frontends. - 2f5390f:
selfauth skill install --global(or-g) installs the agent skill into your home folder (~/.claude/skills/selfauth/,~/.agents/skills/selfauth/,~/.cursor/skills/selfauth/), so every project has it. It can't be combined with a project folder;--agent,--updateand--dry-runwork as before.
Patch Changes
- @selfauth/migration@0.16.0
- @selfauth/spec@0.16.0
0.15.1
Patch Changes
- 97d49bf: Fix stale help text:
selfauth init --helpandselfauth listnow say the generated frontend is inclient/(notweb/), andlistno longer calls MongoDB planned. - @selfauth/migration@0.15.1
- @selfauth/spec@0.15.1
0.15.0
Minor Changes
- a109eea: Add a Gin (Go) backend.
selfauth init --backend gingenerates an API-only Go project (PostgreSQL via pgx, or the in-memory store): a Go port of the authentication core behind a Gin adapter, held to the same 90 conformance cases as Express and Fastify on both stores.doctor,validate,diff,upgradeanddbwork on it;adddoes not apply to Go. The configuration schema acceptsadapter.backend: "gin"(withorm: "none") and the manifest records the backend and the Go module path.
Patch Changes
- Updated dependencies [a109eea]
- @selfauth/spec@0.15.0
- @selfauth/migration@0.15.0
0.14.0
Minor Changes
cd70f2b: MongoDB is a supported database:
selfauth init --database mongodb(andselfauth add --database mongodb) for Express and Fastify, through Mongoose 9.- Its own store, not derived from SQL (ADR 0026). No transactions: the credential and the role links are embedded in the user document so creating a user is one atomic write; tokens, sessions and roles use conditional updates; rate limits use compare-and-swap. It works on a standalone server and on a replica set. Every lookup key is checked to be a string, so a request cannot smuggle a query operator into a filter.
- Indexes, not migrations:
selfauth db migrate(ornpm run db:migrate) creates the missing indexes and never drops one;selfauth db planlists them. The unique email index is what keeps accounts unique, so the server refuses to start without the indexes. - Claimed at authorization level, not production, until its production profile has been reviewed.
- The conformance run uses a real MongoDB in CI (
scripts/dialect-conformance.mjs mongodb); the test helpers now sit behindtest/database.tsso another database replaces one file.
Patch Changes
- Updated dependencies [cd70f2b]
- @selfauth/spec@0.14.0
- @selfauth/migration@0.14.0
0.13.0
Minor Changes
351a600: MySQL is a supported database:
selfauth init --database mysql(andselfauth add --database mysql) for Express and Fastify, with the same 90 conformance cases passing on a real MySQL 8.- Prisma 7 with the MariaDB driver adapter (
@prisma/adapter-mariadb), so it works with MySQL 8 and MariaDB.DATABASE_URL=mysql://user:password@host:3306/db; create the empty database, thenselfauth db migrate. - Derived from the tested PostgreSQL reference at generation time (ADR 0025), like SQLite. Tables use the exact-byte
utf8mb4_bincollation, because MySQL's default ignores case and accents and two different emails or rate-limit keys could collide. The rate-limit row lock is an upsert that changes nothing plusSELECT ... FOR UPDATE, which avoids the deadlockINSERT IGNOREcauses. @selfauth/migration's SQL safety analysis reads MySQL's backtick-quoted SQL and flagsMODIFY,CHANGE,DROP FOREIGN KEY,RENAME TABLEandDROP DATABASE.- Claimed at authorization level, not production, until its production profile has been reviewed.
- Prisma 7 with the MariaDB driver adapter (
Patch Changes
- Updated dependencies [351a600]
- @selfauth/spec@0.13.0
- @selfauth/migration@0.13.0
0.12.0
Minor Changes
8147603: SQLite is a supported database:
selfauth init --database sqlite(andselfauth add --database sqlite) for Express and Fastify, with the same 90 conformance cases passing.- One file, no server to run.
DATABASE_URL=file:./app.db;selfauth db migratecreates the file. Uses Prisma 7 withbetter-sqlite3. - Derived from the tested PostgreSQL reference at generation time instead of copied (ADR 0025): the schema and the PostgreSQL-specific parts of the store are transformed, the migration is generated by Prisma, and CI runs the whole conformance suite, including the concurrent cases, against the derived code for both backends.
- Claimed at authorization level, not production: it is one file on one host, and the production profile expects a rate-limit store shared across instances.
- The configuration schema and the manifest accept
mysqlas a database name (not implemented yet;createAuth()andselfauth upgraderefuse it, as they do MongoDB). selfauth db statusanddb plantreat a SQLite file that does not exist yet as "nothing applied" instead of failing.
- One file, no server to run.
Patch Changes
- Updated dependencies [8147603]
- @selfauth/spec@0.12.0
- @selfauth/migration@0.12.0
0.11.0
Minor Changes
664fcf7: Security fixes from an automated hostile review (see
docs/security-review.md).- Per-account login and password-change rate limits could be bypassed by concurrent requests. The limit was read before the password hash and counted after it, so parallel guesses all passed the check (20 of 20 evaluated against a limit of 5). The attempt is now counted atomically before the hash and cleared by a verified password. Regenerate or
selfauth upgradeto get the fix insrc/auth/core/service.ts. - On PostgreSQL, a request with a malformed
:id(for exampleDELETE /auth/sessions/not-a-uuid) returned 500; it is now404 NOT_FOUND, as with the in-memory store (src/auth/stores/prisma.ts). initandaddrefuse an app base URL with spaces, control characters or a non-http(s) scheme.- The conformance suite grows from 87 to 90 cases:
CT-RATE-006andCT-PWCHG-004(concurrent guesses against the limits) andCT-SESS-006(malformed session id). The runner'sconcurrentstep now reportserrorCodes, so a case can count how many attempts a limit let through.
- Per-account login and password-change rate limits could be bypassed by concurrent requests. The limit was read before the password hash and counted after it, so parallel guesses all passed the check (20 of 20 evaluated against a limit of 5). The attempt is now counted atomically before the hash and cleared by a verified password. Regenerate or
eb0cd7c:
selfauth addnow works on existing Fastify projects, and the browser tests run against Fastify.addanddetectrecognise Fastify (--backend fastifyoverrides when both frameworks are dependencies), write the same<src>/selfauth/folder and a Fastifysetup.ts, and print the Fastify wiring:Fastify({ ...selfAuthServerOptions() }),await setupSelfAuth(app),app.setErrorHandler(selfauth.errorHandler).selfAuthServerOptions()carries the body limit, trusted-proxy setting and request-id rule, which Fastify only accepts when the app is created.- The Playwright suite runs the Vue and React frontends against both the Express and the Fastify backends (24 tests).
2da4e04:
selfauth initis now an interactive wizard when it runs in a terminal without--yes.- Arrow-key menus (or press a number) for backend, database and frontend, each with a one-line hint, instead of typing a word and finding out about a typo later.
- It also asks for the project folder, your application permissions, where your frontend runs (API-only projects) and whether to run
npm install. - A bad answer is explained and asked again at once; flag values are checked before anything is asked; Ctrl-C cancels with exit code 130 and writes nothing.
- Flags still answer their question in advance. With
--yes, or without a terminal, nothing is asked, exactly as before.
6a2bc93: Full-stack projects no longer ship the notes demo.
init --frontend vue|reactnow generates the five account screens, the account page and the guards, and the API has the same single protected example route as an API-only project. The demo's permissions (notes.*) and thesupportrole are not added toselfauth.config.ts, and the nav bar has no demo link.The reference apps keep the notes example for the browser tests; generation removes it with exact replacements and fails loudly if a reference file changes. Existing projects are not touched:
selfauth upgradereports the notes files as removed from the template and leaves them alone.
Patch Changes
- Updated dependencies [664fcf7]
- Updated dependencies [eb0cd7c]
- Updated dependencies [2da4e04]
- Updated dependencies [6a2bc93]
- @selfauth/spec@0.11.0
- @selfauth/migration@0.11.0
0.10.0
Minor Changes
- 9dc30ee: The Vue and React starter pages are now plain, unstyled HTML. The stylesheet (
web/src/style.css, orclient/src/style.css) and the styling-only class names are gone, so you can bring your own design system without undoing ours. The semantic markup is unchanged (labels,role="alert",autocomplete, password inputs).
Patch Changes
- Updated dependencies [9dc30ee]
- @selfauth/spec@0.10.0
- @selfauth/migration@0.10.0
0.9.0
Minor Changes
- f66dcce: Fastify is a second backend:
selfauth init --backend fastify(API only, or full-stack with a Vue or React client) generates a Fastify 5 project with the same core, stores, tests and frontends as the Express one, behind a Fastify adapter insrc/auth/fastify/. All 87 conformance cases pass on it with the in-memory store and with PostgreSQL; it is published at the authorization level (production-profile review is pending). The configuration schema acceptsadapter.backend: "fastify", the manifest recordsoptions.backend,upgrade/doctor/validatework on Fastify projects, and there are manual templatesfastify/,fastify-vue/andfastify-react/.selfauth add(existing projects) still supports Express only;detectandaddpoint Fastify apps toinit --backend fastify. The generated Fastify server listens onHOST(default0.0.0.0).
Patch Changes
- Updated dependencies [f66dcce]
- @selfauth/spec@0.9.0
- @selfauth/migration@0.9.0
0.8.1
Patch Changes
- 71cdbb1: Docs: list the three frontend pages to edit when you change the password length.
- 5ee63a8: Reverts the shared root
selfauth.config.jsonadded in 0.8.0. The password length is set again in the server'sselfauth.config.tsonly, and generated projects no longer have the root file,scripts/sync-config.mjs, thesync/pre*scripts or the copies inserver/andclient/. The frontend's register, reset and account pages go back to a fixedminlengthhint, and the docs now list the three pages to edit when you change the password length. Projects made with 0.8.0 can delete the rootselfauth.config.json,scripts/and the copies, and thesyncandpre*scripts, though leaving them does no harm. - Updated dependencies [71cdbb1]
- Updated dependencies [5ee63a8]
- @selfauth/spec@0.8.1
- @selfauth/migration@0.8.1
0.8.0
Minor Changes
- f1e6cc1: Full-stack projects get one root
selfauth.config.jsonfor the settings the browser needs too (the password length limits). Edit it once: the server's config and the frontend's register, reset and account screens both read it, so the form can no longer disagree with the server. Each package imports a copy inside its own folder, written bynpm run sync(run automatically beforedev,build,testandtypecheck), so the build, tsconfig and Vite are unchanged.selfauth doctorwarns when a copy is stale. Existing projects keep working;selfauth upgradeadds the frontend's copy.
Patch Changes
- Updated dependencies [f1e6cc1]
- @selfauth/spec@0.8.0
- @selfauth/migration@0.8.0
0.7.0
Minor Changes
- 7dbea79: The default minimum password length is now 8 (was 12). 8 is the floor the specification allows (SEC-PWPOLICY-001), and common-password rejection stays on by default. Projects set it in
selfauth.config.ts(authentication.password.minLength, up to 1024); existing projects keep the value in their own config. The generated frontends' hint andminlengthattribute follow the default, conformance case CT-REG-005 now checks the boundary at 8 (7 rejected, 8 accepted), andselfauth doctorno longer warns about every project for having a minimum below 12.
Patch Changes
- 19eb350:
selfauth dbnow explains a missingDATABASE_URLinstead of ending in Prisma's bare "Connection url is empty". It reads the environment and the project's.envitself (tolerating CRLF line endings, a byte-order mark and quotes), hands the value to Prisma explicitly, ignores an empty shell variable that would hide.env, and reports what it found, where it looked, and when the value is the.env.exampleplaceholder or not a PostgreSQL URL. The database guide gains a troubleshooting section (URL-encoding passwords, and using a direct or session-mode connection for migrations on Supabase and other pooled databases). - Updated dependencies [19eb350]
- Updated dependencies [7dbea79]
- @selfauth/migration@0.7.0
- @selfauth/spec@0.7.0
0.6.0
Minor Changes
21d7f85: Full-stack projects are now two real packages.
selfauth init --frontend vue|reactmakesserver/(the Express API: its ownpackage.json,tsconfig,.env.example,src/,test/,prisma/) andclient/(the Vue or React app) in one npm workspace, with a thin root:package.json(npm run devstarts both, onenpm installinstalls both),README.mdand.gitignore. API-only projects are unchanged.- Each package has its own
selfauth.manifest.json.doctor,validate,diffandupgraderun at the workspace root over both packages, or inside either package;dbfinds the server from anywhere. selfauth upgrade --reorganizealso moves an existing full-stack project (made with 0.5 or earlier) into this layout: whole folders move,package.jsonand the manifest are split, the root is created, and your own files,.env, scripts and dependencies come along. Round-trip tests restore exactly whatinitwrites.- Prisma is found in a parent folder (npm hoists it to the workspace root), and
detectno longer flags SelfAuth's own files in a workspace as foreign authentication code. - The ownership manifest gains the
serverandclientlayouts andstructure: 3.
- Each package has its own
Patch Changes
- d526c8a:
selfauth db …now works on Windows. It ran Prisma throughnode_modules/.bin/prisma, a shell script that Windows cannot execute, soselfauth db planfailed with an empty message (prisma migrate status failed:). The CLI now starts Prisma's entry script with Node, which works everywhere, finds Prisma in a parent folder (npm workspaces hoist it), and says what is wrong when Prisma is not installed or the process cannot start, instead of an empty message. - Updated dependencies [21d7f85]
- Updated dependencies [d526c8a]
- @selfauth/migration@0.6.0
- @selfauth/spec@0.6.0
0.5.0
Minor Changes
4df71a2: Generated projects now have a proper folder structure. The app files that used to sit side by side in
src/are grouped by responsibility:src/config/(selfauth.config.ts, env.ts, dev-config.ts),src/email/mailer.ts,src/db/store.ts,src/http/(errors, request-id) andsrc/routes/. Inweb/, the five SelfAuth screens (login, register, verify email, forgot and reset password) moved tosrc/pages/auth/, leavingsrc/pages/for the app's own pages. The generated README shows the layout.selfauth adduses the same grouping under<src>/selfauth/.Projects made with 0.3 or earlier keep working with
doctorandvalidate.selfauth upgrade --reorganizemoves them to the new layout (moves the files, rewrites the relative imports, updates the manifest, includingweb/pages); a round-trip test proves it restores exactly what a new project has.upgradeitself asks you to run it first, because the new templates import each other from the new places.The ownership manifest records
options.structure.
Patch Changes
- Updated dependencies [4df71a2]
- @selfauth/migration@0.5.0
- @selfauth/spec@0.5.0
0.4.0
Minor Changes
- bf61fa0: The agent skill now answers questions about SelfAuth, not only performs integrations. It bundles the user guides (usage, existing projects, database, deployment, customization, upgrading, limits, API) next to the specifications, adds a question-to-answer map, and tells agents to answer from those files, cite requirement IDs, separate supported / planned / unsupported, and state that no independent audit has been done.
Patch Changes
- Updated dependencies [bf61fa0]
- @selfauth/spec@0.4.0
- @selfauth/migration@0.4.0
0.3.0
Minor Changes
a649786: Existing projects in any layout.
selfauth add --src <folder>: write under<folder>/selfauth/when the code is not insrc/. Without it,addfinds the folder from the Express entry file. It refuses, before writing, whentsconfig.jsonwould not compile the new folder.selfauth add-frontend: adds the authentication module (client, session state, route guards,<Can>) to an existing Vue or React app, in any folder or repository. It writes new files only, with its own manifest, and generates no pages.validate,doctor,diffandupgradework in that folder.selfauth detectreports the source folder, the Express entry file, monorepo packages and frontends, with the command to run in each. The agent skill gained a project-layouts reference.- The ownership manifest records
srcDirand the newfrontendlayout.
Patch Changes
- Updated dependencies [a649786]
- @selfauth/migration@0.3.0
- @selfauth/spec@0.3.0
0.2.0
Minor Changes
7364ff3: Conformance levels and quality gates.
@selfauth/conformance:runSuite,evaluateLevelsand the adapter record (compliance levels with evidence-backed sign-offs), requirement areas, and a generated support-matrix document.selfauth initprojects now include a smoke test suite (npm test, Node's built-in runner, no extra dependencies) that exercises the project's own authentication wiring.- The Express adapter refuses configuration it cannot honour (for example MongoDB), at start-up.
- Documentation: data retention after account deletion, security review, HTTPS and HSTS.
Patch Changes
- Updated dependencies [7364ff3]
- @selfauth/spec@0.2.0
- @selfauth/migration@0.2.0
0.1.0
Minor Changes
28d295e: First public release (0.1.0).
selfauth init(Express + PostgreSQL/Prisma or in-memory, optional Vue or React frontend),addfor existing Express projects,detect,doctor,validate,diff/upgrade,db …, andskill installfor coding agents.- The specification, configuration schema and requirement tooling (
@selfauth/spec), migration safety analysis (@selfauth/migration), and the conformance suite (@selfauth/conformance). selfauth: the short name, sonpx selfauthruns the CLI.
Patch Changes
- Updated dependencies [28d295e]
- @selfauth/spec@0.1.0
- @selfauth/migration@0.1.0