Experimental Hono auth npm package

Published: (December 11, 2025 at 08:46 AM EST)
2 min read
Source: Dev.to

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 peerDependency or 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

  1. Dependency structure – how should core, optional adapters, and framework‑specific code be organized?
  2. Mounting Hono routes inside Remix – is this acceptable, or is there a better approach?
  3. 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.

0 views
Back to Blog

Related posts

Read more »

YES I AM THE ONE WHO REQUESTED THE ACCESS

NOTE: This is my first post, so apologies in advance if I’ve misunderstood something. I’m open to discussions and corrections. What is JWT? JWT stands for JSON...

Token Validation

Overview The process of validating a JWT involves: 1. Parsing the token string. 2. Decoding the header and payload. 3. Verifying the signature using the approp...

패키지 매니저 파묘🪦

!Cover image for 패키지 매니저 파묘🪦https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazon...