create-ncf 0.1.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 +145 -0
- package/dist/index.js +813 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -0
- package/templates/auth/src/app/(auth)/sign-in/page.tsx +99 -0
- package/templates/auth/src/app/(auth)/sign-up/page.tsx +118 -0
- package/templates/auth/src/app/api/auth/[...all]/route.ts +11 -0
- package/templates/auth/src/middleware.ts +74 -0
- package/templates/auth/src/server/auth/auth-client.ts +8 -0
- package/templates/auth/src/server/auth/auth.ts +77 -0
- package/templates/auth/src/server/db/schema/auth.ts +115 -0
- package/templates/base/biome.jsonc +68 -0
- package/templates/base/open-next.config.ts +3 -0
- package/templates/base/postcss.config.mjs +5 -0
- package/templates/base/src/app/layout.tsx +30 -0
- package/templates/base/src/app/page.tsx +24 -0
- package/templates/base/src/app/robots.ts +13 -0
- package/templates/base/src/app/sitemap.ts +12 -0
- package/templates/base/src/lib/utils.ts +6 -0
- package/templates/base/src/middleware.ts +9 -0
- package/templates/base/src/styles/globals.css +121 -0
- package/templates/base/tsconfig.json +37 -0
- package/templates/drizzle/drizzle.config.ts +7 -0
- package/templates/drizzle/migrations/.gitkeep +0 -0
- package/templates/drizzle/src/server/db/index.ts +9 -0
- package/templates/drizzle/src/server/db/schema/example.ts +15 -0
- package/templates/drizzle/src/server/db/schema/index.ts +1 -0
- package/templates/image-loader/src/lib/image-loader.ts +34 -0
- package/templates/posthog/instrumentation-client.ts +15 -0
- package/templates/queues/src/server/queues/handler.ts +43 -0
- package/templates/r2/src/server/services/storage.ts +53 -0
- package/templates/shadcn/components.json +22 -0
- package/templates/shadcn/src/components/ui/button.tsx +59 -0
- package/templates/shadcn/src/components/ui/card.tsx +92 -0
- package/templates/shadcn/src/components/ui/input.tsx +21 -0
- package/templates/shadcn/src/components/ui/skeleton.tsx +13 -0
- package/templates/shadcn/src/components/ui/sonner.tsx +28 -0
- package/templates/trpc/src/app/api/trpc/[trpc]/route.ts +29 -0
- package/templates/trpc/src/server/api/root.ts +10 -0
- package/templates/trpc/src/server/api/routes/example.ts +12 -0
- package/templates/trpc/src/server/api/trpc.ts +45 -0
- package/templates/trpc/src/server/api/trpc.with-auth.ts +67 -0
- package/templates/trpc/src/trpc/query-client.ts +23 -0
- package/templates/trpc/src/trpc/react.tsx +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# create-ncf
|
|
2
|
+
|
|
3
|
+
Scaffold a **Next.js 15 + Cloudflare Workers**
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun create ncf my-app
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
All features are toggleable during scaffolding:
|
|
12
|
+
|
|
13
|
+
| Feature | Description |
|
|
14
|
+
|---|---|
|
|
15
|
+
| **tRPC** | Type-safe API layer with React Query |
|
|
16
|
+
| **Drizzle ORM + D1** | Database with SQLite on Cloudflare |
|
|
17
|
+
| **better-auth** | Authentication with sign-in/sign-up pages |
|
|
18
|
+
| **Cloudflare R2** | Object storage helper |
|
|
19
|
+
| **Cloudflare Queues** | Background job processing with Worker consumer |
|
|
20
|
+
| **Cloudflare Image Loader** | Custom Next.js image loader for CF Image Transformations |
|
|
21
|
+
| **PostHog Analytics** | Product analytics |
|
|
22
|
+
| **shadcn/ui** | UI component library |
|
|
23
|
+
|
|
24
|
+
### Base stack (always included)
|
|
25
|
+
|
|
26
|
+
- Next.js 15 (App Router) + React 19 + TypeScript
|
|
27
|
+
- Tailwind CSS 4
|
|
28
|
+
- Biome (linting & formatting)
|
|
29
|
+
- OpenNext.js for Cloudflare Workers deployment
|
|
30
|
+
- Type-safe environment variables via `@t3-oss/env-nextjs`
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# With bun
|
|
36
|
+
bun create ncf my-app
|
|
37
|
+
|
|
38
|
+
# With npm
|
|
39
|
+
npx create-ncf my-app
|
|
40
|
+
|
|
41
|
+
# Pass project name directly
|
|
42
|
+
bun create ncf my-app
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The CLI will prompt you to select features, then scaffold the project, install dependencies, and initialize a git repository.
|
|
46
|
+
|
|
47
|
+
## After scaffolding
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cd my-app
|
|
51
|
+
cp .env.example .env.local
|
|
52
|
+
# Edit .env.local with your values
|
|
53
|
+
bun run dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Cloudflare setup
|
|
57
|
+
|
|
58
|
+
Depending on which features you selected:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# D1 Database (if Drizzle selected)
|
|
62
|
+
wrangler d1 create my-app
|
|
63
|
+
# Update wrangler.jsonc with your database_id
|
|
64
|
+
bun run db:generate
|
|
65
|
+
bun run db:migrate
|
|
66
|
+
|
|
67
|
+
# R2 Bucket (if R2 selected)
|
|
68
|
+
wrangler r2 bucket create my-app
|
|
69
|
+
|
|
70
|
+
# Queues (if Queues selected)
|
|
71
|
+
wrangler queues create my-app
|
|
72
|
+
wrangler queues create my-app-dlq
|
|
73
|
+
|
|
74
|
+
# Image Loader — enable Image Transformations on your zone:
|
|
75
|
+
# Cloudflare Dashboard → Speed → Image Transformations → Enable
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Deploy
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bun run deploy
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Project structure (scaffolded output)
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
my-app/
|
|
88
|
+
├── src/
|
|
89
|
+
│ ├── app/ # Next.js App Router pages
|
|
90
|
+
│ ├── components/ui/ # shadcn/ui components (if selected)
|
|
91
|
+
│ ├── lib/ # Utilities (cn, image-loader)
|
|
92
|
+
│ ├── server/
|
|
93
|
+
│ │ ├── api/ # tRPC routers (if selected)
|
|
94
|
+
│ │ ├── auth/ # better-auth setup (if selected)
|
|
95
|
+
│ │ ├── db/ # Drizzle ORM + schema (if selected)
|
|
96
|
+
│ │ ├── queues/ # Queue handler (if selected)
|
|
97
|
+
│ │ └── services/ # R2 storage helper (if selected)
|
|
98
|
+
│ ├── trpc/ # tRPC React client (if selected)
|
|
99
|
+
│ ├── styles/globals.css
|
|
100
|
+
│ ├── env.js # Type-safe env validation
|
|
101
|
+
│ └── middleware.ts
|
|
102
|
+
├── worker.ts # Cloudflare Worker entry point
|
|
103
|
+
├── wrangler.jsonc # Cloudflare Workers config
|
|
104
|
+
├── next.config.ts
|
|
105
|
+
├── open-next.config.ts
|
|
106
|
+
├── drizzle.config.ts # (if Drizzle selected)
|
|
107
|
+
├── biome.jsonc
|
|
108
|
+
├── tsconfig.json
|
|
109
|
+
└── package.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Scripts
|
|
113
|
+
|
|
114
|
+
| Script | Description |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `bun run dev` | Start dev server with Turbopack |
|
|
117
|
+
| `bun run build` | Build for production |
|
|
118
|
+
| `bun run deploy` | Build & deploy to Cloudflare Workers |
|
|
119
|
+
| `bun run preview` | Build & preview locally |
|
|
120
|
+
| `bun run check` | Lint with Biome |
|
|
121
|
+
| `bun run check:write` | Auto-fix lint issues |
|
|
122
|
+
| `bun run cf-typegen` | Regenerate Cloudflare env types |
|
|
123
|
+
| `bun run db:generate` | Generate Drizzle migrations |
|
|
124
|
+
| `bun run db:migrate` | Apply migrations locally |
|
|
125
|
+
| `bun run db:migrate-remote` | Apply migrations to remote D1 |
|
|
126
|
+
|
|
127
|
+
## Development (CLI itself)
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Install dependencies
|
|
131
|
+
bun install
|
|
132
|
+
|
|
133
|
+
# Build the CLI
|
|
134
|
+
bun run build
|
|
135
|
+
|
|
136
|
+
# Test locally
|
|
137
|
+
node dist/index.js my-test-app
|
|
138
|
+
|
|
139
|
+
# Watch mode
|
|
140
|
+
bun run dev
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|