create-better-notify 0.0.3-alpha.0 → 0.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# create-better-notify
|
|
2
|
+
|
|
3
|
+
Scaffold a [Better Notify](https://github.com/better-notify/better-notify) project with your preferred framework and RPC layer. One command gives you a working server with typed notifications, OpenAPI playground, and email templates ready to go.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
# npm
|
|
9
|
+
npx create-better-notify
|
|
10
|
+
|
|
11
|
+
# pnpm
|
|
12
|
+
pnpm create better-notify
|
|
13
|
+
|
|
14
|
+
# yarn
|
|
15
|
+
yarn create better-notify
|
|
16
|
+
|
|
17
|
+
# bun
|
|
18
|
+
bun create better-notify
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The CLI walks you through project name, framework, RPC layer, and package manager — then scaffolds, installs dependencies, and prints next steps.
|
|
22
|
+
|
|
23
|
+
### Non-interactive
|
|
24
|
+
|
|
25
|
+
Pass flags to skip the prompts:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx create-better-notify my-app --framework hono --rpc orpc --pm pnpm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| Flag | Values | Default |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `--framework` | `hono` | prompted |
|
|
34
|
+
| `--rpc` | `orpc` | prompted |
|
|
35
|
+
| `--pm` | `npm`, `pnpm`, `yarn`, `bun` | auto-detected |
|
|
36
|
+
|
|
37
|
+
## What you get
|
|
38
|
+
|
|
39
|
+
The scaffolded project includes:
|
|
40
|
+
|
|
41
|
+
- **HTTP server** — Hono with RPC and OpenAPI handlers
|
|
42
|
+
- **OpenAPI playground** — browse and test your API at `/api/docs`
|
|
43
|
+
- **Typed notifications** — a working `welcome` email using Better Notify's typed pipeline
|
|
44
|
+
- **React Email template** — a responsive, Tailwind-styled verification email
|
|
45
|
+
- **Multi-transport** — SMTP primary + Resend fallback, configured via `.env`
|
|
46
|
+
- **Dev mode** — `npm run dev` starts a watching server with hot reload
|
|
47
|
+
|
|
48
|
+
### Project structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
my-app/
|
|
52
|
+
src/
|
|
53
|
+
server.ts # Hono app with RPC + OpenAPI routes
|
|
54
|
+
rpc.ts # oRPC router with a sendWelcome procedure
|
|
55
|
+
notify.ts # Better Notify catalog, client, and transport setup
|
|
56
|
+
emails/
|
|
57
|
+
welcome.tsx # React Email template
|
|
58
|
+
.env.example # SMTP and Resend credentials
|
|
59
|
+
package.json
|
|
60
|
+
tsconfig.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Environment variables
|
|
64
|
+
|
|
65
|
+
Copy `.env.example` to `.env` and fill in your credentials:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
SMTP_HOST=smtp.example.com
|
|
69
|
+
SMTP_PORT=587
|
|
70
|
+
SMTP_USER=
|
|
71
|
+
SMTP_PASS=
|
|
72
|
+
|
|
73
|
+
RESEND_API_KEY=
|
|
74
|
+
|
|
75
|
+
FROM_NAME=My App
|
|
76
|
+
FROM_EMAIL=hello@example.com
|
|
77
|
+
PORT=3000
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Running the project
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
cd my-app
|
|
84
|
+
npm run dev # starts tsx --watch on src/server.ts
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Open [http://localhost:3000/api/docs](http://localhost:3000/api/docs) to explore the API playground.
|
|
88
|
+
|
|
89
|
+
## Templates
|
|
90
|
+
|
|
91
|
+
| Template | Framework | RPC | Status |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| `hono-orpc` | Hono | oRPC | Available |
|
|
94
|
+
|
|
95
|
+
More templates are on the roadmap.
|
|
96
|
+
|
|
97
|
+
## Requirements
|
|
98
|
+
|
|
99
|
+
- Node.js >= 22
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -3,7 +3,8 @@ import { serve } from '@hono/node-server';
|
|
|
3
3
|
import { RPCHandler } from '@orpc/server/fetch';
|
|
4
4
|
import { OpenAPIHandler } from '@orpc/openapi/fetch';
|
|
5
5
|
import { OpenAPIReferencePlugin } from '@orpc/openapi/plugins';
|
|
6
|
-
import {
|
|
6
|
+
import { SmartCoercionPlugin } from '@orpc/json-schema';
|
|
7
|
+
import { ZodToJsonSchemaConverter } from '@orpc/zod/zod4';
|
|
7
8
|
import { router } from './rpc';
|
|
8
9
|
|
|
9
10
|
const app = new Hono();
|
|
@@ -26,7 +27,9 @@ app.use('/rpc/*', async (c, next) => {
|
|
|
26
27
|
|
|
27
28
|
const openAPIHandler = new OpenAPIHandler(router, {
|
|
28
29
|
plugins: [
|
|
29
|
-
new
|
|
30
|
+
new SmartCoercionPlugin({
|
|
31
|
+
schemaConverters: [new ZodToJsonSchemaConverter()],
|
|
32
|
+
}),
|
|
30
33
|
new OpenAPIReferencePlugin({
|
|
31
34
|
clientPath: '/docs',
|
|
32
35
|
schemaConverters: [new ZodToJsonSchemaConverter()],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-notify",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4-alpha.0",
|
|
4
4
|
"description": "Scaffold a better-notify project with your preferred framework and RPC layer.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"tsx": "4.21.0",
|
|
27
27
|
"typescript": "6.0.3",
|
|
28
28
|
"vitest": "2.1.9",
|
|
29
|
-
"@internal/
|
|
30
|
-
"@internal/
|
|
29
|
+
"@internal/rolldown-config": "0.0.0",
|
|
30
|
+
"@internal/tsconfig": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=22"
|