@q32/core
v0.5.0
Published
Shared TypeScript primitives for Q32 Cloudflare Worker projects.
Readme
@q32/core
Dependency-light TypeScript building blocks shared by Q32 applications. The package targets Cloudflare Workers, Node, and tests, favors standard Web APIs, and keeps application policy in the consuming app.
Install
pnpm add @q32/coreImport from the package root or use a subpath for a focused dependency surface:
import { createId, jsonResponse } from "@q32/core";
import { D1JobStore } from "@q32/core/jobs";
import { createKyselyPostgres } from "@q32/core/pg-kysely";pg-kysely is the only optional integration with peer dependencies. All other modules use platform APIs and types.
What's included
- Application and HTTP: API operation registries and discovery documents, JSON responses and errors, environment parsing, and Cloudflare binding guards
- Identity and security: auth services, scanner-safe magic-link confirmations, Hono and React Router adapters, signed sessions, IDs and tokens, encoding, and WebCrypto encryption
- Agents and authorization: AI provider contracts and JSON extraction, MCP metadata, and OAuth discovery and protected-resource metadata
- Data and durable work: D1 types and migrations, durable jobs and orchestration, operational events, D1 rate limiting, R2 JSON storage, and time helpers
- Postgres: migration helpers and the optional Kysely/Postgres integration
- Messaging and commerce: email contracts and addresses, AWS request signing, Amazon SES and SES/SNS webhooks, billing primitives, conversion outbox contracts, and Google Ads uploads
- Presentation and tests: SEO and social metadata, JSON-LD, sitemaps, and robots and Worker queue, R2, and response test helpers
See Durable jobs, Purchase conversion outbox, and SEO primitives for larger workflow guidance.
Framework adapters are intentionally thin: put policy and persistence in shared services, then use an adapter only to translate framework request and response shapes.
Development
pnpm install
pnpm test
pnpm buildRelease
Publishing runs through the Release workflow when a GitHub release is published, using npm trusted publishing and provenance through GitHub OIDC.
