better-ts-stack 2.0.0 → 2.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.
Files changed (165) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/args.js +2 -2
  4. package/dist/builder/buildPlanner.js +71 -0
  5. package/dist/builder/configGenerator.js +9 -7
  6. package/dist/builder/dependencyInstaller.js +0 -1
  7. package/dist/builder/fileProcessor.js +47 -44
  8. package/dist/builder/gitInitializer.js +20 -1
  9. package/dist/builder/index.js +19 -38
  10. package/dist/builder/moduleSelector.js +0 -1
  11. package/dist/builder/templateContext.js +0 -22
  12. package/dist/index.js +4 -3
  13. package/dist/modules/registry.js +4 -6
  14. package/dist/output/nextSteps.js +0 -1
  15. package/dist/prompts/index.js +0 -1
  16. package/dist/prompts/stack.js +4 -1
  17. package/dist/types/index.js +7 -3
  18. package/dist/ui/index.js +0 -1
  19. package/dist/ui/messages.js +25 -1
  20. package/dist/ui/prompts.js +0 -1
  21. package/dist/ui/theme.js +0 -1
  22. package/dist/validators/index.js +10 -41
  23. package/package.json +2 -1
  24. package/templates/backend/express/.prettierrc +2 -2
  25. package/templates/backend/express/config.json +1 -5
  26. package/templates/backend/express/eslint.config.mjs +40 -40
  27. package/templates/backend/express/gitignore +36 -36
  28. package/templates/backend/express/src/{index.ts → index.ts.hbs} +28 -29
  29. package/templates/backend/express/src/routes/health.ts +12 -12
  30. package/templates/backend/express/tsconfig.json +25 -25
  31. package/templates/backend/nestjs/.prettierrc +16 -16
  32. package/templates/backend/nestjs/config.json +1 -4
  33. package/templates/backend/nestjs/eslint.config.mjs +40 -40
  34. package/templates/backend/nestjs/gitignore +36 -36
  35. package/templates/backend/nestjs/nest-cli.json +9 -9
  36. package/templates/backend/nestjs/src/app.module.ts.hbs +34 -34
  37. package/templates/backend/nestjs/src/health/health.controller.ts +12 -12
  38. package/templates/backend/nestjs/src/main.ts +23 -23
  39. package/templates/backend/nestjs/tsconfig.json +25 -25
  40. package/templates/frontend/nextjs/components.json +19 -19
  41. package/templates/frontend/nextjs/config.json +1 -2
  42. package/templates/frontend/nextjs/gitignore +42 -42
  43. package/templates/frontend/nextjs/lib/utils.ts +6 -6
  44. package/templates/frontend/nextjs/proxy.ts.hbs +24 -24
  45. package/templates/frontend/nextjs/tsconfig.json +34 -34
  46. package/templates/frontend/tanstack/config.json +1 -4
  47. package/templates/frontend/tanstack/src/routeTree.gen.ts +68 -68
  48. package/templates/frontend/tanstack/src/styles/app.css +85 -85
  49. package/templates/modules/auth/express/config.json +1 -8
  50. package/templates/modules/auth/express/src/controllers/authController.ts.hbs +116 -116
  51. package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +26 -26
  52. package/templates/modules/auth/express/src/services/userStore.ts.hbs +117 -117
  53. package/templates/modules/auth/nestjs/config.json +1 -5
  54. package/templates/modules/auth/nestjs/src/auth/auth.controller.ts +46 -46
  55. package/templates/modules/auth/nestjs/src/auth/auth.guard.ts +36 -36
  56. package/templates/modules/auth/nestjs/src/auth/auth.module.ts.hbs +22 -22
  57. package/templates/modules/auth/nestjs/src/auth/auth.schemas.ts +35 -35
  58. package/templates/modules/auth/nestjs/src/auth/auth.service.ts +70 -70
  59. package/templates/modules/auth/nestjs/src/auth/jwt.ts +27 -27
  60. package/templates/modules/auth/nestjs/src/auth/users.service.ts.hbs +144 -144
  61. package/templates/modules/auth/nestjs/src/auth/zod-validation.pipe.ts +16 -16
  62. package/templates/modules/auth/nextjs/app/dashboard/page.tsx +96 -96
  63. package/templates/modules/auth/nextjs/app/sign-in/page.tsx +35 -35
  64. package/templates/modules/auth/nextjs/app/sign-up/page.tsx +35 -35
  65. package/templates/modules/auth/nextjs/components/auth/sign-in-form.tsx +132 -132
  66. package/templates/modules/auth/nextjs/components/auth/sign-out-button.tsx +50 -50
  67. package/templates/modules/auth/nextjs/components/auth/sign-up-form.tsx +152 -152
  68. package/templates/modules/auth/nextjs/config.json +2 -15
  69. package/templates/modules/auth/nextjs/lib/auth-schema.ts +39 -39
  70. package/templates/modules/auth/nextjs/lib/auth.ts.hbs +37 -37
  71. package/templates/modules/auth/tanstack/config.json +2 -16
  72. package/templates/modules/auth/tanstack/src/lib/auth-functions.ts +4 -4
  73. package/templates/modules/auth/tanstack/src/routeTree.gen.ts +140 -140
  74. package/templates/modules/docker/.dockerignore +14 -14
  75. package/templates/modules/docker/Dockerfile.hbs +1 -3
  76. package/templates/modules/docker/config.json +1 -5
  77. package/templates/modules/docker/docker-compose.yml.hbs +9 -9
  78. package/templates/modules/drizzle/express/config.json +1 -2
  79. package/templates/modules/drizzle/express/drizzle.config.ts +13 -13
  80. package/templates/modules/drizzle/express/src/lib/db.ts +13 -13
  81. package/templates/modules/drizzle/express/src/lib/schema.ts +10 -10
  82. package/templates/modules/drizzle/nestjs/config.json +1 -2
  83. package/templates/modules/drizzle/nestjs/drizzle.config.ts +13 -13
  84. package/templates/modules/drizzle/nestjs/src/database/database.module.ts +30 -30
  85. package/templates/modules/drizzle/nestjs/src/database/schema.ts +10 -10
  86. package/templates/modules/drizzle/nextjs/config.json +1 -4
  87. package/templates/modules/drizzle/nextjs/lib/db.ts +13 -13
  88. package/templates/modules/drizzle/nextjs/lib/schema.ts.hbs +84 -84
  89. package/templates/modules/drizzle/tanstack/config.json +5 -5
  90. package/templates/modules/mongoose/express/config.json +1 -2
  91. package/templates/modules/mongoose/nestjs/config.json +1 -2
  92. package/templates/modules/mongoose/nestjs/src/users/user.schema.ts +21 -21
  93. package/templates/modules/mongoose/nextjs/config.json +1 -2
  94. package/templates/modules/mongoose/nextjs/lib/db.ts +36 -36
  95. package/templates/modules/mongoose/tanstack/config.json +1 -2
  96. package/templates/modules/mongoose/tanstack/src/lib/db.ts +37 -37
  97. package/templates/modules/prisma/express/config.json +0 -1
  98. package/templates/modules/prisma/express/prisma/schema.prisma +1 -1
  99. package/templates/modules/prisma/express/prisma.config.ts +12 -12
  100. package/templates/modules/prisma/express/src/lib/prisma.ts +24 -24
  101. package/templates/modules/prisma/nestjs/config.json +0 -1
  102. package/templates/modules/prisma/nestjs/prisma/schema.prisma +23 -23
  103. package/templates/modules/prisma/nestjs/prisma.config.ts +12 -12
  104. package/templates/modules/prisma/nestjs/src/prisma/prisma.module.ts +11 -11
  105. package/templates/modules/prisma/nestjs/src/prisma/prisma.service.ts +17 -17
  106. package/templates/modules/prisma/nextjs/config.json +0 -1
  107. package/templates/modules/prisma/nextjs/prisma/schema.prisma.hbs +91 -91
  108. package/templates/modules/prisma/tanstack/config.json +0 -1
  109. package/dist/args.d.ts +0 -12
  110. package/dist/args.d.ts.map +0 -1
  111. package/dist/args.js.map +0 -1
  112. package/dist/builder/configGenerator.d.ts +0 -7
  113. package/dist/builder/configGenerator.d.ts.map +0 -1
  114. package/dist/builder/configGenerator.js.map +0 -1
  115. package/dist/builder/dependencyInstaller.d.ts +0 -3
  116. package/dist/builder/dependencyInstaller.d.ts.map +0 -1
  117. package/dist/builder/dependencyInstaller.js.map +0 -1
  118. package/dist/builder/fileProcessor.d.ts +0 -6
  119. package/dist/builder/fileProcessor.d.ts.map +0 -1
  120. package/dist/builder/fileProcessor.js.map +0 -1
  121. package/dist/builder/gitInitializer.d.ts +0 -2
  122. package/dist/builder/gitInitializer.d.ts.map +0 -1
  123. package/dist/builder/gitInitializer.js.map +0 -1
  124. package/dist/builder/index.d.ts +0 -3
  125. package/dist/builder/index.d.ts.map +0 -1
  126. package/dist/builder/index.js.map +0 -1
  127. package/dist/builder/moduleSelector.d.ts +0 -6
  128. package/dist/builder/moduleSelector.d.ts.map +0 -1
  129. package/dist/builder/moduleSelector.js.map +0 -1
  130. package/dist/builder/templateContext.d.ts +0 -6
  131. package/dist/builder/templateContext.d.ts.map +0 -1
  132. package/dist/builder/templateContext.js.map +0 -1
  133. package/dist/index.d.ts +0 -2
  134. package/dist/index.d.ts.map +0 -1
  135. package/dist/index.js.map +0 -1
  136. package/dist/modules/registry.d.ts +0 -6
  137. package/dist/modules/registry.d.ts.map +0 -1
  138. package/dist/modules/registry.js.map +0 -1
  139. package/dist/output/nextSteps.d.ts +0 -3
  140. package/dist/output/nextSteps.d.ts.map +0 -1
  141. package/dist/output/nextSteps.js.map +0 -1
  142. package/dist/prompts/index.d.ts +0 -4
  143. package/dist/prompts/index.d.ts.map +0 -1
  144. package/dist/prompts/index.js.map +0 -1
  145. package/dist/prompts/stack.d.ts +0 -4
  146. package/dist/prompts/stack.d.ts.map +0 -1
  147. package/dist/prompts/stack.js.map +0 -1
  148. package/dist/types/index.d.ts +0 -137
  149. package/dist/types/index.d.ts.map +0 -1
  150. package/dist/types/index.js.map +0 -1
  151. package/dist/ui/index.d.ts +0 -3
  152. package/dist/ui/index.d.ts.map +0 -1
  153. package/dist/ui/index.js.map +0 -1
  154. package/dist/ui/messages.d.ts +0 -9
  155. package/dist/ui/messages.d.ts.map +0 -1
  156. package/dist/ui/messages.js.map +0 -1
  157. package/dist/ui/prompts.d.ts +0 -20
  158. package/dist/ui/prompts.d.ts.map +0 -1
  159. package/dist/ui/prompts.js.map +0 -1
  160. package/dist/ui/theme.d.ts +0 -9
  161. package/dist/ui/theme.d.ts.map +0 -1
  162. package/dist/ui/theme.js.map +0 -1
  163. package/dist/validators/index.d.ts +0 -6
  164. package/dist/validators/index.d.ts.map +0 -1
  165. package/dist/validators/index.js.map +0 -1
