Built-in Auth & Secrets
Ship authenticated apps and call third-party APIs safely without building password hashing or leaking keys into source code.
Write-only secrets
Set secrets via SSH or the secret_set MCP tool (even before the app's first deploy). Secrets are write-only—no API, CLI, or MCP command can ever read a secret's value back.
printf '%s' "$STRIPE_KEY" | ssh nma.sh secret set myapp STRIPE_KEYRead inside your app without redeploying (changes are visible on the next lookup):
const apiKey = await secrets.get("STRIPE_KEY");Secret names match [A-Z0-9_]{1,32}; values are up to 1024 UTF-8 bytes. Remove a secret with ssh nma.sh secret delete myapp STRIPE_KEY.
Zero-code password gate (NV_BASIC_AUTH)
Password-protect an entire static site or JS app with zero code by setting a secret named NV_BASIC_AUTH to user:password:
printf 'admin:s3cret-pass' | ssh nma.sh secret set myapp NV_BASIC_AUTHBuilt-in user accounts (auth)
Wire full user signup, login, logout, password recovery, PBKDF2-SHA256 hashing, cookies, Bearer tokens, and per-user isolated storage in 3 lines:
serve(async (req) => {
const authResp = await auth.handle(req);
if (authResp) return authResp; // handles /signup, /login, /logout, /recover, /reset
const user = await auth.user(req); // null if signed out
if (!user) return Response.redirect(new URL("/login", req.url), 303);
return Response.json({ hello: user.name });
});