Add a Backend Module to an API App
Wire auth, a database, an admin API, payments or notifications into an app made from the api template.
Add the module
bun path/to/signet/packages/cli/src/index.ts add auth paymentsCheck what it wired
import { authRoutes } from "./server/auth.ts"
import { paymentsRoutes } from "./server/payments.ts"
import { getRuntimeEnv } from "@dapplelight/signet-server/env"
import { errorHandler } from "@dapplelight/signet-server/http"
import { Hono } from "hono"
const isProduction = () => getRuntimeEnv().NODE_ENV === "production"
export const app = new Hono()
.route("/api/sessions", authRoutes())
.route("/webhooks", paymentsRoutes())
.onError(errorHandler({ isProduction }))Each module adds an import and one .route(...) line before .onError(.
Fill in the keys
import { z } from "zod"
export const envSchema = z.object({
SESSION_SECRET: z.string().min(32),
STRIPE_SECRET_KEY: z.string().min(1),
})New keys also land in .env.example.
Preview an upgrade
bun path/to/signet/packages/cli/src/index.ts upgrade --dry-runUpgrade merges upstream changes into your edited module files and runs the codemods your installed versions need.
Modules: auth, db, admin, payments, notify. admin pulls in auth and db. Running a module again adds nothing twice.