@@ -1,140 +1,140 @@
1
- /* eslint-disable */
2
-
3
- // @ts-nocheck
4
-
5
- // noinspection JSUnusedGlobalSymbols
6
-
7
- // This file was automatically generated by TanStack Router.
8
- // You should NOT make any changes in this file as it will be overwritten.
9
- // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
-
11
- import { Route as rootRouteImport } from './routes/__root'
12
- import { Route as IndexRouteImport } from './routes/index'
13
- import { Route as DashboardRouteImport } from './routes/dashboard'
14
- import { Route as SignInRouteImport } from './routes/sign-in'
15
- import { Route as SignUpRouteImport } from './routes/sign-up'
16
- import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
17
-
18
- const IndexRoute = IndexRouteImport.update({
19
- id: '/',
20
- path: '/',
21
- getParentRoute: () => rootRouteImport,
22
- } as any)
23
- const DashboardRoute = DashboardRouteImport.update({
24
- id: '/dashboard',
25
- path: '/dashboard',
26
- getParentRoute: () => rootRouteImport,
27
- } as any)
28
- const SignInRoute = SignInRouteImport.update({
29
- id: '/sign-in',
30
- path: '/sign-in',
31
- getParentRoute: () => rootRouteImport,
32
- } as any)
33
- const SignUpRoute = SignUpRouteImport.update({
34
- id: '/sign-up',
35
- path: '/sign-up',
36
- getParentRoute: () => rootRouteImport,
37
- } as any)
38
- const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
39
- id: '/api/auth/$',
40
- path: '/api/auth/$',
41
- getParentRoute: () => rootRouteImport,
42
- } as any)
43
-
44
- export interface FileRoutesByFullPath {
45
- '/': typeof IndexRoute
46
- '/dashboard': typeof DashboardRoute
47
- '/sign-in': typeof SignInRoute
48
- '/sign-up': typeof SignUpRoute
49
- '/api/auth/$': typeof ApiAuthSplatRoute
50
- }
51
- export interface FileRoutesByTo {
52
- '/': typeof IndexRoute
53
- '/dashboard': typeof DashboardRoute
54
- '/sign-in': typeof SignInRoute
55
- '/sign-up': typeof SignUpRoute
56
- '/api/auth/$': typeof ApiAuthSplatRoute
57
- }
58
- export interface FileRoutesById {
59
- __root__: typeof rootRouteImport
60
- '/': typeof IndexRoute
61
- '/dashboard': typeof DashboardRoute
62
- '/sign-in': typeof SignInRoute
63
- '/sign-up': typeof SignUpRoute
64
- '/api/auth/$': typeof ApiAuthSplatRoute
65
- }
66
- export interface FileRouteTypes {
67
- fileRoutesByFullPath: FileRoutesByFullPath
68
- fullPaths: '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
69
- fileRoutesByTo: FileRoutesByTo
70
- to: '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
71
- id: '__root__' | '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
72
- fileRoutesById: FileRoutesById
73
- }
74
- export interface RootRouteChildren {
75
- IndexRoute: typeof IndexRoute
76
- DashboardRoute: typeof DashboardRoute
77
- SignInRoute: typeof SignInRoute
78
- SignUpRoute: typeof SignUpRoute
79
- ApiAuthSplatRoute: typeof ApiAuthSplatRoute
80
- }
81
-
82
- declare module '@tanstack/react-router' {
83
- interface FileRoutesByPath {
84
- '/': {
85
- id: '/'
86
- path: '/'
87
- fullPath: '/'
88
- preLoaderRoute: typeof IndexRouteImport
89
- parentRoute: typeof rootRouteImport
90
- }
91
- '/dashboard': {
92
- id: '/dashboard'
93
- path: '/dashboard'
94
- fullPath: '/dashboard'
95
- preLoaderRoute: typeof DashboardRouteImport
96
- parentRoute: typeof rootRouteImport
97
- }
98
- '/sign-in': {
99
- id: '/sign-in'
100
- path: '/sign-in'
101
- fullPath: '/sign-in'
102
- preLoaderRoute: typeof SignInRouteImport
103
- parentRoute: typeof rootRouteImport
104
- }
105
- '/sign-up': {
106
- id: '/sign-up'
107
- path: '/sign-up'
108
- fullPath: '/sign-up'
109
- preLoaderRoute: typeof SignUpRouteImport
110
- parentRoute: typeof rootRouteImport
111
- }
112
- '/api/auth/$': {
113
- id: '/api/auth/$'
114
- path: '/api/auth/$'
115
- fullPath: '/api/auth/$'
116
- preLoaderRoute: typeof ApiAuthSplatRouteImport
117
- parentRoute: typeof rootRouteImport
118
- }
119
- }
120
- }
121
-
122
- const rootRouteChildren: RootRouteChildren = {
123
- IndexRoute: IndexRoute,
124
- DashboardRoute: DashboardRoute,
125
- SignInRoute: SignInRoute,
126
- SignUpRoute: SignUpRoute,
127
- ApiAuthSplatRoute: ApiAuthSplatRoute,
128
- }
129
- export const routeTree = rootRouteImport
130
- ._addFileChildren(rootRouteChildren)
131
- ._addFileTypes<FileRouteTypes>()
132
-
133
- import type { getRouter } from './router.tsx'
134
- import type { createStart } from '@tanstack/react-start'
135
- declare module '@tanstack/react-start' {
136
- interface Register {
137
- ssr: true
138
- router: Awaited<ReturnType<typeof getRouter>>
139
- }
140
- }
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+
7
+ // This file was automatically generated by TanStack Router.
8
+ // You should NOT make any changes in this file as it will be overwritten.
9
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
+
11
+ import { Route as rootRouteImport } from './routes/__root'
12
+ import { Route as IndexRouteImport } from './routes/index'
13
+ import { Route as DashboardRouteImport } from './routes/dashboard'
14
+ import { Route as SignInRouteImport } from './routes/sign-in'
15
+ import { Route as SignUpRouteImport } from './routes/sign-up'
16
+ import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
17
+
18
+ const IndexRoute = IndexRouteImport.update({
19
+ id: '/',
20
+ path: '/',
21
+ getParentRoute: () => rootRouteImport,
22
+ } as any)
23
+ const DashboardRoute = DashboardRouteImport.update({
24
+ id: '/dashboard',
25
+ path: '/dashboard',
26
+ getParentRoute: () => rootRouteImport,
27
+ } as any)
28
+ const SignInRoute = SignInRouteImport.update({
29
+ id: '/sign-in',
30
+ path: '/sign-in',
31
+ getParentRoute: () => rootRouteImport,
32
+ } as any)
33
+ const SignUpRoute = SignUpRouteImport.update({
34
+ id: '/sign-up',
35
+ path: '/sign-up',
36
+ getParentRoute: () => rootRouteImport,
37
+ } as any)
38
+ const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
39
+ id: '/api/auth/$',
40
+ path: '/api/auth/$',
41
+ getParentRoute: () => rootRouteImport,
42
+ } as any)
43
+
44
+ export interface FileRoutesByFullPath {
45
+ '/': typeof IndexRoute
46
+ '/dashboard': typeof DashboardRoute
47
+ '/sign-in': typeof SignInRoute
48
+ '/sign-up': typeof SignUpRoute
49
+ '/api/auth/$': typeof ApiAuthSplatRoute
50
+ }
51
+ export interface FileRoutesByTo {
52
+ '/': typeof IndexRoute
53
+ '/dashboard': typeof DashboardRoute
54
+ '/sign-in': typeof SignInRoute
55
+ '/sign-up': typeof SignUpRoute
56
+ '/api/auth/$': typeof ApiAuthSplatRoute
57
+ }
58
+ export interface FileRoutesById {
59
+ __root__: typeof rootRouteImport
60
+ '/': typeof IndexRoute
61
+ '/dashboard': typeof DashboardRoute
62
+ '/sign-in': typeof SignInRoute
63
+ '/sign-up': typeof SignUpRoute
64
+ '/api/auth/$': typeof ApiAuthSplatRoute
65
+ }
66
+ export interface FileRouteTypes {
67
+ fileRoutesByFullPath: FileRoutesByFullPath
68
+ fullPaths: '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
69
+ fileRoutesByTo: FileRoutesByTo
70
+ to: '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
71
+ id: '__root__' | '/' | '/dashboard' | '/sign-in' | '/sign-up' | '/api/auth/$'
72
+ fileRoutesById: FileRoutesById
73
+ }
74
+ export interface RootRouteChildren {
75
+ IndexRoute: typeof IndexRoute
76
+ DashboardRoute: typeof DashboardRoute
77
+ SignInRoute: typeof SignInRoute
78
+ SignUpRoute: typeof SignUpRoute
79
+ ApiAuthSplatRoute: typeof ApiAuthSplatRoute
80
+ }
81
+
82
+ declare module '@tanstack/react-router' {
83
+ interface FileRoutesByPath {
84
+ '/': {
85
+ id: '/'
86
+ path: '/'
87
+ fullPath: '/'
88
+ preLoaderRoute: typeof IndexRouteImport
89
+ parentRoute: typeof rootRouteImport
90
+ }
91
+ '/dashboard': {
92
+ id: '/dashboard'
93
+ path: '/dashboard'
94
+ fullPath: '/dashboard'
95
+ preLoaderRoute: typeof DashboardRouteImport
96
+ parentRoute: typeof rootRouteImport
97
+ }
98
+ '/sign-in': {
99
+ id: '/sign-in'
100
+ path: '/sign-in'
101
+ fullPath: '/sign-in'
102
+ preLoaderRoute: typeof SignInRouteImport
103
+ parentRoute: typeof rootRouteImport
104
+ }
105
+ '/sign-up': {
106
+ id: '/sign-up'
107
+ path: '/sign-up'
108
+ fullPath: '/sign-up'
109
+ preLoaderRoute: typeof SignUpRouteImport
110
+ parentRoute: typeof rootRouteImport
111
+ }
112
+ '/api/auth/$': {
113
+ id: '/api/auth/$'
114
+ path: '/api/auth/$'
115
+ fullPath: '/api/auth/$'
116
+ preLoaderRoute: typeof ApiAuthSplatRouteImport
117
+ parentRoute: typeof rootRouteImport
118
+ }
119
+ }
120
+ }
121
+
122
+ const rootRouteChildren: RootRouteChildren = {
123
+ IndexRoute: IndexRoute,
124
+ DashboardRoute: DashboardRoute,
125
+ SignInRoute: SignInRoute,
126
+ SignUpRoute: SignUpRoute,
127
+ ApiAuthSplatRoute: ApiAuthSplatRoute,
128
+ }
129
+ export const routeTree = rootRouteImport
130
+ ._addFileChildren(rootRouteChildren)
131
+ ._addFileTypes<FileRouteTypes>()
132
+
133
+ import type { getRouter } from './router.tsx'
134
+ import type { createStart } from '@tanstack/react-start'
135
+ declare module '@tanstack/react-start' {
136
+ interface Register {
137
+ ssr: true
138
+ router: Awaited<ReturnType<typeof getRouter>>
139
+ }
140
+ }
@@ -1,14 +1,14 @@
1
- node_modules
2
- npm-debug.log
3
- .env*
4
- .git
5
- .gitignore
6
- README.md
7
- .vscode
8
- .idea
9
- dist
10
- coverage
11
- .DS_Store
12
- *.log
13
-
14
- .next
1
+ node_modules
2
+ npm-debug.log
3
+ .env*
4
+ .git
5
+ .gitignore
6
+ README.md
7
+ .vscode
8
+ .idea
9
+ dist
10
+ coverage
11
+ .DS_Store
12
+ *.log
13
+
14
+ .next
@@ -53,7 +53,6 @@ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
53
53
 
