npm package: @johnlindquist/nx-hono
Description: Nx plugin for Hono framework - fast, lightweight web framework built on Web Standards
Author: John Lindquist
Latest version: 0.0.2

# @johnlindquist/nx-hono

An Nx plugin for [Hono](https://hono.dev/) - a fast, lightweight web framework built on Web Standards that works on any JavaScript runtime.

## Features

- 🚀 **Multi-runtime support**: Cloudflare Workers, Node.js, Deno, Bun, Vercel Edge, Netlify Edge
- 🏗️ **Project generators**: Create Hono applications with proper Nx integration
- 🛠️ **Code generators**: Generate API routes and middleware
- ⚡ **Development server**: Serve applications with hot reload
- 📦 **Build system**: Build applications for production
- 🚀 **Deployment**: Deploy to various platforms

## Installation

```bash
npm install @johnlindquist/nx-hono
```

## Generators

### Initialize Hono Support

Add Hono support to your Nx workspace:

```bash
nx g @johnlindquist/nx-hono:init
```

### Create a Hono Application

Generate a new Hono application:

```bash
nx g @johnlindquist/nx-hono:application my-api
```

Options:
- `--runtime`: Target runtime (cloudflare-workers, node, deno, bun, vercel, netlify)
- `--directory`: Directory to create the application in
- `--tags`: Tags for the application

### Generate API Routes

Create new API routes:

```bash
nx g @johnlindquist/nx-hono:api users --project=my-api
```

Options:
- `--methods`: HTTP methods to support (GET, POST, PUT, DELETE, PATCH)
- `--directory`: Directory within the project to create the route

### Generate Middleware

Create custom middleware:

```bash
nx g @johnlindquist/nx-hono:middleware auth --project=my-api
```

Options:
- `--type`: Type of middleware (custom, auth, cors, logger, rate-limit)
- `--directory`: Directory within the project to create the middleware

## Executors

### Serve

Start a development server:

```bash
nx serve my-api
```

### Build

Build the application for production:

```bash
nx build my-api
```

### Deploy

Deploy the application:

```bash
nx deploy my-api
```

## Runtime-Specific Features

### Cloudflare Workers

- Automatic `wrangler.toml` configuration
- TypeScript support with Cloudflare Workers types
- Built-in CORS and logging middleware

### Node.js

- Express-like development experience
- Built-in server with `@hono/node-server`

### Deno

- Native Deno support
- Web Standards compliance

### Bun

- Ultra-fast development with Bun runtime
- Native TypeScript support

## Example Usage

1. Initialize Hono support:
```bash
nx g @johnlindquist/nx-hono:init
```

2. Create a new Hono application:
```bash
nx g @johnlindquist/nx-hono:application my-api --runtime=cloudflare-workers
```

3. Generate an API route:
```bash
nx g @johnlindquist/nx-hono:api users --project=my-api --methods=GET,POST
```

4. Generate middleware:
```bash
nx g @johnlindquist/nx-hono:middleware auth --project=my-api --type=auth
```

5. Start development server:
```bash
nx serve my-api
```

6. Build for production:
```bash
nx build my-api
```

7. Deploy:
```bash
nx deploy my-api
```

## Learn More

- [Hono Documentation](https://hono.dev/)
- [Nx Documentation](https://nx.dev/)
- [Cloudflare Workers](https://developers.cloudflare.com/workers/)

## Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.

## License

MIT