@json-express/preset-identity
v2.0.0
Published
Drop-in identity stack for JSON Express — plugin-identity + middleware-auth bundled with sensible local defaults (email-console, kv-memory, queue-memory).
Maintainers
Readme
@json-express/preset-identity
Zero-code preset that bundles plugin-identity with sensible local defaults so you can boot a working auth stack with a single install.
npm install @json-express/boot @json-express/preset-identitySet the JWT secret and exclude /auth/* from the verifier in .env:
jex__auth__secret=a-strong-32-byte-secret
jex__auth__exclude=/authRun it:
npx json-expressYou now have /auth/register, /auth/login, /auth/refresh, /auth/logout, /auth/password/change, plus the email-dependent endpoints (/auth/verify, /auth/password/forgot, …) printed to stdout by email-console.
What's in the box
This package ships no application code — its only purpose is to declare the identity stack as dependencies:
@json-express/plugin-identity— issues JWTs, mounts/auth/*, hashes with argon2id, auto-seeds an admin user@json-express/middleware-auth— verifies JWTs on every protected route (hard peer ofplugin-identity)@json-express/email-console— prints verification / reset emails to stdout (swap foremail-ses,email-sendgrid, … in prod)@json-express/kv-memory— refresh-token store (swap forkv-redisin prod)@json-express/queue-memory— background job queue for email dispatch (swap forqueue-bullmqin prod)
Swapping a default
Install the alternative alongside this preset, then pick it via .env:
npm install @json-express/kv-redisjex.kv=@json-express/kv-redisThe CLI's auto-discovery sees both, and the .env override wins. The unused default stays in node_modules but is never instantiated.
When to use this vs. installing peers individually
- Quickstart / dev: install
@json-express/preset-identity. One command, working auth. - Production / opinionated stack: install
@json-express/plugin-identity+@json-express/middleware-authplus only the specificemail-*/kv-*/queue-*providers you want. Keepsnode_moduleslean.
See also
@json-express/plugin-identity— the plugin itself@json-express/boot— the equivalent preset for the default server stackexample/plugin-identity— a full project using this preset
