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 🙏

© 2025 – Pkg Stats / Ryan Hefner

create-hono-server

v1.0.3

Published

Scaffold a Hono server with authentication, RBAC, and OpenAPI docs

Readme

create-hono-server

A CLI tool to scaffold a production-ready Hono server with JWT authentication, role-based access control (RBAC), PostgreSQL, Drizzle ORM, and OpenAPI documentation.

Features

✅ Interactive CLI with prompts
✅ Multiple package manager support (bun, npm, pnpm, yarn)
✅ JWT-based authentication with HTTP-only cookies
✅ Role-based access control (admin, moderator, user)
✅ PostgreSQL + Drizzle ORM
✅ OpenAPI 3.0 documentation with Scalar API Reference
✅ Zod validation
✅ TypeScript support
✅ Production-ready code structure
✅ Beautiful colored terminal output

Usage

npx create-hono-server

Or with a specific package manager:

bunx create-hono-server

What You Get

Running this CLI will create a new Hono server project with:

  • Authentication System

    • POST /auth/signup - User registration (defaults to "user" role)
    • POST /auth/login - User login
    • Cookie-based JWT authentication
  • Role-Based Access Control

    • Three roles: user, moderator, admin
    • Role checker middleware for protected routes
    • JWT tokens include role information
  • User Management

    • GET /users/me - Get current user (protected)
    • GET /users/allusers - Get all users with pagination (requires admin or moderator role)
  • Documentation

    • GET /reference - Interactive API docs (Scalar)
    • GET /openapi.json - OpenAPI specification
  • Database

    • PostgreSQL with Drizzle ORM
    • User and session tables
    • Type-safe queries

Project Structure

your-project/
├── src/
│   ├── index.ts              # Main application
│   ├── db/
│   │   ├── schema.ts         # Database schema (with roles)
│   │   ├── connection.ts     # DB connection
│   │   └── init.ts           # DB initialization
│   ├── middleware/
│   │   ├── auth.ts           # Auth middleware
│   │   └── roleChecker.ts    # Role-based access control
│   ├── routes/
│   │   ├── auth.ts           # Auth routes
│   │   └── users.ts          # User routes (with RBAC)
│   └── utils/
│       └── auth.ts           # Auth utilities
├── package.json
├── tsconfig.json
├── drizzle.config.ts
├── .env.example
├── .gitignore
└── README.md

Quick Start

After creating your project:

# Navigate to project
cd your-project-name

# Create .env file (use .env.example as template)
cp .env.example .env

# Edit .env with your database credentials
# DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# JWT_SECRET=your-secret-key

# Push database schema
bun run db:push

# Start development server
bun run dev

Visit http://localhost:3000/reference for API documentation.

Available Scripts

  • bun run dev - Start development server with hot reload
  • bun run start - Start production server
  • bun run db:generate - Generate database migrations
  • bun run db:push - Push schema to database
  • bun run db:studio - Open Drizzle Studio

Tech Stack

Development

Local Testing

npx create-hono-server

Requirements

  • Node.js 18+ or Bun
  • PostgreSQL database (local or cloud like Neon)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please open an issue on the GitHub repository.


Made with ❤️ using Hono and Bun