npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-bhaze

v1.1.2

Published

Scaffold a production-ready Hono + Prisma + Zod API with RFC 7807 error handling

Readme

⚡ bhaze

Bun · Hono · Arc · Zod · Ecosystem

A production-ready API starter with RFC 7807 error handling, type-safe env validation, and zero process.env leaks.

Bun Hono Prisma Zod TypeScript


Quick Start

npx create-bhaze my-api
cd my-api
bun install
bun run dev

Server starts at http://localhost:5085.


What You Get

| Feature | Details | |---------|---------| | Runtime | Bun (primary) + Node.js (fallback) | | Framework | Hono with middleware stack | | ORM | Prisma + PostgreSQL | | Validation | Zod for env + request bodies | | Errors | RFC 7807 Problem Details | | Security | CORS, CSRF, rate limiting, secure headers, timeout | | TypeScript | Full strict mode, path aliases |


Project Structure

src/
├── config/env.ts            # Env validation (Zod) — the ONLY process.env
├── controllers/             # Request handlers (wrap in withHandler)
├── lib/
│   ├── app-error.ts         # RFC 7807 AppError class
│   ├── db.ts                # Prisma singleton
│   ├── helper.ts            # withHandler() wrapper
│   ├── response.ts          # sendSuccess / sendError
│   └── validator.ts         # Zod validator with RFC 7807 errors
├── routes/                  # Hono routers
├── services/                # Business logic (throws AppError)
├── types/                   # Public type exports
└── validators/              # Zod schemas

Response Format

Success

{
  "success": true,
  "message": "User fetched successfully",
  "data": { "id": "abc-123", "name": "John" }
}

Error (RFC 7807)

{
  "type": "https://api.bhaze.dev/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "User not found",
  "instance": "/api/users/abc123"
}

Error Handling

import { AppError } from "@lib/app-error";

throw AppError.notFound("User");
throw AppError.conflict("Email already exists");
throw AppError.badRequest("Validation failed", { fields: { email: "Invalid" } });

Environment Variables

All env vars validated at startup via Zod. Never use process.env directly.

import env from "@config/env";
const port = env.PORT; // ✅ typed, validated

| Variable | Default | Description | |----------|---------|-------------| | PORT | 5085 | Server port | | NODE_ENV | development | Runtime environment | | DATABASE_URL | postgresql://... | PostgreSQL connection | | ALLOWED_ORIGINS | http://localhost:5085,... | CORS origins | | RATE_LIMIT_MAX | 120 | Max requests per window | | TIMEOUT_MS | 30000 | Request timeout |


Scripts

| Command | Description | |---------|-------------| | bun run dev | Dev server with hot reload | | npm run dev:node | Dev server (Node.js) | | bun run start | Production server | | bun run db:generate | Generate Prisma client | | bun run db:migrate | Run migrations | | bun run db:push | Push schema to DB | | bun run typecheck | TypeScript check | | bun run format | Format with Prettier |


Adding a Resource

  1. src/validators/product.validator.ts — Zod schema
  2. src/services/product.service.ts — Business logic
  3. src/controllers/product.controller.ts — HTTP handlers
  4. src/routes/product.routes.ts — Wire routes
  5. src/routes/index.ts — Register

License

MIT