create-velox-app 0.6.31 → 0.6.51
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/CHANGELOG.md +120 -0
- package/GUIDE.md +230 -0
- package/dist/cli.js +1 -0
- package/dist/index.js +14 -4
- package/dist/templates/auth.js +10 -0
- package/dist/templates/index.js +30 -1
- package/dist/templates/placeholders.js +0 -3
- package/dist/templates/rsc-auth.d.ts +12 -0
- package/dist/templates/rsc-auth.js +208 -0
- package/dist/templates/rsc.js +40 -1
- package/dist/templates/shared/css-generator.d.ts +26 -0
- package/dist/templates/shared/css-generator.js +553 -0
- package/dist/templates/shared/index.d.ts +3 -0
- package/dist/templates/shared/index.js +3 -0
- package/dist/templates/shared/rsc-styles.d.ts +54 -0
- package/dist/templates/shared/rsc-styles.js +68 -0
- package/dist/templates/shared/theme.d.ts +133 -0
- package/dist/templates/shared/theme.js +141 -0
- package/dist/templates/spa.js +10 -0
- package/dist/templates/trpc.js +10 -0
- package/dist/templates/types.d.ts +2 -1
- package/dist/templates/types.js +6 -0
- package/package.json +6 -3
- package/src/templates/source/api/config/database.ts +13 -32
- package/src/templates/source/api/docker-compose.yml +21 -0
- package/src/templates/source/root/CLAUDE.auth.md +6 -0
- package/src/templates/source/root/CLAUDE.default.md +6 -0
- package/src/templates/source/rsc/CLAUDE.md +56 -2
- package/src/templates/source/rsc/app/actions/posts.ts +1 -1
- package/src/templates/source/rsc/app/actions/users.ts +111 -20
- package/src/templates/source/rsc/app/layouts/dashboard.tsx +21 -16
- package/src/templates/source/rsc/app/layouts/marketing.tsx +34 -0
- package/src/templates/source/rsc/app/layouts/minimal-content.tsx +21 -0
- package/src/templates/source/rsc/app/layouts/minimal.tsx +86 -5
- package/src/templates/source/rsc/app/layouts/root.tsx +148 -44
- package/src/templates/source/rsc/docker-compose.yml +21 -0
- package/src/templates/source/rsc/package.json +3 -3
- package/src/templates/source/rsc/src/api/database.ts +13 -32
- package/src/templates/source/rsc/src/api/handler.ts +1 -1
- package/src/templates/source/rsc/src/entry.client.tsx +65 -18
- package/src/templates/source/rsc-auth/CLAUDE.md +230 -0
- package/src/templates/source/rsc-auth/app/actions/auth.ts +112 -0
- package/src/templates/source/rsc-auth/app/actions/users.ts +289 -0
- package/src/templates/source/rsc-auth/app/layouts/dashboard.tsx +132 -0
- package/src/templates/source/rsc-auth/app/layouts/marketing.tsx +59 -0
- package/src/templates/source/rsc-auth/app/layouts/minimal-content.tsx +21 -0
- package/src/templates/source/rsc-auth/app/layouts/minimal.tsx +111 -0
- package/src/templates/source/rsc-auth/app/layouts/root.tsx +355 -0
- package/src/templates/source/rsc-auth/app/pages/_not-found.tsx +15 -0
- package/src/templates/source/rsc-auth/app/pages/auth/login.tsx +198 -0
- package/src/templates/source/rsc-auth/app/pages/auth/register.tsx +225 -0
- package/src/templates/source/rsc-auth/app/pages/dashboard/index.tsx +267 -0
- package/src/templates/source/rsc-auth/app/pages/index.tsx +83 -0
- package/src/templates/source/rsc-auth/app/pages/users.tsx +47 -0
- package/src/templates/source/rsc-auth/app.config.ts +12 -0
- package/src/templates/source/rsc-auth/docker-compose.yml +21 -0
- package/src/templates/source/rsc-auth/env.example +11 -0
- package/src/templates/source/rsc-auth/gitignore +34 -0
- package/src/templates/source/rsc-auth/package.json +44 -0
- package/src/templates/source/rsc-auth/prisma/schema.prisma +23 -0
- package/src/templates/source/rsc-auth/prisma.config.ts +22 -0
- package/src/templates/source/rsc-auth/public/favicon.svg +4 -0
- package/src/templates/source/rsc-auth/src/api/database.ts +129 -0
- package/src/templates/source/rsc-auth/src/api/handler.ts +85 -0
- package/src/templates/source/rsc-auth/src/api/procedures/auth.ts +262 -0
- package/src/templates/source/rsc-auth/src/api/procedures/health.ts +48 -0
- package/src/templates/source/rsc-auth/src/api/procedures/users.ts +87 -0
- package/src/templates/source/rsc-auth/src/api/schemas/auth.ts +79 -0
- package/src/templates/source/rsc-auth/src/api/schemas/user.ts +38 -0
- package/src/templates/source/rsc-auth/src/api/utils/auth.ts +157 -0
- package/src/templates/source/rsc-auth/src/entry.client.tsx +63 -0
- package/src/templates/source/rsc-auth/src/entry.server.tsx +262 -0
- package/src/templates/source/rsc-auth/tsconfig.json +24 -0
- package/src/templates/source/shared/scripts/check-client-imports.sh +75 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
# create-velox-app
|
|
2
2
|
|
|
3
|
+
## 0.6.51
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(web): configure @vinxi/server-functions for RSC server actions
|
|
8
|
+
|
|
9
|
+
## 0.6.50
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- lint fixed
|
|
14
|
+
|
|
15
|
+
## 0.6.49
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- feat(create): add client import lint script for RSC templates
|
|
20
|
+
|
|
21
|
+
## 0.6.48
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- fix(web): remove server-only guards incompatible with Vite SS
|
|
26
|
+
|
|
27
|
+
## 0.6.47
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- fix(web): use /adapters for createH3ApiHandler to avoid server-only
|
|
32
|
+
|
|
33
|
+
## 0.6.46
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- fix(web): remove transitive server-only import from main entry
|
|
38
|
+
|
|
39
|
+
## 0.6.45
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- fix(web): remove server-only guard from main entry for Vinxi compat
|
|
44
|
+
|
|
45
|
+
## 0.6.44
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- refactor(web): implement proper RSC server/client separation
|
|
50
|
+
|
|
51
|
+
## 0.6.43
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- fix(web): exclude native modules from Vite dependency optimization
|
|
56
|
+
|
|
57
|
+
## 0.6.42
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- fix(web): enable tsconfig path aliases for Vite/Vinxi + docs(web): add @public/@internal JSDoc annotations to server actions
|
|
62
|
+
|
|
63
|
+
## 0.6.41
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- feat(web): add authAction helper for procedure bridge authentication
|
|
68
|
+
|
|
69
|
+
## 0.6.40
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- feat(create): consolidate template styles with unified dark mode design
|
|
74
|
+
|
|
75
|
+
## 0.6.39
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- fix RSC client hydration with split layout architecture
|
|
80
|
+
|
|
81
|
+
## 0.6.38
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- fix client hydration for RSC templates
|
|
86
|
+
|
|
87
|
+
## 0.6.37
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- feat(web): add validated() helper for secure server actions & add rsc-auth template with validated()
|
|
92
|
+
|
|
93
|
+
## 0.6.36
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Gap Remediation Plan
|
|
98
|
+
|
|
99
|
+
## 0.6.35
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- proper auth template testing in verify-publis
|
|
104
|
+
|
|
105
|
+
## 0.6.34
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- update PostgreSQL adapter for Prisma 7 API
|
|
110
|
+
|
|
111
|
+
## 0.6.33
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- changed claude.md instruction, added prisma config
|
|
116
|
+
|
|
117
|
+
## 0.6.32
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Introducing new Ecosystem Expansion packages: cache, queue, mail, storage, scheduler, events. Do not use yet
|
|
122
|
+
|
|
3
123
|
## 0.6.31
|
|
4
124
|
|
|
5
125
|
### Patch Changes
|
package/GUIDE.md
CHANGED
|
@@ -53,6 +53,236 @@ curl -X POST http://localhost:3030/api/users \
|
|
|
53
53
|
-d '{"name": "Alice", "email": "alice@example.com"}'
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
## Post-Publish Verification
|
|
57
|
+
|
|
58
|
+
The `verify-publish.sh` script tests actual published npm packages to ensure they work correctly after publishing. Unlike the smoke test (which uses local `file:` references), this script downloads packages from npm and validates the complete user experience.
|
|
59
|
+
|
|
60
|
+
### When to Use
|
|
61
|
+
|
|
62
|
+
- **After publishing** to npm to verify packages work correctly
|
|
63
|
+
- **Before major releases** to test all template/database combinations
|
|
64
|
+
- **With Verdaccio** to test packages locally before publishing to npm
|
|
65
|
+
- **In CI/CD** as a post-publish validation step
|
|
66
|
+
|
|
67
|
+
### Prerequisites
|
|
68
|
+
|
|
69
|
+
- Node.js 20+
|
|
70
|
+
- npm
|
|
71
|
+
- curl
|
|
72
|
+
- Docker (optional, for PostgreSQL runtime tests)
|
|
73
|
+
|
|
74
|
+
### Basic Usage
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd packages/create
|
|
78
|
+
|
|
79
|
+
# Test latest published version (spa + sqlite)
|
|
80
|
+
pnpm verify-publish
|
|
81
|
+
|
|
82
|
+
# Test specific version
|
|
83
|
+
pnpm verify-publish 0.6.34
|
|
84
|
+
|
|
85
|
+
# Test from local Verdaccio registry
|
|
86
|
+
pnpm verify-publish --registry http://localhost:4873
|
|
87
|
+
|
|
88
|
+
# Test specific template
|
|
89
|
+
pnpm verify-publish --template auth
|
|
90
|
+
|
|
91
|
+
# Test specific database (Docker auto-enabled for postgresql)
|
|
92
|
+
pnpm verify-publish --database postgresql
|
|
93
|
+
|
|
94
|
+
# Test specific combination
|
|
95
|
+
pnpm verify-publish --template auth --database sqlite
|
|
96
|
+
|
|
97
|
+
# Test all combinations (full matrix)
|
|
98
|
+
pnpm verify-publish --all
|
|
99
|
+
|
|
100
|
+
# Keep test projects for inspection
|
|
101
|
+
pnpm verify-publish --keep
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Command Line Options
|
|
105
|
+
|
|
106
|
+
| Option | Description | Default |
|
|
107
|
+
|--------|-------------|---------|
|
|
108
|
+
| `VERSION` | Package version to test | `latest` |
|
|
109
|
+
| `--registry URL` | npm registry URL | `https://registry.npmjs.org` |
|
|
110
|
+
| `--template NAME` | Template to test (`spa`, `auth`, `trpc`, `rsc`) | `spa` |
|
|
111
|
+
| `--database NAME` | Database to test (`sqlite`, `postgresql`) | `sqlite` |
|
|
112
|
+
| `--all` | Test all template/database combinations | `false` |
|
|
113
|
+
| `--docker` | Force Docker (auto-enabled for postgresql) | `false` |
|
|
114
|
+
| `--keep` | Keep test projects after completion | `false` |
|
|
115
|
+
| `--help` | Show help message | - |
|
|
116
|
+
|
|
117
|
+
### What Gets Tested
|
|
118
|
+
|
|
119
|
+
For each template/database combination, the script validates:
|
|
120
|
+
|
|
121
|
+
1. **Project Creation** - `npx create-velox-app` succeeds
|
|
122
|
+
2. **Project Structure** - Required files exist (package.json, prisma.config.ts, schema.prisma, docker-compose.yml for PostgreSQL)
|
|
123
|
+
3. **Dependency Installation** - `npm install` succeeds
|
|
124
|
+
4. **Prisma Generation** - `npm run db:generate` succeeds
|
|
125
|
+
5. **Build** - `npm run build` (or `npm run -w api build` for monorepo) succeeds
|
|
126
|
+
6. **Database Setup** - `npm run db:push` succeeds (SQLite direct, PostgreSQL via Docker)
|
|
127
|
+
7. **Runtime Endpoints** (all databases - Docker auto-enabled for PostgreSQL):
|
|
128
|
+
- `GET /api/health` → 200
|
|
129
|
+
- `GET /api/users` → 200
|
|
130
|
+
- `POST /api/users` → 201
|
|
131
|
+
- `GET /api/users/:id` → 200
|
|
132
|
+
- `DELETE /api/users/:id` → 200
|
|
133
|
+
- Auth template also tests `/auth/register` and `/auth/login`
|
|
134
|
+
|
|
135
|
+
### Examples
|
|
136
|
+
|
|
137
|
+
#### Quick Sanity Check
|
|
138
|
+
```bash
|
|
139
|
+
# Test default template with SQLite (fastest)
|
|
140
|
+
pnpm verify-publish
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
#### Test Specific Version from npm
|
|
144
|
+
```bash
|
|
145
|
+
pnpm verify-publish 0.6.31
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Test with Local Verdaccio Before Publishing
|
|
149
|
+
```bash
|
|
150
|
+
# 1. Start Verdaccio
|
|
151
|
+
npx verdaccio
|
|
152
|
+
|
|
153
|
+
# 2. Publish packages to Verdaccio
|
|
154
|
+
pnpm publish --registry http://localhost:4873 --no-git-checks
|
|
155
|
+
|
|
156
|
+
# 3. Verify the published packages
|
|
157
|
+
pnpm verify-publish --registry http://localhost:4873
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Full Matrix Test
|
|
161
|
+
```bash
|
|
162
|
+
# Test all 8 combinations (4 templates × 2 databases)
|
|
163
|
+
# Docker auto-enabled for PostgreSQL runtime tests
|
|
164
|
+
pnpm verify-publish --all
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### PostgreSQL (Docker Auto-Enabled)
|
|
168
|
+
```bash
|
|
169
|
+
# Docker automatically starts for PostgreSQL runtime tests
|
|
170
|
+
pnpm verify-publish --template spa --database postgresql
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Debug Failed Tests
|
|
174
|
+
```bash
|
|
175
|
+
# Keep projects for manual inspection
|
|
176
|
+
pnpm verify-publish --template auth --keep
|
|
177
|
+
|
|
178
|
+
# Projects saved to /tmp/velox-publish-verify-XXXX/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Understanding Output
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
=== Post-Publish Verification ===
|
|
185
|
+
Registry: https://registry.npmjs.org
|
|
186
|
+
Version: 0.6.34
|
|
187
|
+
Templates: spa auth trpc rsc
|
|
188
|
+
Databases: sqlite postgresql
|
|
189
|
+
|
|
190
|
+
=== Testing: spa + sqlite ===
|
|
191
|
+
✓ Project created
|
|
192
|
+
✓ Project structure verified
|
|
193
|
+
✓ Dependencies installed
|
|
194
|
+
✓ Prisma client generated
|
|
195
|
+
✓ Build successful
|
|
196
|
+
✓ Database schema pushed
|
|
197
|
+
✓ Server started
|
|
198
|
+
✓ GET /api/health (200)
|
|
199
|
+
✓ GET /api/users (200)
|
|
200
|
+
✓ POST /api/users (201)
|
|
201
|
+
✓ GET /api/users/:id (200)
|
|
202
|
+
✓ DELETE /api/users/:id (200)
|
|
203
|
+
✓ All endpoint tests passed
|
|
204
|
+
|
|
205
|
+
=== Verification Summary ===
|
|
206
|
+
Passed: 1
|
|
207
|
+
Failed: 0
|
|
208
|
+
Skipped: 0
|
|
209
|
+
|
|
210
|
+
All verifications passed!
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Exit Codes
|
|
214
|
+
|
|
215
|
+
| Code | Meaning |
|
|
216
|
+
|------|---------|
|
|
217
|
+
| 0 | All tests passed |
|
|
218
|
+
| 1 | One or more tests failed |
|
|
219
|
+
|
|
220
|
+
### Troubleshooting
|
|
221
|
+
|
|
222
|
+
#### "No matching version found"
|
|
223
|
+
The specified version doesn't exist on the registry:
|
|
224
|
+
```bash
|
|
225
|
+
# Check available versions
|
|
226
|
+
npm view create-velox-app versions --registry http://localhost:4873
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Docker Not Running
|
|
230
|
+
PostgreSQL tests require Docker to be running:
|
|
231
|
+
```bash
|
|
232
|
+
# Start Docker Desktop or daemon first, then run:
|
|
233
|
+
pnpm verify-publish --database postgresql
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### Port Already in Use
|
|
237
|
+
The script uses random ports (3030-4030), but conflicts can occur:
|
|
238
|
+
```bash
|
|
239
|
+
# Kill processes on common ports
|
|
240
|
+
lsof -ti :3030 | xargs kill -9
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### Inspect Failed Project
|
|
244
|
+
```bash
|
|
245
|
+
# Keep the test project
|
|
246
|
+
pnpm verify-publish --template auth --keep
|
|
247
|
+
|
|
248
|
+
# Navigate to it
|
|
249
|
+
cd /tmp/velox-publish-verify-XXXXX/test-auth-sqlite
|
|
250
|
+
|
|
251
|
+
# Manually debug
|
|
252
|
+
npm run dev
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### CI/CD Integration
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
# GitHub Actions example
|
|
259
|
+
verify-publish:
|
|
260
|
+
runs-on: ubuntu-latest
|
|
261
|
+
needs: publish
|
|
262
|
+
steps:
|
|
263
|
+
- uses: actions/checkout@v4
|
|
264
|
+
- uses: pnpm/action-setup@v2
|
|
265
|
+
- uses: actions/setup-node@v4
|
|
266
|
+
with:
|
|
267
|
+
node-version: '20'
|
|
268
|
+
|
|
269
|
+
- name: Verify published packages
|
|
270
|
+
run: |
|
|
271
|
+
cd packages/create
|
|
272
|
+
./scripts/verify-publish.sh ${{ needs.publish.outputs.version }}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Comparison: smoke-test vs verify-publish
|
|
276
|
+
|
|
277
|
+
| Aspect | smoke-test | verify-publish |
|
|
278
|
+
|--------|------------|----------------|
|
|
279
|
+
| **Purpose** | Pre-publish validation | Post-publish validation |
|
|
280
|
+
| **Package Source** | Local `file:` references | npm registry |
|
|
281
|
+
| **Speed** | Faster (no npm download) | Slower (full npm install) |
|
|
282
|
+
| **When to Run** | Before publishing | After publishing |
|
|
283
|
+
| **Matrix Testing** | Single template | All combinations |
|
|
284
|
+
| **Docker Support** | No | Auto (PostgreSQL) |
|
|
285
|
+
|
|
56
286
|
## Learn More
|
|
57
287
|
|
|
58
288
|
See [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox) for complete documentation.
|
package/dist/cli.js
CHANGED
|
@@ -47,6 +47,7 @@ Templates:
|
|
|
47
47
|
auth ${TEMPLATE_METADATA.auth.description}
|
|
48
48
|
trpc ${TEMPLATE_METADATA.trpc.description}
|
|
49
49
|
rsc ${TEMPLATE_METADATA.rsc.description}
|
|
50
|
+
rsc-auth ${TEMPLATE_METADATA['rsc-auth'].description}
|
|
50
51
|
|
|
51
52
|
Databases:
|
|
52
53
|
sqlite ${DATABASE_METADATA.sqlite.hint}
|
package/dist/index.js
CHANGED
|
@@ -356,8 +356,10 @@ async function generatePrismaClient(config) {
|
|
|
356
356
|
color: 'cyan',
|
|
357
357
|
}).start();
|
|
358
358
|
try {
|
|
359
|
-
// RSC
|
|
360
|
-
const prismaDir = config.template === 'rsc'
|
|
359
|
+
// RSC templates have Prisma in root, others in apps/api
|
|
360
|
+
const prismaDir = config.template === 'rsc' || config.template === 'rsc-auth'
|
|
361
|
+
? config.directory
|
|
362
|
+
: path.join(config.directory, 'apps', 'api');
|
|
361
363
|
await execAsync('npx prisma generate', {
|
|
362
364
|
cwd: prismaDir,
|
|
363
365
|
timeout: EXEC_TIMEOUT_MS,
|
|
@@ -422,11 +424,14 @@ function printSuccessMessage(config) {
|
|
|
422
424
|
console.log(pc.green(` Success! Created ${pc.bold(config.name)} with ${config.template} template`));
|
|
423
425
|
console.log('');
|
|
424
426
|
// Different structure messages based on template
|
|
425
|
-
if (config.template === 'rsc') {
|
|
427
|
+
if (config.template === 'rsc' || config.template === 'rsc-auth') {
|
|
426
428
|
console.log(pc.dim(' Full-stack RSC application with:'));
|
|
427
429
|
console.log(pc.dim(' app/pages - React Server Components (file-based routing)'));
|
|
428
430
|
console.log(pc.dim(' app/actions - Server actions'));
|
|
429
431
|
console.log(pc.dim(' src/api - Embedded Fastify API at /api/*'));
|
|
432
|
+
if (config.template === 'rsc-auth') {
|
|
433
|
+
console.log(pc.dim(' src/api/utils/auth.ts - JWT authentication helpers'));
|
|
434
|
+
}
|
|
430
435
|
}
|
|
431
436
|
else {
|
|
432
437
|
console.log(pc.dim(' Full-stack workspace with:'));
|
|
@@ -445,7 +450,7 @@ function printSuccessMessage(config) {
|
|
|
445
450
|
console.log(` ${pc.cyan(devCommand)}${pc.dim(' # Start dev servers')}`);
|
|
446
451
|
console.log('');
|
|
447
452
|
// Different URL messages based on template
|
|
448
|
-
if (config.template === 'rsc') {
|
|
453
|
+
if (config.template === 'rsc' || config.template === 'rsc-auth') {
|
|
449
454
|
console.log(' Your app will be available at:');
|
|
450
455
|
console.log(` ${pc.cyan('http://localhost:3030')}${pc.dim(' # Full-stack app')}`);
|
|
451
456
|
console.log(` ${pc.cyan('http://localhost:3030/api/*')}${pc.dim(' # API routes')}`);
|
|
@@ -460,5 +465,10 @@ function printSuccessMessage(config) {
|
|
|
460
465
|
console.log('');
|
|
461
466
|
console.log(pc.yellow(' Note: Set JWT_SECRET and JWT_REFRESH_SECRET in apps/api/.env for production'));
|
|
462
467
|
}
|
|
468
|
+
// RSC-Auth template specific message
|
|
469
|
+
if (config.template === 'rsc-auth') {
|
|
470
|
+
console.log('');
|
|
471
|
+
console.log(pc.yellow(' Note: Set JWT_SECRET and JWT_REFRESH_SECRET in .env for production'));
|
|
472
|
+
}
|
|
463
473
|
console.log('');
|
|
464
474
|
}
|
package/dist/templates/auth.js
CHANGED
|
@@ -77,6 +77,9 @@ function generateApiTypesDts() {
|
|
|
77
77
|
function generateAuthUtils() {
|
|
78
78
|
return compileTemplate('api/utils/auth.ts', AUTH_CONFIG);
|
|
79
79
|
}
|
|
80
|
+
function generateDockerCompose(config) {
|
|
81
|
+
return compileTemplate('api/docker-compose.yml', config);
|
|
82
|
+
}
|
|
80
83
|
// ============================================================================
|
|
81
84
|
// Auth Template Generator
|
|
82
85
|
// ============================================================================
|
|
@@ -108,6 +111,13 @@ export function generateAuthTemplate(config) {
|
|
|
108
111
|
{ path: 'apps/api/src/types.d.ts', content: generateApiTypesDts() },
|
|
109
112
|
{ path: 'apps/api/src/utils/auth.ts', content: generateAuthUtils() },
|
|
110
113
|
];
|
|
114
|
+
// Add docker-compose for PostgreSQL
|
|
115
|
+
if (config.database === 'postgresql') {
|
|
116
|
+
files.push({
|
|
117
|
+
path: 'apps/api/docker-compose.yml',
|
|
118
|
+
content: generateDockerCompose(config),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
111
121
|
// Add root workspace files
|
|
112
122
|
const rootFiles = generateRootFiles(config, true);
|
|
113
123
|
// Add web package files (with auth UI)
|
package/dist/templates/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { generateAuthTemplate } from './auth.js';
|
|
7
7
|
import { generateRscTemplate } from './rsc.js';
|
|
8
|
+
import { generateRscAuthTemplate } from './rsc-auth.js';
|
|
8
9
|
import { VELOXTS_VERSION } from './shared.js';
|
|
9
10
|
import { generateSpaTemplate } from './spa.js';
|
|
10
11
|
import { generateTrpcTemplate } from './trpc.js';
|
|
@@ -28,6 +29,8 @@ export function generateTemplateFiles(config) {
|
|
|
28
29
|
return generateTrpcTemplate(config);
|
|
29
30
|
case 'rsc':
|
|
30
31
|
return generateRscTemplate(config);
|
|
32
|
+
case 'rsc-auth':
|
|
33
|
+
return generateRscAuthTemplate(config);
|
|
31
34
|
case 'spa':
|
|
32
35
|
return generateSpaTemplate(config);
|
|
33
36
|
default: {
|
|
@@ -41,7 +44,7 @@ export function generateTemplateFiles(config) {
|
|
|
41
44
|
* Get directories that need to be created for the template
|
|
42
45
|
*/
|
|
43
46
|
export function getTemplateDirectories(template) {
|
|
44
|
-
// RSC
|
|
47
|
+
// RSC templates have a different structure (single-package, not monorepo)
|
|
45
48
|
if (template === 'rsc') {
|
|
46
49
|
return [
|
|
47
50
|
// App layer (RSC)
|
|
@@ -58,6 +61,32 @@ export function getTemplateDirectories(template) {
|
|
|
58
61
|
'prisma',
|
|
59
62
|
// Public assets
|
|
60
63
|
'public',
|
|
64
|
+
// Scripts
|
|
65
|
+
'scripts',
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
// RSC with Auth has additional directories for auth pages and utils
|
|
69
|
+
if (template === 'rsc-auth') {
|
|
70
|
+
return [
|
|
71
|
+
// App layer (RSC)
|
|
72
|
+
'app',
|
|
73
|
+
'app/pages',
|
|
74
|
+
'app/pages/auth',
|
|
75
|
+
'app/pages/dashboard',
|
|
76
|
+
'app/layouts',
|
|
77
|
+
'app/actions',
|
|
78
|
+
// Source layer
|
|
79
|
+
'src',
|
|
80
|
+
'src/api',
|
|
81
|
+
'src/api/procedures',
|
|
82
|
+
'src/api/schemas',
|
|
83
|
+
'src/api/utils',
|
|
84
|
+
// Prisma
|
|
85
|
+
'prisma',
|
|
86
|
+
// Public assets
|
|
87
|
+
'public',
|
|
88
|
+
// Scripts
|
|
89
|
+
'scripts',
|
|
61
90
|
];
|
|
62
91
|
}
|
|
63
92
|
// Workspace-based directory structure (default, auth, trpc)
|
|
@@ -96,7 +96,6 @@ function getWsApiCommand(packageManager) {
|
|
|
96
96
|
return 'npm run -w api';
|
|
97
97
|
case 'yarn':
|
|
98
98
|
return 'yarn workspace api';
|
|
99
|
-
case 'pnpm':
|
|
100
99
|
default:
|
|
101
100
|
return 'pnpm -F api';
|
|
102
101
|
}
|
|
@@ -115,7 +114,6 @@ function getDevCommand(packageManager) {
|
|
|
115
114
|
return 'concurrently \\"npm run -w api dev\\" \\"npm run -w web dev\\"';
|
|
116
115
|
case 'yarn':
|
|
117
116
|
return 'yarn workspaces foreach -A --parallel run dev';
|
|
118
|
-
case 'pnpm':
|
|
119
117
|
default:
|
|
120
118
|
return 'pnpm --parallel -r dev';
|
|
121
119
|
}
|
|
@@ -130,7 +128,6 @@ function getWsAllCommand(packageManager) {
|
|
|
130
128
|
return 'npm run -ws --if-present';
|
|
131
129
|
case 'yarn':
|
|
132
130
|
return 'yarn workspaces foreach -A run';
|
|
133
|
-
case 'pnpm':
|
|
134
131
|
default:
|
|
135
132
|
return 'pnpm -r';
|
|
136
133
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RSC Auth Template (React Server Components + Authentication)
|
|
3
|
+
*
|
|
4
|
+
* Full-stack application with:
|
|
5
|
+
* - React Server Components (RSC) with Vinxi
|
|
6
|
+
* - JWT Authentication via @veloxts/auth
|
|
7
|
+
* - Validated server actions with security features
|
|
8
|
+
* - File-based routing with auth pages
|
|
9
|
+
* - Embedded Fastify API at /api/*
|
|
10
|
+
*/
|
|
11
|
+
import type { TemplateConfig, TemplateFile } from './types.js';
|
|
12
|
+
export declare function generateRscAuthTemplate(config: TemplateConfig): TemplateFile[];
|