54
54
  COPY . .
55
55
 
56
- # Only build if package.json has a build script
57
56
  {{#if (eq database 'prisma')}}
58
57
  RUN DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres" npm run build
59
58
  {{else if (eq database 'mongoose')}}
@@ -100,7 +99,6 @@ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
100
99
 
101
100
  COPY . .
102
101
 
103
- # Only build if package.json has a build script
104
102
  {{#if (eq database 'prisma')}}
105
103
  RUN DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres" npm run build
106
104
  {{else if (eq database 'mongoose')}}
@@ -123,7 +121,7 @@ COPY package*.json ./
123
121
  RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev; fi \
124
122
  && npm cache clean --force
125
123
 
126
- # Copy built files (if TypeScript) or source files (if JavaScript)
124
+ # Copy the compiled output
127
125
  COPY --from=builder --chown=appuser:nodejs /app/dist ./dist
128
126
 
129
127
  USER appuser
@@ -11,9 +11,5 @@
11
11
  "docker:down": "docker compose down",
12
12
  "docker:logs": "docker compose logs -f"
13
13
  },
14
- "envVars": {},
15
- "templateFiles": [
16
- "docker-compose.yml.hbs",
17
- "Dockerfile.hbs"
18
- ]
14
+ "envVars": {}
19
15
  }
@@ -1,10 +1,10 @@
1
- services:
2
- {{projectName}}:
3
- build: .
4
- ports:
5
- - "{{port}}:{{port}}"
6
- env_file:
7
- - .env
8
- environment:
9
- - NODE_ENV=production
1
+ services:
2
+ {{projectName}}:
3
+ build: .
4
+ ports:
5
+ - "{{port}}:{{port}}"
6
+ env_file:
7
+ - .env
8
+ environment:
9
+ - NODE_ENV=production
10
10
  restart: unless-stopped
@@ -18,9 +18,8 @@
18
18
  "db:studio": "drizzle-kit studio"
19
19
  },
20
20
  "envVars": {
21
- "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb?schema=public"
21
+ "DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
22
22
  },
23
- "templateFiles": [],
24
23
  "overrides": {
25
24
  "esbuild": "^0.28.2"
26
25
  }
@@ -1,13 +1,13 @@
1
- import { config } from "dotenv";
2
- import { defineConfig } from "drizzle-kit";
3
-
4
- config({ path: ".env" });
5
-
6
- export default defineConfig({
7
- schema: "./src/lib/schema.ts",
8
- out: "./migrations",
9
- dialect: "postgresql",
10
- dbCredentials: {
11
- url: process.env.DATABASE_URL!,
12
- },
13
- });
1
+ import { config } from "dotenv";
2
+ import { defineConfig } from "drizzle-kit";
3
+
4
+ config({ path: ".env" });
5
+
6
+ export default defineConfig({
7
+ schema: "./src/lib/schema.ts",
8
+ out: "./migrations",
9
+ dialect: "postgresql",
10
+ dbCredentials: {
11
+ url: process.env.DATABASE_URL!,
12
+ },
13
+ });
@@ -1,13 +1,13 @@
1
- import { config } from "dotenv";
2
- import { drizzle } from "drizzle-orm/node-postgres";
3
- import { Pool } from "pg";
4
-
5
- import * as schema from "./schema";
6
-
7
- config({ path: ".env" }); // or .env.local
8
-
9
- const pool = new Pool({
10
- connectionString: process.env.DATABASE_URL,
11
- });
12
-
13
- export const db = drizzle(pool, { schema });
1
+ import { config } from "dotenv";
2
+ import { drizzle } from "drizzle-orm/node-postgres";
3
+ import { Pool } from "pg";
4
+
5
+ import * as schema from "./schema";
6
+
7
+ config({ path: ".env" }); // or .env.local
8
+
9
+ const pool = new Pool({
10
+ connectionString: process.env.DATABASE_URL,
11
+ });
12
+
13
+ export const db = drizzle(pool, { schema });
@@ -1,10 +1,10 @@
1
- import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
-
3
- export const users = pgTable("users", {
4
- id: uuid("id").primaryKey().defaultRandom(),
5
- email: text("email").notNull().unique(),
6
- name: text("name"),
7
- password: text("password").notNull(),
8
- createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
9
- updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
10
- });
1
+ import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
+
3
+ export const users = pgTable("users", {
4
+ id: uuid("id").primaryKey().defaultRandom(),
5
+ email: text("email").notNull().unique(),
6
+ name: text("name"),
7
+ password: text("password").notNull(),
8
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
9
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
10
+ });
@@ -18,9 +18,8 @@
18
18
  "db:studio": "drizzle-kit studio"
19
19
  },
