Skip to content

Quick Start

This guide walks you through adding UseBetter Console to an existing Hono application. Choose the tab that matches your environment — development (instant setup, no database) or production (magic link auth with Drizzle).

Auto-approve issues a stateless JWT immediately — no database tables, no email flow. Use this for local development.

  1. Generate a connection token

    Terminal window
    npx @usebetterdev/console-cli init --email admin@localhost -n

    This prints two environment variables. Copy BETTER_CONSOLE_TOKEN_HASH — you’ll need it in the next step.

  2. Add to your .env

    .env
    BETTER_CONSOLE_TOKEN_HASH=sha256:e5f6a7b8...
  3. Add the middleware

    src/index.ts
    import { Hono } from "hono";
    import { betterConsole } from "@usebetterdev/console";
    import { createConsoleMiddleware } from "@usebetterdev/console/hono";
    const app = new Hono();
    const consoleInstance = betterConsole({
    connectionTokenHash: process.env.BETTER_CONSOLE_TOKEN_HASH!,
    sessions: { autoApprove: process.env.NODE_ENV === "development" },
    });
    app.use("*", createConsoleMiddleware(consoleInstance));
    // Your existing routes below...
    app.get("/", (c) => c.text("Hello!"));
    export default app;
  4. Verify the health endpoint

    Terminal window
    curl http://localhost:3000/.well-known/better/console/health

    You should see {"status":"ok"}.

  5. Open the Console UI

    Visit console.usebetter.dev, enter your server URL (e.g., http://localhost:3000), and authenticate. Auto-approve grants a session token instantly.

  1. The CLI generated a connection token pair. The hash is stored in your environment and used server-side to sign/verify session JWTs. The raw token is only shown once during init.
  2. The middleware intercepts all /.well-known/better/* requests and delegates them to handleConsoleRequest().
  3. The Console UI at console.usebetter.dev calls your server’s endpoints to authenticate and discover registered products. No data leaves your infrastructure — the UI is a static frontend that talks directly to YOUR server.