create-velox-app 0.6.27 → 0.6.31

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.
Files changed (181) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cli.d.ts +0 -1
  3. package/dist/cli.js +74 -7
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.js +7 -8
  6. package/dist/templates/auth.d.ts +0 -1
  7. package/dist/templates/auth.js +9 -9
  8. package/dist/templates/compiler.d.ts +0 -1
  9. package/dist/templates/compiler.js +1 -2
  10. package/dist/templates/index.d.ts +0 -1
  11. package/dist/templates/index.js +0 -1
  12. package/dist/templates/placeholders.d.ts +31 -3
  13. package/dist/templates/placeholders.js +167 -4
  14. package/dist/templates/rsc.d.ts +0 -1
  15. package/dist/templates/rsc.js +9 -9
  16. package/dist/templates/shared/index.d.ts +0 -1
  17. package/dist/templates/shared/index.js +0 -1
  18. package/dist/templates/shared/root.d.ts +0 -1
  19. package/dist/templates/shared/root.js +11 -2
  20. package/dist/templates/shared/web-base.d.ts +0 -1
  21. package/dist/templates/shared/web-base.js +0 -1
  22. package/dist/templates/shared/web-styles.d.ts +0 -1
  23. package/dist/templates/shared/web-styles.js +0 -1
  24. package/dist/templates/shared.d.ts +0 -1
  25. package/dist/templates/shared.js +0 -1
  26. package/dist/templates/spa.d.ts +0 -1
  27. package/dist/templates/spa.js +9 -9
  28. package/dist/templates/trpc.d.ts +0 -1
  29. package/dist/templates/trpc.js +9 -9
  30. package/dist/templates/types.d.ts +0 -1
  31. package/dist/templates/types.js +1 -3
  32. package/package.json +5 -2
  33. package/src/templates/source/api/config/database.ts +76 -0
  34. package/src/templates/source/api/env.auth +1 -4
  35. package/src/templates/source/api/env.default +1 -4
  36. package/src/templates/source/api/prisma/schema.auth.prisma +1 -2
  37. package/src/templates/source/api/prisma/schema.default.prisma +1 -2
  38. package/src/templates/source/api/procedures/auth.ts +2 -2
  39. package/src/templates/source/api/procedures/health.ts +2 -2
  40. package/src/templates/source/api/procedures/users.auth.ts +2 -2
  41. package/src/templates/source/api/procedures/users.default.ts +2 -8
  42. package/src/templates/source/root/.cursorrules +3 -3
  43. package/src/templates/source/root/CLAUDE.auth.md +2 -2
  44. package/src/templates/source/root/CLAUDE.default.md +2 -2
  45. package/src/templates/source/root/package.json +6 -6
  46. package/src/templates/source/rsc/env.example +1 -1
  47. package/src/templates/source/rsc/prisma/schema.prisma +1 -1
  48. package/src/templates/source/rsc/src/api/database.ts +76 -0
  49. package/src/templates/source/rsc/src/api/procedures/health.ts +2 -2
  50. package/src/templates/source/rsc/src/api/procedures/posts.ts +2 -2
  51. package/src/templates/source/rsc/src/api/procedures/users.ts +2 -2
  52. package/dist/cli.d.ts.map +0 -1
  53. package/dist/cli.js.map +0 -1
  54. package/dist/index.d.ts.map +0 -1
  55. package/dist/index.js.map +0 -1
  56. package/dist/templates/auth.d.ts.map +0 -1
  57. package/dist/templates/auth.js.map +0 -1
  58. package/dist/templates/compiler.d.ts.map +0 -1
  59. package/dist/templates/compiler.js.map +0 -1
  60. package/dist/templates/default.d.ts +0 -12
  61. package/dist/templates/default.d.ts.map +0 -1
  62. package/dist/templates/default.js +0 -85
  63. package/dist/templates/default.js.map +0 -1
  64. package/dist/templates/fullstack.d.ts +0 -15
  65. package/dist/templates/fullstack.d.ts.map +0 -1
  66. package/dist/templates/fullstack.js +0 -110
  67. package/dist/templates/fullstack.js.map +0 -1
  68. package/dist/templates/index.d.ts.map +0 -1
  69. package/dist/templates/index.js.map +0 -1
  70. package/dist/templates/placeholders.d.ts.map +0 -1
  71. package/dist/templates/placeholders.js.map +0 -1
  72. package/dist/templates/rsc.d.ts.map +0 -1
  73. package/dist/templates/rsc.js.map +0 -1
  74. package/dist/templates/shared/index.d.ts.map +0 -1
  75. package/dist/templates/shared/index.js.map +0 -1
  76. package/dist/templates/shared/root.d.ts.map +0 -1
  77. package/dist/templates/shared/root.js.map +0 -1
  78. package/dist/templates/shared/web-base.d.ts.map +0 -1
  79. package/dist/templates/shared/web-base.js.map +0 -1
  80. package/dist/templates/shared/web-styles.d.ts.map +0 -1
  81. package/dist/templates/shared/web-styles.js.map +0 -1
  82. package/dist/templates/shared.d.ts.map +0 -1
  83. package/dist/templates/shared.js.map +0 -1
  84. package/dist/templates/source/api/config/app.d.ts +0 -13
  85. package/dist/templates/source/api/config/app.d.ts.map +0 -1
  86. package/dist/templates/source/api/config/app.js +0 -14
  87. package/dist/templates/source/api/config/app.js.map +0 -1
  88. package/dist/templates/source/api/config/auth.d.ts +0 -34
  89. package/dist/templates/source/api/config/auth.d.ts.map +0 -1
  90. package/dist/templates/source/api/config/auth.js +0 -165
  91. package/dist/templates/source/api/config/auth.js.map +0 -1
  92. package/dist/templates/source/api/config/index.auth.d.ts +0 -6
  93. package/dist/templates/source/api/config/index.auth.d.ts.map +0 -1
  94. package/dist/templates/source/api/config/index.auth.js +0 -6
  95. package/dist/templates/source/api/config/index.auth.js.map +0 -1
  96. package/dist/templates/source/api/config/index.default.d.ts +0 -5
  97. package/dist/templates/source/api/config/index.default.d.ts.map +0 -1
  98. package/dist/templates/source/api/config/index.default.js +0 -5
  99. package/dist/templates/source/api/config/index.default.js.map +0 -1
  100. package/dist/templates/source/api/database/index.d.ts +0 -9
  101. package/dist/templates/source/api/database/index.d.ts.map +0 -1
  102. package/dist/templates/source/api/database/index.js +0 -18
  103. package/dist/templates/source/api/database/index.js.map +0 -1
  104. package/dist/templates/source/api/index.auth.d.ts +0 -5
  105. package/dist/templates/source/api/index.auth.d.ts.map +0 -1
  106. package/dist/templates/source/api/index.auth.js +0 -59
  107. package/dist/templates/source/api/index.auth.js.map +0 -1
  108. package/dist/templates/source/api/index.default.d.ts +0 -5
  109. package/dist/templates/source/api/index.default.d.ts.map +0 -1
  110. package/dist/templates/source/api/index.default.js +0 -56
  111. package/dist/templates/source/api/index.default.js.map +0 -1
  112. package/dist/templates/source/api/prisma.config.d.ts +0 -9
  113. package/dist/templates/source/api/prisma.config.d.ts.map +0 -1
  114. package/dist/templates/source/api/prisma.config.js +0 -15
  115. package/dist/templates/source/api/prisma.config.js.map +0 -1
  116. package/dist/templates/source/api/procedures/auth.d.ts +0 -14
  117. package/dist/templates/source/api/procedures/auth.d.ts.map +0 -1
  118. package/dist/templates/source/api/procedures/auth.js +0 -221
  119. package/dist/templates/source/api/procedures/auth.js.map +0 -1
  120. package/dist/templates/source/api/procedures/health.d.ts +0 -5
  121. package/dist/templates/source/api/procedures/health.d.ts.map +0 -1
  122. package/dist/templates/source/api/procedures/health.js +0 -21
  123. package/dist/templates/source/api/procedures/health.js.map +0 -1
  124. package/dist/templates/source/api/procedures/index.auth.d.ts +0 -7
  125. package/dist/templates/source/api/procedures/index.auth.d.ts.map +0 -1
  126. package/dist/templates/source/api/procedures/index.auth.js +0 -7
  127. package/dist/templates/source/api/procedures/index.auth.js.map +0 -1
  128. package/dist/templates/source/api/procedures/index.default.d.ts +0 -6
  129. package/dist/templates/source/api/procedures/index.default.d.ts.map +0 -1
  130. package/dist/templates/source/api/procedures/index.default.js +0 -6
  131. package/dist/templates/source/api/procedures/index.default.js.map +0 -1
  132. package/dist/templates/source/api/procedures/users.auth.d.ts +0 -7
  133. package/dist/templates/source/api/procedures/users.auth.d.ts.map +0 -1
  134. package/dist/templates/source/api/procedures/users.auth.js +0 -111
  135. package/dist/templates/source/api/procedures/users.auth.js.map +0 -1
  136. package/dist/templates/source/api/procedures/users.default.d.ts +0 -5
  137. package/dist/templates/source/api/procedures/users.default.d.ts.map +0 -1
  138. package/dist/templates/source/api/procedures/users.default.js +0 -86
  139. package/dist/templates/source/api/procedures/users.default.js.map +0 -1
  140. package/dist/templates/source/api/schemas/index.d.ts +0 -5
  141. package/dist/templates/source/api/schemas/index.d.ts.map +0 -1
  142. package/dist/templates/source/api/schemas/index.js +0 -5
  143. package/dist/templates/source/api/schemas/index.js.map +0 -1
  144. package/dist/templates/source/api/schemas/user.d.ts +0 -11
  145. package/dist/templates/source/api/schemas/user.d.ts.map +0 -1
  146. package/dist/templates/source/api/schemas/user.js +0 -20
  147. package/dist/templates/source/api/schemas/user.js.map +0 -1
  148. package/dist/templates/source/api/tsup.config.d.ts +0 -3
  149. package/dist/templates/source/api/tsup.config.d.ts.map +0 -1
  150. package/dist/templates/source/api/tsup.config.js +0 -10
  151. package/dist/templates/source/api/tsup.config.js.map +0 -1
  152. package/dist/templates/source/web/main.d.ts +0 -9
  153. package/dist/templates/source/web/main.d.ts.map +0 -1
  154. package/dist/templates/source/web/main.js +0 -27
  155. package/dist/templates/source/web/main.js.map +0 -1
  156. package/dist/templates/source/web/routes/__root.d.ts +0 -2
  157. package/dist/templates/source/web/routes/__root.d.ts.map +0 -1
  158. package/dist/templates/source/web/routes/__root.js +0 -28
  159. package/dist/templates/source/web/routes/__root.js.map +0 -1
  160. package/dist/templates/source/web/routes/about.d.ts +0 -2
  161. package/dist/templates/source/web/routes/about.d.ts.map +0 -1
  162. package/dist/templates/source/web/routes/about.js +0 -33
  163. package/dist/templates/source/web/routes/about.js.map +0 -1
  164. package/dist/templates/source/web/routes/index.auth.d.ts +0 -2
  165. package/dist/templates/source/web/routes/index.auth.d.ts.map +0 -1
  166. package/dist/templates/source/web/routes/index.auth.js +0 -159
  167. package/dist/templates/source/web/routes/index.auth.js.map +0 -1
  168. package/dist/templates/source/web/routes/index.default.d.ts +0 -2
  169. package/dist/templates/source/web/routes/index.default.d.ts.map +0 -1
  170. package/dist/templates/source/web/routes/index.default.js +0 -60
  171. package/dist/templates/source/web/routes/index.default.js.map +0 -1
  172. package/dist/templates/source/web/vite.config.d.ts +0 -3
  173. package/dist/templates/source/web/vite.config.d.ts.map +0 -1
  174. package/dist/templates/source/web/vite.config.js +0 -22
  175. package/dist/templates/source/web/vite.config.js.map +0 -1
  176. package/dist/templates/spa.d.ts.map +0 -1
  177. package/dist/templates/spa.js.map +0 -1
  178. package/dist/templates/trpc.d.ts.map +0 -1
  179. package/dist/templates/trpc.js.map +0 -1
  180. package/dist/templates/types.d.ts.map +0 -1
  181. package/dist/templates/types.js.map +0 -1
