{"_id":"@drzl/generator-hono","_rev":"4-690a51ec9571ecfa3c345ba564b53316","name":"@drzl/generator-hono","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"@drzl/generator-hono","version":"0.1.0","keywords":["drizzle","drizzle-orm","hono","codegen","rest","standard-schema"],"license":"Apache-2.0","_id":"@drzl/generator-hono@0.1.0","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"homepage":"https://github.com/use-drzl/drzl#readme","bugs":{"url":"https://github.com/use-drzl/drzl/issues"},"dist":{"shasum":"67088e5cd1fc07b4c1ddf47d0d85f941e75d2b04","tarball":"https://registry.npmjs.org/@drzl/generator-hono/-/generator-hono-0.1.0.tgz","fileCount":6,"integrity":"sha512-xaQ+x/nEaKtEvGxTP8VbC6b3NhYz+BeibCbe1MO7VKOWVwGWSe/ImD/JXooGmKnZ/JiogGwaTe7CsUvuFZxW8w==","signatures":[{"sig":"MEUCIQDfonNbvHwEqMdlalAjGHuQypel9d/bDACclECyGIrUSQIgOf6a4wSreGF4mvmMXoRZrNBv44FVPoffMOl/Ue2g3qg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48885},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"funding":{"url":"https://github.com/sponsors/omar-dulaimi","type":"github"},"gitHead":"0bc738c3ebdbed8d3dd91a26a192b988ebf71ce0","private":false,"scripts":{"lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000","build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean"},"_npmUser":{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"},"repository":{"url":"git+https://github.com/use-drzl/drzl.git","type":"git","directory":"packages/generator-hono"},"_npmVersion":"10.9.4","description":"Generate Hono routes from a Drizzle schema, one route module per table, validated by DRZL's schemas through Hono's own validator middleware.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@drzl/analyzer":"workspace:^","@drzl/validation-core":"workspace:^"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","hono":"^4.12.0","tsup":"^8.5.1","arktype":"^2.1.29","valibot":"^1.1.0","typescript":"^5.9.3","@hono/zod-validator":"^0.9.0","@hono/standard-validator":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/generator-hono_0.1.0_1786347779797_0.6690778648261493","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@drzl/generator-hono","version":"0.2.0","keywords":["drizzle","drizzle-orm","hono","codegen","rest","standard-schema"],"license":"Apache-2.0","_id":"@drzl/generator-hono@0.2.0","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"dist":{"shasum":"a856c848113236954050b689358606cf08e828db","tarball":"https://registry.npmjs.org/@drzl/generator-hono/-/generator-hono-0.2.0.tgz","fileCount":7,"integrity":"sha512-42xJOQLzBAMX5WqMYXdJER7gN/AWCkhKHK+8uHhg1JmBF5HD5zEZjoy7eVggTLwxnTe6Iw2Y65zSEGh94XcueQ==","signatures":[{"sig":"MEQCIBKFTRuQTkxhHE7gM6h1Z45UVDqDAQ5Ok1+k4uQIERvHAiBF47YWyOd/eiF88tgz0g7CtIBjbh38iwsVIRxYzSwd9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@drzl%2fgenerator-hono@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60234},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"funding":{"url":"https://github.com/sponsors/omar-dulaimi","type":"github"},"private":false,"scripts":{"lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000","build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0d4c4dd4-8757-4ead-b4c2-c0113da44a0c"}},"repository":{"url":"https://github.com/use-drzl/drzl","type":"git","directory":"packages/generator-hono"},"description":"Generate Hono routes from a Drizzle schema, one route module per table, validated by DRZL's schemas through Hono's own validator middleware.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"@drzl/analyzer":"^1.21.0","@drzl/validation-core":"^3.22.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","hono":"^4.12.0","tsup":"^8.5.1","arktype":"^2.1.29","valibot":"^1.1.0","typescript":"^5.9.3","@hono/zod-validator":"^0.9.0","@hono/standard-validator":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/generator-hono_0.2.0_1786351578980_0.3831351550715807","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@drzl/generator-hono","version":"0.2.1","keywords":["drizzle","drizzle-orm","hono","codegen","rest","standard-schema"],"license":"Apache-2.0","_id":"@drzl/generator-hono@0.2.1","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"dist":{"shasum":"da6b7e2d1b3859d917d313d16cab992c44c62b67","tarball":"https://registry.npmjs.org/@drzl/generator-hono/-/generator-hono-0.2.1.tgz","fileCount":7,"integrity":"sha512-+ZsNgblMl4rgiw1G1DbkDEYxfrMDP+a+5hJEEy1eK1NkhBCHJpya4VbUq58PvZYI+zJnnac8H1vVIFWw2m4dgQ==","signatures":[{"sig":"MEUCIEMnHYMaQhUWWQfzRhTdBqeZUE0HkEj4zINjUnJNTsaDAiEA8+Kyvu81zDv9WghyTHx7Hyq1qCCXspo57HuUpVweqgk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@drzl%2fgenerator-hono@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60688},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"funding":{"url":"https://github.com/sponsors/omar-dulaimi","type":"github"},"private":false,"scripts":{"lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000","build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0d4c4dd4-8757-4ead-b4c2-c0113da44a0c"}},"repository":{"url":"https://github.com/use-drzl/drzl","type":"git","directory":"packages/generator-hono"},"description":"Generate Hono routes from a Drizzle schema, one route module per table, validated by DRZL's schemas through Hono's own validator middleware.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"@drzl/analyzer":"^1.21.3","@drzl/validation-core":"^3.22.3"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.4.3","hono":"^4.12.0","tsup":"^8.5.1","arktype":"^2.1.29","valibot":"^1.1.0","typescript":"^5.9.3","@hono/zod-validator":"^0.9.0","@hono/standard-validator":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/generator-hono_0.2.1_1786395142403_0.4676343979879438","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@drzl/generator-hono","version":"0.2.2","private":false,"license":"Apache-2.0","description":"Generate Hono routes from a Drizzle schema, one route module per table, validated by DRZL's schemas through Hono's own validator middleware.","keywords":["drizzle","drizzle-orm","hono","codegen","rest","standard-schema"],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"dependencies":{"@drzl/analyzer":"^1.21.5","@drzl/validation-core":"^3.22.5"},"devDependencies":{"@hono/standard-validator":"^0.4.0","@hono/zod-validator":"^0.9.0","arktype":"^2.1.29","hono":"^4.12.0","tsup":"^8.5.1","typescript":"^5.9.3","valibot":"^1.1.0","zod":"^4.4.3"},"engines":{"node":">=18.17.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"repository":{"type":"git","url":"https://github.com/use-drzl/drzl","directory":"packages/generator-hono"},"funding":{"type":"github","url":"https://github.com/sponsors/omar-dulaimi"},"scripts":{"build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean","lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000"},"_nodeVersion":"24.18.0","_id":"@drzl/generator-hono@0.2.2","dist":{"integrity":"sha512-ADTyyT18+rz4NVP0cjGo9urF3jE/yW6gWMq5MM+zyOOmS3xDxFx4BQ7P/0Trz49eJL+mUNPKaUHp9J5lUBA86w==","shasum":"09867f84bd0605f8ff960a4505994573a9553c6d","tarball":"https://registry.npmjs.org/@drzl/generator-hono/-/generator-hono-0.2.2.tgz","fileCount":7,"unpackedSize":63241,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@drzl%2fgenerator-hono@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDgiJ86n+bAzretJttySxXh8jyqiz1FWPDYB/NrF3DcpwIgfciz8jddAlh0smmZqF84VpH81fHpkD1NnT7wsl5Foow="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0d4c4dd4-8757-4ead-b4c2-c0113da44a0c"}},"directories":{},"maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/generator-hono_0.2.2_1786421607232_0.9969183388816458"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-10T07:42:59.605Z","modified":"2026-08-11T04:13:27.713Z","0.1.0":"2026-08-10T07:42:59.928Z","0.2.0":"2026-08-10T08:46:19.131Z","0.2.1":"2026-08-10T20:52:22.601Z","0.2.2":"2026-08-11T04:13:27.384Z"},"license":"Apache-2.0","keywords":["drizzle","drizzle-orm","hono","codegen","rest","standard-schema"],"repository":{"type":"git","url":"https://github.com/use-drzl/drzl","directory":"packages/generator-hono"},"description":"Generate Hono routes from a Drizzle schema, one route module per table, validated by DRZL's schemas through Hono's own validator middleware.","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"readme":"# @drzl/generator-hono\n\nGenerate [Hono](https://hono.dev) routes from a Drizzle schema: one route module per table,\nvalidated by DRZL's schemas through Hono's own validator middleware, with an `AppType` a\n`hc<AppType>()` client infers from.\n\n## Why not an adapter, and why not a template\n\nHono already hosts DRZL's other routers, and neither integration needs anything from this\nrepository. `@hono/trpc-server` mounts a `@drzl/generator-trpc` router as middleware, and oRPC's\n`RPCHandler` from `@orpc/server/fetch` mounts a `@drzl/generator-orpc` router on any fetch handler.\nBoth are a few lines and both are documented upstream.\n\nWhat nothing emitted was Hono's _own_ surface: real HTTP routes carrying a validator. That is what\nthis generates.\n\nIt is not a template either. A DRZL \"template\" is `ORPCTemplateHooks`, and both shipped ones\n(`@drzl/template-standard`, `@drzl/template-orpc-service`) hand back oRPC source text, so a Hono\ntemplate written against that interface would emit a file that does not compile.\n\n## Install\n\n```bash\nnpm install -D @drzl/generator-hono\nnpm install hono @hono/standard-validator\n```\n\n`@hono/standard-validator` is the default middleware and takes any Standard Schema, so it works\nwith the zod, valibot and arktype schemas DRZL emits. Set `validator: 'zod'` to emit\n`@hono/zod-validator` instead.\n\n## Configure\n\n```ts\nimport { defineConfig } from '@drzl/cli/config';\n\nexport default defineConfig({\n  schema: 'src/db/schema.ts',\n  outDir: 'src/routes',\n  generators: [\n    { kind: 'zod', path: 'src/validators/zod' },\n    {\n      kind: 'hono',\n      path: 'src/routes',\n      validator: 'standard',\n      validation: { useShared: true, library: 'zod', importPath: 'src/validators/zod' },\n    },\n  ],\n});\n```\n\nThen `npx drzl generate`.\n\n## What it emits\n\nFor `users(id serial primary key, email text not null, bio text)`:\n\n```ts\nexport const UsersParamsSchema = z.object({\n  id: z\n    .string()\n    .regex(/^-?\\d+(\\.\\d+)?$/)\n    .transform(Number),\n});\n\nexport type SelectusersRow = z.output<typeof SelectusersSchema>;\n\nexport const usersRoutes = new Hono()\n  .get('/', async (c) => {\n    const rows: SelectusersRow[] = [];\n    return c.json(rows);\n  })\n  .get('/:id', sValidator('param', UsersParamsSchema), async (c) => {\n    // The validated path parameters are at c.req.valid('param').\n    const row: SelectusersRow | null = null;\n    return c.json(row);\n  })\n  .post('/', sValidator('json', InsertusersSchema), async (_c) => {\n    throw new Error('Not implemented: create users.');\n  });\n```\n\nplus an `index.ts` mounting each table and exporting `AppType`:\n\n```ts\nexport const app = new Hono().route('/users', usersRoutes);\nexport type AppType = typeof app;\n```\n\nThe handlers are stubs. Fill them in; the schemas, the routes and the types are the part that is\nderived from your schema and regenerated.\n\n## Design\n\nThese follow `@drzl/generator-trpc`, not the older oRPC generator.\n\n- **A real primary key, or no addressing routes at all.** The key comes from the table's actual\n  `primaryKey`, every column of it, at its real type. A table with no primary key keeps `GET /` and\n  `POST /` and loses `GET /:id`, `PATCH /:id` and `DELETE /:id` rather than gaining a fictional\n  `id`. A composite key becomes `/:orgId/:userId`.\n- **A read-only table** (a materialized view) gets no write routes, and no insert or update schema.\n- **The response shape is stated**, because Hono has no `.output()`: what a client infers is the\n  handler's return type, so the value handed to `c.json` is annotated with the select shape.\n- **Write stubs throw** rather than returning their input. The input is the insert shape, where a\n  generated column is absent; the declared response is the select shape, where it is required.\n- **Path parameters are coerced strictly.** A path segment is always a string, so a `number` key\n  needs parsing, and the idiomatic coercions are built on `Number()`, where `Number('')` is `0`.\n  `GET /users/%20` addressing row `0` is not a coercion working loosely, it is the wrong row.\n- **Every module imports only what it uses**, so a route module that validates nothing does not\n  import a validator package, and loads in a project that never installed one.\n\n## License\n\nApache-2.0\n","readmeFilename":""}