20
20
  "envVars": {
21
- "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb?schema=public"
21
+ "DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
22
22
  },
23
- "templateFiles": [],
24
23
  "overrides": {
25
24
  "esbuild": "^0.28.2"
26
25
  }
@@ -1,13 +1,13 @@
1
- import { config } from "dotenv";
2
- import { defineConfig } from "drizzle-kit";
3
-
4
- config({ path: ".env" });
5
-
6
- export default defineConfig({
7
- schema: "./src/database/schema.ts",
8
- out: "./migrations",
9
- dialect: "postgresql",
10
- dbCredentials: {
11
- url: process.env.DATABASE_URL!,
12
- },
13
- });
1
+ import { config } from "dotenv";
2
+ import { defineConfig } from "drizzle-kit";
3
+
4
+ config({ path: ".env" });
5
+
6
+ export default defineConfig({
7
+ schema: "./src/database/schema.ts",
8
+ out: "./migrations",
9
+ dialect: "postgresql",
10
+ dbCredentials: {
11
+ url: process.env.DATABASE_URL!,
12
+ },
13
+ });
@@ -1,30 +1,30 @@
1
- import { Global, Inject, Module, type OnModuleDestroy } from "@nestjs/common";
2
- import { drizzle, type NodePgDatabase } from "drizzle-orm/node-postgres";
3
- import type { Pool } from "pg";
4
-
5
- import * as schema from "./schema.js";
6
-
7
- // Injection token for the Drizzle client: @Inject(DRIZZLE) private readonly db: Database
8
- export const DRIZZLE = Symbol("DRIZZLE");
9
-
10
- // $client is the connection pool that drizzle() creates from the URL
11
- export type Database = NodePgDatabase<typeof schema> & { $client: Pool };
12
-
13
- // Global so any module can inject the client without importing this one
14
- @Global()
15
- @Module({
16
- providers: [
17
- {
18
- provide: DRIZZLE,
19
- useFactory: () => drizzle(process.env.DATABASE_URL!, { schema }),
20
- },
21
- ],
22
- exports: [DRIZZLE],
23
- })
24
- export class DatabaseModule implements OnModuleDestroy {
25
- constructor(@Inject(DRIZZLE) private readonly db: Database) {}
26
-
27
- async onModuleDestroy(): Promise<void> {
28
- await this.db.$client.end();
29
- }
30
- }
1
+ import { Global, Inject, Module, type OnModuleDestroy } from "@nestjs/common";
2
+ import { drizzle, type NodePgDatabase } from "drizzle-orm/node-postgres";
3
+ import type { Pool } from "pg";
4
+
5
+ import * as schema from "./schema.js";
6
+
7
+ // Injection token for the Drizzle client: @Inject(DRIZZLE) private readonly db: Database
8
+ export const DRIZZLE = Symbol("DRIZZLE");
9
+
10
+ // $client is the connection pool that drizzle() creates from the URL
11
+ export type Database = NodePgDatabase<typeof schema> & { $client: Pool };
12
+
13
+ // Global so any module can inject the client without importing this one
14
+ @Global()
15
+ @Module({
16
+ providers: [
17
+ {
18
+ provide: DRIZZLE,
19
+ useFactory: () => drizzle(process.env.DATABASE_URL!, { schema }),
20
+ },
21
+ ],
22
+ exports: [DRIZZLE],
23
+ })
24
+ export class DatabaseModule implements OnModuleDestroy {
25
+ constructor(@Inject(DRIZZLE) private readonly db: Database) {}
26
+
27
+ async onModuleDestroy(): Promise<void> {
28
+ await this.db.$client.end();
29
+ }
30
+ }
@@ -1,10 +1,10 @@
1
- import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
-
3
- export const users = pgTable("users", {
4
- id: uuid("id").primaryKey().defaultRandom(),
5
- email: text("email").notNull().unique(),
6
- name: text("name"),
7
- password: text("password").notNull(),
8
- createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
9
- updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
10
- });
1
+ import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
+
3
+ export const users = pgTable("users", {
4
+ id: uuid("id").primaryKey().defaultRandom(),
5
+ email: text("email").notNull().unique(),
6
+ name: text("name"),
7
+ password: text("password").notNull(),
8
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
9
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
10
+ });
@@ -18,11 +18,8 @@
18
18
  "db:studio": "drizzle-kit studio"
19
19
  },
20
20
  "envVars": {
21
- "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb?schema=public"
21
+ "DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres"
22
22
  },
23
- "templateFiles": [
24
- "lib/schema.ts.hbs"
25
- ],
26
23
  "overrides": {
27
24
  "esbuild": "^0.28.2"
28
25
  }
@@ -1,13 +1,13 @@
1
- import { config } from "dotenv";
2
- import { drizzle } from "drizzle-orm/node-postgres";
3
- import { Pool } from "pg";
4
-
5
- import * as schema from "./schema";
6
-
7
- config({ path: ".env" }); // or .env.local
8
-
9
- const pool = new Pool({
10
- connectionString: process.env.DATABASE_URL,
11
- });
12
-
13
- export const db = drizzle(pool, { schema });
1
+ import { config } from "dotenv";
2
+ import { drizzle } from "drizzle-orm/node-postgres";
3
+ import { Pool } from "pg";
4
+
5
+ import * as schema from "./schema";
6
+
7
+ config({ path: ".env" }); // or .env.local
8
+
9
+ const pool = new Pool({
10
+ connectionString: process.env.DATABASE_URL,
11
+ });
12
+
13
+ export const db = drizzle(pool, { schema });