Experimental Hono auth npm package
Source: Dev.to
What I’m Building
I’m creating an auth package that developers can drop into their app without writing the usual boilerplate (login, register, JWT, email verification, etc.).
import { initAuth } from "auth-core";
const auth = initAuth({
DB_TYPE: "mongo",
existingConnection: db,
DATABASE_URL: // optional if connection doesn’t already exist
});
The package should also support optional route handlers, e.g.:
app.route("/auth", honoAuthRoutes());
or inside Remix:
server.use("/auth/*", honoAuthRoutes());
In short: auth as a plugin.
What I Want This Project to Be
- Framework‑agnostic – works with Remix, Hono, Express, etc.
- Allows users to pass their own database connection.
- Doesn’t require running an extra server.
Issues I’m Running Into
- I don’t want the npm package to depend on Hono directly.
- The core auth logic should be clean, but testing and route adapters still need Hono.
- Unsure whether Hono should be a
peerDependencyor handled another way. - Using Remix together with Hono feels odd; currently, a Remix user must spin up a Hono server inside their Remix server, which doesn’t seem right.
- Need a clean way to export route handlers without forcing every user to install every framework.
What I Need Advice On
- Dependency structure – how should core, optional adapters, and framework‑specific code be organized?
- Mounting Hono routes inside Remix – is this acceptable, or is there a better approach?
- Overall architecture – suggestions for structuring the package, handling adapters, and exposing only what’s needed per framework.
Any tips, suggestions, or warnings are welcome, especially from experience with:
- Auth systems
- SDKs
- Reusable npm packages
- Framework adapters
Repository
GitHub – AuthenticationSystem (server branch) – contains the working API code.