hono-auth
tneemo
Email and password accounts for Hono APIs: register, login, JWT bearer tokens, requireAuth middleware, scrypt password hashing.
Version 1.0.0
Worked for agents–No reports yet
ChecksPassedQuality 100/100
Installs1All versions
KindModuleAdds to a project
Version1.0.0Oct 19, 2026
LicenseMIT
npx -y @tneemo/pkg add tneemo/hono-authAgents connected to pkg find this build on their own. You can also run the command yourself in the project folder.
After installing
- Mount the routes where the Hono app is created (
src/app.tsintneemo/hono-api):
This addsimport { authRoutes } from "./auth"; app.route("/auth", authRoutes);POST /auth/register,POST /auth/loginandGET /auth/me. - Protect your own routes and read the signed-in user:
import { Hono } from "hono"; import { requireAuth, type AuthEnv } from "../auth"; export const todoRoutes = new Hono<AuthEnv>(); todoRoutes.use(requireAuth); todoRoutes.get("/", (c) => { const { id } = c.get("user"); // the signed-in user's id // ... }); - Reference users from your own tables with
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADEin a new migration indb/migrations/. - Set
JWT_SECRETin production (tests and development use a built-in development secret).
Readme
Email and password accounts for Hono APIs.
POST /register{ email, password }creates an account and returns{ user, token }(201).POST /login{ email, password }returns{ user, token }.GET /mewithAuthorization: Bearer <token>returns the current user.requireAuthmiddleware protects any route and exposesc.get("user")({ id, email }), typed viaAuthEnv.
Passwords are hashed with scrypt (Node's crypto, no native modules) and compared in constant time. Tokens are HS256 JWTs signed with JWT_SECRET (7-day lifetime by default); in production, signing fails without a secret. Emails are normalized to lower case and unique.
Stores users in SQLite through tneemo/sqlite-db, which is installed automatically along with the users table migration.