create-cfast 0.0.1
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/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/index.js +681 -0
- package/package.json +37 -0
- package/templates/admin/app/admin.server.ts +87 -0
- package/templates/admin/app/routes/admin.tsx +18 -0
- package/templates/admin/package.json +6 -0
- package/templates/auth/app/auth.client.ts +6 -0
- package/templates/auth/app/auth.helpers.server.ts +35 -0
- package/templates/auth/app/auth.setup.server.ts +17 -0
- package/templates/auth/app/db/schema.ts +106 -0
- package/templates/auth/app/routes/auth.$.tsx +10 -0
- package/templates/auth/app/routes/login.tsx +25 -0
- package/templates/auth/package.json +8 -0
- package/templates/base/_gitignore +14 -0
- package/templates/base/app/entry.server.tsx +38 -0
- package/templates/base/app/permissions.ts +32 -0
- package/templates/base/app/routes/_index.tsx +8 -0
- package/templates/base/package.json +32 -0
- package/templates/base/react-router.config.ts +8 -0
- package/templates/base/tsconfig.cloudflare.json +26 -0
- package/templates/base/tsconfig.json +14 -0
- package/templates/base/tsconfig.node.json +13 -0
- package/templates/base/workers/app.ts +29 -0
- package/templates/db/app/db/client.ts +8 -0
- package/templates/db/app/db/schema.ts +9 -0
- package/templates/db/drizzle.config.ts +7 -0
- package/templates/db/package.json +14 -0
- package/templates/email/app/email/send.ts +10 -0
- package/templates/email/app/email/templates/welcome.tsx +19 -0
- package/templates/email/app/email.server.ts +33 -0
- package/templates/email/package.json +6 -0
- package/templates/storage/package.json +5 -0
- package/templates/ui/app/actions.server.ts +12 -0
- package/templates/ui/app/components/Header.tsx +30 -0
- package/templates/ui/package.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Schmidt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# create-cfast
|
|
2
|
+
|
|
3
|
+
**Scaffold a fully wired Cloudflare Workers + React Router project in one command.**
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm create cfast@latest my-app
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
No boilerplate. No copy-pasting API keys into the wrong file. No figuring out how to wire Drizzle to D1. The scaffolder asks you what you need, sets up every package, and gives you a running app with auth, permissions, and email working out of the box.
|
|
10
|
+
|
|
11
|
+
## What It Does
|
|
12
|
+
|
|
13
|
+
### Interactive Setup
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ npm create cfast@latest my-app
|
|
17
|
+
|
|
18
|
+
Welcome to cfast!
|
|
19
|
+
|
|
20
|
+
Project name: my-app
|
|
21
|
+
|
|
22
|
+
Which packages do you need?
|
|
23
|
+
[x] @cfast/auth - Authentication (magic email + passkeys)
|
|
24
|
+
[x] @cfast/permissions - Permission system
|
|
25
|
+
[x] @cfast/db - D1 database with Drizzle
|
|
26
|
+
[x] @cfast/ui - Auto-forms and permission-aware components
|
|
27
|
+
[ ] @cfast/admin - Admin panel
|
|
28
|
+
[x] @cfast/email - Email via Mailgun
|
|
29
|
+
[x] @cfast/router - Multi-action routes & pagination
|
|
30
|
+
|
|
31
|
+
UI library:
|
|
32
|
+
(*) MUI Joy UI
|
|
33
|
+
( ) Headless (bring your own)
|
|
34
|
+
|
|
35
|
+
Let's set up your API keys.
|
|
36
|
+
We'll configure these per environment (dev / staging / production).
|
|
37
|
+
|
|
38
|
+
Mailgun API Key (dev): ****
|
|
39
|
+
Mailgun domain (dev): sandbox1234.mailgun.org
|
|
40
|
+
Mailgun API Key (production): **** (or press Enter to set later)
|
|
41
|
+
Mailgun domain (production): mail.myapp.com
|
|
42
|
+
|
|
43
|
+
Cloudflare Account ID: ****
|
|
44
|
+
|
|
45
|
+
Creating project...
|
|
46
|
+
Installing dependencies...
|
|
47
|
+
Setting up wrangler.toml...
|
|
48
|
+
Generating Drizzle schema...
|
|
49
|
+
Creating example routes...
|
|
50
|
+
|
|
51
|
+
Done! Next steps:
|
|
52
|
+
cd my-app
|
|
53
|
+
pnpm dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### What You Get
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
my-app/
|
|
60
|
+
├── app/
|
|
61
|
+
│ ├── routes/
|
|
62
|
+
│ │ ├── _index.tsx # Home page
|
|
63
|
+
│ │ ├── login.tsx # Magic link + passkey login
|
|
64
|
+
│ │ └── dashboard.tsx # Authenticated route example
|
|
65
|
+
│ ├── db/
|
|
66
|
+
│ │ ├── schema.ts # Drizzle schema with auth tables
|
|
67
|
+
│ │ └── migrations/ # D1 migrations
|
|
68
|
+
│ ├── auth.ts # @cfast/auth config
|
|
69
|
+
│ ├── permissions.ts # @cfast/permissions definitions
|
|
70
|
+
│ └── emails/
|
|
71
|
+
│ ├── magic-link.tsx # react-email template
|
|
72
|
+
│ └── welcome.tsx # react-email template
|
|
73
|
+
├── wrangler.toml # Pre-configured with D1, KV bindings
|
|
74
|
+
├── .dev.vars # Local development secrets
|
|
75
|
+
├── .env.staging # Staging API keys
|
|
76
|
+
├── .env.production # Production API keys (empty, fill in later)
|
|
77
|
+
├── drizzle.config.ts # Drizzle Kit config for D1
|
|
78
|
+
├── package.json
|
|
79
|
+
└── tsconfig.json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Environment-Aware Secrets
|
|
83
|
+
|
|
84
|
+
The scaffolder creates separate secret files per environment and configures wrangler to use them:
|
|
85
|
+
|
|
86
|
+
- `.dev.vars` — Local development (Mailgun sandbox, etc.)
|
|
87
|
+
- `.env.staging` — Staging environment keys
|
|
88
|
+
- `.env.production` — Production keys (created empty with comments about what's needed)
|
|
89
|
+
|
|
90
|
+
All secret files are added to `.gitignore` automatically.
|
|
91
|
+
|
|
92
|
+
### Working Examples
|
|
93
|
+
|
|
94
|
+
The generated project includes working examples of:
|
|
95
|
+
|
|
96
|
+
- **Magic link authentication** — Send a magic link, verify it, create a session
|
|
97
|
+
- **Passkey registration and login** — Full WebAuthn flow
|
|
98
|
+
- **Permission-guarded routes** — Loader that requires authentication
|
|
99
|
+
- **Multi-action route** — Create and delete in the same page
|
|
100
|
+
- **Auto-generated form** — Form derived from the Drizzle schema
|
|
101
|
+
- **Email sending** — Welcome email sent after registration
|
|
102
|
+
|
|
103
|
+
### Post-Scaffold Commands
|
|
104
|
+
|
|
105
|
+
After scaffolding, you can:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pnpm dev # Start local development (wrangler + react-email preview)
|
|
109
|
+
pnpm db:generate # Generate D1 migrations from schema changes
|
|
110
|
+
pnpm db:migrate:local # Apply migrations to local D1
|
|
111
|
+
pnpm db:migrate:remote # Apply migrations to remote D1
|
|
112
|
+
pnpm deploy:staging # Deploy to staging
|
|
113
|
+
pnpm deploy:production # Deploy to production
|
|
114
|
+
```
|