@@ -11,12 +11,13 @@
11
11
  * This is a single-package structure (not a monorepo workspace).
12
12
  */
13
13
  import { compileTemplate } from './compiler.js';
14
- import { RSC_CONFIG } from './placeholders.js';
14
+ import { applyDatabaseDependencies, RSC_CONFIG } from './placeholders.js';
15
15
  // ============================================================================
16
16
  // Template Compilation
17
17
  // ============================================================================
18
18
  function generatePackageJson(config) {
19
- return compileTemplate('rsc/package.json', config);
19
+ const content = compileTemplate('rsc/package.json', config);
20
+ return applyDatabaseDependencies(content, config);
20
21
  }
21
22
  function generateAppConfig() {
22
23
  return compileTemplate('rsc/app.config.ts', RSC_CONFIG);
@@ -34,8 +35,8 @@ function generateClaudeMd(config) {
34
35
  return compileTemplate('rsc/CLAUDE.md', config);
35
36
  }
36
37
  // Prisma
37
- function generatePrismaSchema() {
38
- return compileTemplate('rsc/prisma/schema.prisma', RSC_CONFIG);
38
+ function generatePrismaSchema(config) {
39
+ return compileTemplate('rsc/prisma/schema.prisma', config);
39
40
  }
40
41
  function generatePrismaConfig() {
41
42
  return compileTemplate('rsc/prisma.config.ts', RSC_CONFIG);
@@ -112,8 +113,8 @@ function generateEntryServer() {
112
113
  function generateApiHandler() {
113
114
  return compileTemplate('rsc/src/api/handler.ts', RSC_CONFIG);
114
115
  }
115
- function generateDatabase() {
116
- return compileTemplate('rsc/src/api/database.ts', RSC_CONFIG);
116
+ function generateDatabase(config) {
117
+ return compileTemplate('rsc/src/api/database.ts', config);
117
118
  }
118
119
  function generateHealthProcedures() {
119
120
  return compileTemplate('rsc/src/api/procedures/health.ts', RSC_CONFIG);
@@ -147,7 +148,7 @@ export function generateRscTemplate(config) {
147
148
  { path: '.gitignore', content: generateGitignore() },
148
149
  { path: 'CLAUDE.md', content: generateClaudeMd(config) },
149
150
  // Prisma
150
- { path: 'prisma/schema.prisma', content: generatePrismaSchema() },
151
+ { path: 'prisma/schema.prisma', content: generatePrismaSchema(config) },
151
152
  { path: 'prisma.config.ts', content: generatePrismaConfig() },
152
153
  // App layer (RSC) - Basic pages
153
154
  { path: 'app/pages/index.tsx', content: generateHomePage() },
@@ -179,7 +180,7 @@ export function generateRscTemplate(config) {
179
180
  { path: 'src/entry.server.tsx', content: generateEntryServer() },
180
181
  // Source layer - API
181
182
  { path: 'src/api/handler.ts', content: generateApiHandler() },
182
- { path: 'src/api/database.ts', content: generateDatabase() },
183
+ { path: 'src/api/database.ts', content: generateDatabase(config) },
183
184
  { path: 'src/api/procedures/health.ts', content: generateHealthProcedures() },
184
185
  { path: 'src/api/procedures/users.ts', content: generateUserProcedures() },
185
186
  { path: 'src/api/procedures/posts.ts', content: generatePostProcedures() },
@@ -189,4 +190,3 @@ export function generateRscTemplate(config) {
189
190
  { path: 'public/favicon.svg', content: generateFavicon() },
190
191
  ];
191
192
  }
192
- //# sourceMappingURL=rsc.js.map
@@ -6,4 +6,3 @@
6
6
  export * from './root.js';
7
7
  export * from './web-base.js';
8
8
  export * from './web-styles.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -6,4 +6,3 @@
6
6
  export * from './root.js';
7
7
  export * from './web-base.js';
8
8
  export * from './web-styles.js';
9
- //# sourceMappingURL=index.js.map
@@ -12,4 +12,3 @@ export declare function generateRootReadme(config: TemplateConfig): string;
12
12
  export declare function generateRootClaudeMd(config: TemplateConfig, isAuthTemplate: boolean): string;
13
13
  export declare function generateRootCursorrules(config: TemplateConfig): string;
14
14
  export declare function generateRootFiles(config: TemplateConfig, isAuthTemplate: boolean): TemplateFile[];
15
- //# sourceMappingURL=root.d.ts.map
@@ -9,7 +9,17 @@ import { DEFAULT_CONFIG } from '../placeholders.js';
9
9
  // Root Template Compilation
10
10
  // ============================================================================
11
11
  export function generateRootPackageJson(config) {
12
- return compileTemplate('root/package.json', config);
12
+ const content = compileTemplate('root/package.json', config);
13
+ // npm requires concurrently for parallel workspace execution
14
+ if (config.packageManager === 'npm') {
15
+ const pkg = JSON.parse(content);
16
+ pkg.devDependencies = pkg.devDependencies ?? {};
17
+ pkg.devDependencies.concurrently = '9.2.1';
18
+ // Sort devDependencies alphabetically
19
+ pkg.devDependencies = Object.fromEntries(Object.entries(pkg.devDependencies).sort(([a], [b]) => a.localeCompare(b)));
20
+ return JSON.stringify(pkg, null, 2);
21
+ }
22
+ return content;
13
23
  }
14
24
  export function generatePnpmWorkspaceYaml() {
15
25
  return compileTemplate('root/pnpm-workspace.yaml', DEFAULT_CONFIG);
@@ -44,4 +54,3 @@ export function generateRootFiles(config, isAuthTemplate) {
44
54
  { path: '.cursorrules', content: generateRootCursorrules(config) },
45
55
  ];
46
56
  }
47
- //# sourceMappingURL=root.js.map
@@ -18,4 +18,3 @@ export declare function generateUsersRoute(config: TemplateConfig): string;
18
18
  export declare function generateApiHooks(): string;
19
19
  export declare function generateViteEnvDts(): string;
20
20
  export declare function generateWebBaseFiles(config: TemplateConfig, isAuthTemplate: boolean): TemplateFile[];
21
- //# sourceMappingURL=web-base.d.ts.map
@@ -74,4 +74,3 @@ export function generateWebBaseFiles(config, isAuthTemplate) {
74
74
  { path: 'apps/web/src/routes/about.tsx', content: generateAboutRoute() },
75
75
  ];
76
76
  }
77
- //# sourceMappingURL=web-base.js.map
@@ -7,4 +7,3 @@ import type { TemplateFile } from '../types.js';
7
7
  export declare function generateGlobalCss(): string;
8
8
  export declare function generateAppModuleCss(): string;
9
9
  export declare function generateWebStyleFiles(): TemplateFile[];
10
- //# sourceMappingURL=web-styles.d.ts.map
@@ -23,4 +23,3 @@ export function generateWebStyleFiles() {
23
23
  { path: 'apps/web/src/App.module.css', content: generateAppModuleCss() },
24
24
  ];
25
25
  }
26
- //# sourceMappingURL=web-styles.js.map
@@ -8,4 +8,3 @@
8
8
  * This is automatically updated during releases via changesets.
9
9
  */
10
10
  export declare const VELOXTS_VERSION: string;
11
- //# sourceMappingURL=shared.d.ts.map
@@ -15,4 +15,3 @@ const packageJson = require('../../package.json');
15
15
  * This is automatically updated during releases via changesets.
16
16
  */
17
17
  export const VELOXTS_VERSION = packageJson.version ?? '0.0.0-unknown';
18
- //# sourceMappingURL=shared.js.map
@@ -9,4 +9,3 @@
9
9
  */
10
10
  import type { TemplateConfig, TemplateFile } from './types.js';
11
11
  export declare function generateSpaTemplate(config: TemplateConfig): TemplateFile[];
12
- //# sourceMappingURL=spa.d.ts.map
@@ -8,13 +8,14 @@
8
8
  * No authentication - suitable for internal APIs or as a starting point.
9
9
  */
10
10
  import { compileTemplate } from './compiler.js';
11
- import { DEFAULT_CONFIG } from './placeholders.js';
11
+ import { applyDatabaseDependencies, DEFAULT_CONFIG } from './placeholders.js';
12
12
  import { generateRootFiles, generateWebBaseFiles, generateWebStyleFiles } from './shared/index.js';
13
13
  // ============================================================================
14
14
  // API Template Compilation
15
15
  // ============================================================================
16
16
  function generateApiPackageJson(config) {
17
- return compileTemplate('api/package.default.json', config);
17
+ const content = compileTemplate('api/package.default.json', config);
18
+ return applyDatabaseDependencies(content, config);
18
19
  }
19
20
  function generateApiTsConfig() {
20
21
  return compileTemplate('api/tsconfig.json', DEFAULT_CONFIG);
@@ -25,8 +26,8 @@ function generateApiTsupConfig() {
25
26
  function generateEnvExample(config) {
26
27
  return compileTemplate('api/env.default', config);
27
28
  }
28
- function generatePrismaSchema() {
29
- return compileTemplate('api/prisma/schema.default.prisma', DEFAULT_CONFIG);
29
+ function generatePrismaSchema(config) {
30
+ return compileTemplate('api/prisma/schema.default.prisma', config);
30
31
  }
31
32
  function generatePrismaConfig() {
32
33
  return compileTemplate('api/prisma.config.ts', DEFAULT_CONFIG);
@@ -43,8 +44,8 @@ function generateIndexTs() {
43
44
  function generateConfigApp(config) {
44
45
  return compileTemplate('api/config/app.ts', config);
45
46
  }
46
- function generateConfigDatabase() {
47
- return compileTemplate('api/config/database.ts', DEFAULT_CONFIG);
47
+ function generateConfigDatabase(config) {
48
+ return compileTemplate('api/config/database.ts', config);
48
49
  }
49
50
  function generateHealthProcedures() {
50
51
  return compileTemplate('api/procedures/health.ts', DEFAULT_CONFIG);
@@ -77,13 +78,13 @@ export function generateSpaTemplate(config) {
77
78
  { path: 'apps/api/.env.example', content: generateEnvExample(config) },
78
79
  { path: 'apps/api/.env', content: generateEnvExample(config) },
79
80
  // Prisma
80
- { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema() },
81
+ { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema(config) },
81
82
  // API Source files
82
83
  { path: 'apps/api/src/router.ts', content: generateRouterTs() },
83
84
  { path: 'apps/api/src/router.types.ts', content: generateRouterTypesTs() },
84
85
  { path: 'apps/api/src/index.ts', content: generateIndexTs() },
85
86
  { path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
86
- { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase() },
87
+ { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase(config) },
87
88
  { path: 'apps/api/src/procedures/health.ts', content: generateHealthProcedures() },
88
89
  { path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
89
90
  { path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
@@ -98,4 +99,3 @@ export function generateSpaTemplate(config) {
98
99
  const webStyleFiles = generateWebStyleFiles();
99
100
  return [...files, ...rootFiles, ...webBaseFiles, ...webStyleFiles];
100
101
  }
101
- //# sourceMappingURL=spa.js.map
@@ -12,4 +12,3 @@
12
12
  */
13
13
  import type { TemplateConfig, TemplateFile } from './types.js';
14
14
  export declare function generateTrpcTemplate(config: TemplateConfig): TemplateFile[];
15
- //# sourceMappingURL=trpc.d.ts.map
@@ -11,14 +11,15 @@
11
11
  * - End-to-end type safety without code generation
12
12
  */
13
13
  import { compileTemplate } from './compiler.js';
14
- import { DEFAULT_CONFIG, TRPC_CONFIG } from './placeholders.js';
14
+ import { applyDatabaseDependencies, DEFAULT_CONFIG, TRPC_CONFIG } from './placeholders.js';
15
15
  import { generateRootFiles, generateWebBaseFiles, generateWebStyleFiles } from './shared/index.js';
16
16
  // ============================================================================
17
17
  // API Template Compilation
18
18
  // ============================================================================
19
19
  function generateApiPackageJson(config) {
20
20
  // Reuse default package.json - @veloxts/velox already includes tRPC utilities
21
- return compileTemplate('api/package.default.json', config);
21
+ const content = compileTemplate('api/package.default.json', config);
22
+ return applyDatabaseDependencies(content, config);
22
23
  }
23
24
  function generateApiTsConfig() {
24
25
  return compileTemplate('api/tsconfig.json', DEFAULT_CONFIG);
@@ -30,9 +31,9 @@ function generateEnvExample(config) {
30
31
  // Reuse default env - same environment variables
31
32
  return compileTemplate('api/env.default', config);
32
33
  }
33
- function generatePrismaSchema() {
34
+ function generatePrismaSchema(config) {
34
35
  // Reuse default schema - same data model
35
- return compileTemplate('api/prisma/schema.default.prisma', DEFAULT_CONFIG);
36
+ return compileTemplate('api/prisma/schema.default.prisma', config);
36
37
  }
37
38
  function generatePrismaConfig() {
38
39
  return compileTemplate('api/prisma.config.ts', DEFAULT_CONFIG);
@@ -50,8 +51,8 @@ function generateIndexTs() {
50
51
  function generateConfigApp(config) {
51
52
  return compileTemplate('api/config/app.ts', config);
52
53
  }
53
- function generateConfigDatabase() {
54
- return compileTemplate('api/config/database.ts', DEFAULT_CONFIG);
54
+ function generateConfigDatabase(config) {
55
+ return compileTemplate('api/config/database.ts', config);
55
56
  }
56
57
  function generateHealthProcedures() {
57
58
  return compileTemplate('api/procedures/health.ts', DEFAULT_CONFIG);
@@ -85,13 +86,13 @@ export function generateTrpcTemplate(config) {
85
86
  { path: 'apps/api/.env.example', content: generateEnvExample(config) },
86
87
  { path: 'apps/api/.env', content: generateEnvExample(config) },
87
88
  // Prisma
88
- { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema() },
89
+ { path: 'apps/api/prisma/schema.prisma', content: generatePrismaSchema(config) },
89
90
  // API Source files
90
91
  { path: 'apps/api/src/router.ts', content: generateRouterTs() },
91
92
  { path: 'apps/api/src/router.types.ts', content: generateRouterTypesTs() },
92
93
  { path: 'apps/api/src/index.ts', content: generateIndexTs() },
93
94
  { path: 'apps/api/src/config/app.ts', content: generateConfigApp(config) },
94
- { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase() },
95
+ { path: 'apps/api/src/config/database.ts', content: generateConfigDatabase(config) },
95
96
  { path: 'apps/api/src/procedures/health.ts', content: generateHealthProcedures() },
96
97
  { path: 'apps/api/src/procedures/users.ts', content: generateUserProcedures() },
97
98
  { path: 'apps/api/src/schemas/user.ts', content: generateUserSchema() },
@@ -106,4 +107,3 @@ export function generateTrpcTemplate(config) {
106
107
  const webStyleFiles = generateWebStyleFiles();
107
108
  return [...files, ...rootFiles, ...webBaseFiles, ...webStyleFiles];
108
109
  }
109
- //# sourceMappingURL=trpc.js.map
@@ -101,4 +101,3 @@ export declare function getAvailableTemplates(): TemplateMetadata[];
101
101
  * Check if a template type is valid
102
102
  */
103
103
  export declare function isValidTemplate(template: string): template is TemplateType;
104
- //# sourceMappingURL=types.d.ts.map
@@ -34,8 +34,7 @@ export const DATABASE_METADATA = {
34
34
  postgresql: {
35
35
  type: 'postgresql',
36
36
  label: 'PostgreSQL',
37
- hint: 'Coming soon - requires running PostgreSQL server',
38
- disabled: true,
37
+ hint: 'Production-ready, requires running PostgreSQL server',
39
38
  },
40
39
  mysql: {
41
40
  type: 'mysql',
@@ -106,4 +105,3 @@ export function getAvailableTemplates() {
106
105
  export function isValidTemplate(template) {
107
106
  return template in TEMPLATE_METADATA;
108
107
  }
109
- //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-velox-app",
3
- "version": "0.6.27",
3
+ "version": "0.6.31",
4
4
  "description": "Project scaffolder for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,8 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "25.0.3",
32
- "typescript": "5.9.3"
32
+ "typescript": "5.9.3",
33
+ "vitest": "4.0.15"
33
34
  },
34
35
  "keywords": [
35
36
  "velox",
@@ -56,6 +57,8 @@
56
57
  "type-check": "tsc --noEmit",
57
58
  "check:templates": "tsc -p tsconfig.templates.json --noEmit || true",
58
59
  "clean": "rm -rf dist tsconfig.tsbuildinfo",
60
+ "test": "vitest run",
61
+ "test:watch": "vitest",
59
62
  "smoke-test": "./scripts/smoke-test.sh"
60
63
  }
61
64
  }
@@ -11,14 +11,31 @@
11
11
  // Runtime imports using createRequire for Node.js v24+ CJS interop
12
12
  import { createRequire } from 'node:module';
13
13
 
14
+ /* @if sqlite */
14
15
  // Type imports (erased at runtime, safe for ESM)
15
16
  import type { PrismaBetterSqlite3 as PrismaBetterSqlite3Type } from '@prisma/adapter-better-sqlite3';
17
+ /* @endif sqlite */
18
+ /* @if postgresql */
19
+ // Type imports (erased at runtime, safe for ESM)
20
+ import type { PrismaPg as PrismaPgType } from '@prisma/adapter-pg';
21
+ /* @endif postgresql */
16
22
  import type { PrismaClient as PrismaClientType } from '@prisma/client';
23
+ import type { Pool as PoolType } from 'pg';
17
24
 
18
25
  const require = createRequire(import.meta.url);
26
+ /* @if sqlite */
19
27
  const { PrismaBetterSqlite3 } = require('@prisma/adapter-better-sqlite3') as {
20
28
  PrismaBetterSqlite3: typeof PrismaBetterSqlite3Type;
21
29
  };
30
+ /* @endif sqlite */
31
+ /* @if postgresql */
32
+ const { PrismaPg } = require('@prisma/adapter-pg') as {
33
+ PrismaPg: typeof PrismaPgType;
34
+ };
35
+ const { Pool } = require('pg') as {
36
+ Pool: typeof PoolType;
37
+ };
38
+ /* @endif postgresql */
22
39
  const { PrismaClient } = require('@prisma/client') as {
23
40
  PrismaClient: typeof PrismaClientType;
24
41
  };
@@ -27,8 +44,13 @@ declare global {
27
44
  // Allow global `var` declarations for hot reload in development
28
45
  // eslint-disable-next-line no-var
29
46
  var __db: PrismaClient | undefined;
47
+ /* @if postgresql */
48
+ // eslint-disable-next-line no-var
49
+ var __pool: InstanceType<typeof PoolType> | undefined;
50
+ /* @endif postgresql */
30
51
  }
31
52
 
53
+ /* @if sqlite */
32
54
  /**
33
55
  * Create a Prisma client instance using the SQLite adapter.
34
56
  * Validates that DATABASE_URL is set before creating the client.
@@ -47,10 +69,64 @@ function createPrismaClient(): PrismaClient {
47
69
  const adapter = new PrismaBetterSqlite3({ url: databaseUrl });
48
70
  return new PrismaClient({ adapter });
49
71
  }
72
+ /* @endif sqlite */
73
+ /* @if postgresql */
74
+ /**
75
+ * Create a PostgreSQL connection pool.
76
+ * Uses connection pooling for better performance in production.
77
+ */
78
+ function createPool(): InstanceType<typeof PoolType> {
79
+ const databaseUrl = process.env.DATABASE_URL;
50
80
 
81
+ if (!databaseUrl) {
82
+ throw new Error(
83
+ '[VeloxTS] DATABASE_URL environment variable is not set. ' +
84
+ 'Ensure .env file exists with DATABASE_URL defined.'
85
+ );
86
+ }
87
+
88
+ return new Pool({
89
+ connectionString: databaseUrl,
90
+ max: 10, // Maximum connections in pool
91
+ });
92
+ }
93
+
94
+ /**
95
+ * Create a Prisma client instance using the PostgreSQL adapter.
96
+ * Uses connection pooling for efficient database access.
97
+ */
98
+ function createPrismaClient(pool: InstanceType<typeof PoolType>): PrismaClient {
99
+ // Prisma 7 requires driver adapters for direct connections
100
+ const adapter = new PrismaPg(pool);
101
+ return new PrismaClient({ adapter });
102
+ }
103
+ /* @endif postgresql */
104
+
105
+ /* @if sqlite */
51
106
  // Use global singleton for hot reload in development
52
107
  export const db = globalThis.__db ?? createPrismaClient();
53
108
 
54
109
  if (process.env.NODE_ENV !== 'production') {
55
110
  globalThis.__db = db;
56
111
  }
112
+ /* @endif sqlite */
113
+ /* @if postgresql */
114
+ // Use global singletons for hot reload in development
115
+ const pool = globalThis.__pool ?? createPool();
116
+ export const db = globalThis.__db ?? createPrismaClient(pool);
117
+
118
+ if (process.env.NODE_ENV !== 'production') {
119
+ globalThis.__pool = pool;
120
+ globalThis.__db = db;
121
+ }
122
+
123
+ // Graceful shutdown - close pool on process exit
124
+ const shutdown = async () => {
125
+ await db.$disconnect();
126
+ await pool.end();
127
+ process.exit(0);
128
+ };
129
+
130
+ process.on('SIGTERM', shutdown);
131
+ process.on('SIGINT', shutdown);
132
+ /* @endif postgresql */
@@ -1,8 +1,5 @@
1
1
  # Database URL
2
- # SQLite (local development):
3
- DATABASE_URL="file:./dev.db"
4
- # PostgreSQL (production):
5
- # DATABASE_URL="postgresql://user:password@localhost:5432/myapp"
2
+ DATABASE_URL="__DATABASE_URL__"
6
3
 
7
4
  # Server Configuration
8
5
  PORT=__API_PORT__
@@ -1,8 +1,5 @@
1
1
  # Database URL
2
- # SQLite (local development):
3
- DATABASE_URL="file:./dev.db"
4
- # PostgreSQL (production):
5
- # DATABASE_URL="postgresql://user:password@localhost:5432/myapp"
2
+ DATABASE_URL="__DATABASE_URL__"
6
3
 
7
4
  # Server Configuration
8
5
  PORT=__API_PORT__
@@ -1,7 +1,6 @@
1
1
  // Prisma Schema
2
2
  //
3
3
  // This schema defines the database structure with authentication support.
4
- // Using SQLite for simplicity - easily swap to PostgreSQL for production.
5
4
 
6
5
  generator client {
7
6
  provider = "prisma-client-js"
@@ -10,7 +9,7 @@ generator client {
10
9
  }
11
10
 
12
11
  datasource db {
13
- provider = "sqlite"
12
+ provider = "__DATABASE_PROVIDER__"
14
13
  }
15
14
 
16
15
  // ============================================================================
@@ -1,7 +1,6 @@
1
1
  // Prisma Schema
2
2
  //
3
3
  // This schema defines the database structure.
4
- // Using SQLite for simplicity - easily swap to PostgreSQL for production.
5
4
 
6
5
  generator client {
7
6
  provider = "prisma-client-js"
@@ -10,7 +9,7 @@ generator client {
10
9
  }
11
10
 
12
11
  datasource db {
13
- provider = "sqlite"
12
+ provider = "__DATABASE_PROVIDER__"
14
13
  }
15
14
 
16
15
  // ============================================================================
@@ -15,10 +15,10 @@ import {
15
15
  AuthError,
16
16
  authenticated,
17
17
  createAuthRateLimiter,
18
- defineProcedures,
19
18
  hashPassword,
20
19
  jwtManager,
21
20
  procedure,
21
+ procedures,
22
22
  verifyPassword,
23
23
  } from '@veloxts/velox';
24
24
 
@@ -104,7 +104,7 @@ const DUMMY_HASH = '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.uy7dPSSXB5G6Uy
104
104
  // Auth Procedures
105
105
  // ============================================================================
106
106
 
107
- export const authProcedures = defineProcedures('auth', {
107
+ export const authProcedures = procedures('auth', {
108
108
  createAccount: procedure()
109
109
  .rest({ method: 'POST', path: '/auth/register' })
110
110
  .use(rateLimiter.register())
@@ -2,11 +2,11 @@
2
2
  * Health Check Procedures
3
3
  */
4
4
 
5
- import { defineProcedures, procedure, VELOX_VERSION } from '@veloxts/velox';
5
+ import { procedure, procedures, VELOX_VERSION } from '@veloxts/velox';
6
6
 
7
7
  import { HealthResponse } from '../schemas/health.js';
8
8
 
9
- export const healthProcedures = defineProcedures('health', {
9
+ export const healthProcedures = procedures('health', {
10
10
  getHealth: procedure()
11
11
  .rest({ method: 'GET', path: '/health' })
12
12
  .output(HealthResponse)
@@ -11,12 +11,12 @@
11
11
  import {
12
12
  AuthError,
13
13
  authenticated,
14
- defineProcedures,
15
14
  GuardError,
16
15
  hasRole,
17
16
  NotFoundError,
18
17
  paginationInputSchema,
19
18
  procedure,
19
+ procedures,
20
20
  z,
21
21
  } from '@veloxts/velox';
22
22
 
@@ -31,7 +31,7 @@ import {
31
31
  // User Procedures
32
32
  // ============================================================================
33
33
 
34
- export const userProcedures = defineProcedures('users', {
34
+ export const userProcedures = procedures('users', {
35
35
  getUser: procedure()
36
36
  .input(z.object({ id: z.string().uuid() }))
37
37
  .output(UserSchema)
@@ -7,13 +7,7 @@
7
7
  * - Output schema automatically serializes Date → string via withTimestamps()
8
8
  */
9
9
 
10
- import {
11
- defineProcedures,
12
- NotFoundError,
13
- paginationInputSchema,
14
- procedure,
15
- z,
16
- } from '@veloxts/velox';
10
+ import { NotFoundError, paginationInputSchema, procedure, procedures, z } from '@veloxts/velox';
17
11
 
18
12
  import {
19
13
  CreateUserInput,
@@ -22,7 +16,7 @@ import {
22
16
  UserSchema,
23
17
  } from '../schemas/user.js';
24
18
 
25
- export const userProcedures = defineProcedures('users', {
19
+ export const userProcedures = procedures('users', {
26
20
  getUser: procedure()
27
21
  .input(z.object({ id: z.string().uuid() }))
28
22
  .output(UserSchema)
@@ -53,9 +53,9 @@ CRITICAL - Never violate these rules:
53
53
  ### Procedure Pattern
54
54
 
55
55
  ```typescript
56
- import { defineProcedures, procedure, z } from '@veloxts/velox';
56
+ import { procedure, procedures, z } from '@veloxts/velox';
57
57
 
58
- export const entityProcedures = defineProcedures('entities', {
58
+ export const entityProcedures = procedures('entities', {
59
59
  getEntity: procedure()
60
60
  .input(z.object({ id: z.string().uuid() }))
61
61
  .output(EntitySchema)
@@ -144,7 +144,7 @@ __RUN_CMD__ db:studio # Open Prisma Studio
144
144
 
145
145
  ```typescript
146
146
  // VeloxTS imports (use umbrella package)
147
- import { defineProcedures, procedure, z } from '@veloxts/velox';
147
+ import { procedure, procedures, z } from '@veloxts/velox';
148
148
  /* @if auth */
149
149
  import { authenticated, hasRole } from '@veloxts/auth';
150
150
  /* @endif auth */
@@ -46,9 +46,9 @@ apps/
46
46
 
47
47
  ```typescript
48
48
  // apps/api/src/procedures/posts.ts
49
- import { defineProcedures, procedure, z } from '@veloxts/velox';
49
+ import { procedure, procedures, z } from '@veloxts/velox';
50
50
 
51
- export const postProcedures = defineProcedures('posts', {
51
+ export const postProcedures = procedures('posts', {
52
52
  // GET /api/posts/:id
53
53
  getPost: procedure()
54
54
  .input(z.object({ id: z.string().uuid() }))
@@ -45,9 +45,9 @@ apps/
45
45
 
46
46
  ```typescript
47
47
  // apps/api/src/procedures/posts.ts
48
- import { defineProcedures, procedure, z } from '@veloxts/velox';
48
+ import { procedure, procedures, z } from '@veloxts/velox';
49
49
 
50
- export const postProcedures = defineProcedures('posts', {
50
+ export const postProcedures = procedures('posts', {
51
51
  // GET /api/posts/:id
52
52
  getPost: procedure()
53
53
  .input(z.object({ id: z.string().uuid() }))
@@ -7,12 +7,12 @@
7
7
  "apps/*"
8
8
  ],
9
9
  "scripts": {
10
- "dev": "__RUN_CMD__ --parallel -r dev",
11
- "build": "__RUN_CMD__ -r build",
12
- "type-check": "__RUN_CMD__ -r type-check",
13
- "db:push": "__RUN_CMD__ -F api db:push",
14
- "db:generate": "__RUN_CMD__ -F api db:generate",
15
- "db:studio": "__RUN_CMD__ -F api db:studio"
10
+ "dev": "__DEV_CMD__",
11
+ "build": "__WS_ALL__ build",
12
+ "type-check": "__WS_ALL__ type-check",
13
+ "db:push": "__WS_API__ db:push",
14
+ "db:generate": "__WS_API__ db:generate",
15
+ "db:studio": "__WS_API__ db:studio"
16
16
  },
17
17
  "dependencies": {
18
18
  "@prisma/client-runtime-utils": "7.2.0"
@@ -1,5 +1,5 @@
1
1
  # Database
2
- DATABASE_URL="file:./dev.db"
2
+ DATABASE_URL="__DATABASE_URL__"
3
3
 
4
4
  # Server
5
5
  PORT=__API_PORT__