@nest-arch/tui 0.4.5 → 0.4.6
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/dist/cli.js +1 -1
- package/dist/{constants-BbC7KTI7.js → constants-DVhgS48N.js} +1 -1
- package/dist/index.js +134 -133
- package/dist/templates/addons/husky/noop-hook.hbs +2 -0
- package/dist/templates/base/.env.example.hbs +9 -0
- package/dist/templates/base/.env.hbs +9 -0
- package/dist/templates/base/README.md.hbs +12 -0
- package/dist/templates/base/prisma.config.ts.hbs +1 -0
- package/dist/templates/base/src/app.module.ts.hbs +1 -0
- package/dist/templates/base/src/database/adapters/interfaces/db-adapter.interface.ts.hbs +1 -1
- package/dist/templates/base/src/database/db.module.ts.hbs +15 -2
- package/dist/templates/base/src/database/db.service.ts.hbs +5 -5
- package/dist/templates/base/src/main.ts.hbs +5 -4
- package/dist/templates/base/test/app.e2e-spec.ts.hbs +6 -2
- package/dist/templates/base/test/bootstrap.e2e-spec.ts.hbs +2 -2
- package/dist/templates/extras/docker/Dockerfile.hbs +1 -1
- package/dist/templates/monorepo/apps/api-gateway/src/main.ts.hbs +8 -7
- package/dist/templates/single-project/architecture/nest-api/.env.hbs +9 -0
- package/dist/templates/single-project/architecture/nest-api/src/main.ts.hbs +8 -7
- package/dist/templates/single-project/architecture/nest-gateway/src/main.ts.hbs +8 -7
- package/dist/templates/single-project/architecture/nest-microservice/src/main.ts.hbs +8 -7
- package/dist/templates/single-project/shared/config/env.ts.hbs +9 -0
- package/package.json +2 -2
|
@@ -17,6 +17,15 @@ MYSQL_URL=mysql://root:mysql@localhost:3306/{{projectNameKebab}}_db
|
|
|
17
17
|
{{#if hasSqlite}}
|
|
18
18
|
SQLITE_PATH=./src/database/dev.db
|
|
19
19
|
{{/if}}
|
|
20
|
+
{{#if hasSqlserver}}
|
|
21
|
+
SQLSERVER_HOST=localhost
|
|
22
|
+
SQLSERVER_PORT=1433
|
|
23
|
+
SQLSERVER_DATABASE={{projectNameKebab}}_db
|
|
24
|
+
SQLSERVER_USER=sa
|
|
25
|
+
SQLSERVER_PASSWORD=DevOnly_Strong_Password_2026!X9
|
|
26
|
+
SQLSERVER_ENCRYPT=true
|
|
27
|
+
SQLSERVER_TRUST_SERVER_CERTIFICATE=true
|
|
28
|
+
{{/if}}
|
|
20
29
|
{{#if hasMongodb}}
|
|
21
30
|
MONGODB_URL=mongodb://localhost:27017/{{projectNameKebab}}_db
|
|
22
31
|
{{/if}}
|
|
@@ -14,6 +14,15 @@ MYSQL_URL=mysql://root:mysql@localhost:3306/{{projectNameKebab}}_db
|
|
|
14
14
|
{{#if hasSqlite}}
|
|
15
15
|
SQLITE_PATH=./src/database/dev.db
|
|
16
16
|
{{/if}}
|
|
17
|
+
{{#if hasSqlserver}}
|
|
18
|
+
SQLSERVER_HOST=localhost
|
|
19
|
+
SQLSERVER_PORT=1433
|
|
20
|
+
SQLSERVER_DATABASE={{projectNameKebab}}_db
|
|
21
|
+
SQLSERVER_USER=sa
|
|
22
|
+
SQLSERVER_PASSWORD=DevOnly_Strong_Password_2026!X9
|
|
23
|
+
SQLSERVER_ENCRYPT=true
|
|
24
|
+
SQLSERVER_TRUST_SERVER_CERTIFICATE=true
|
|
25
|
+
{{/if}}
|
|
17
26
|
{{#if hasMongodb}}
|
|
18
27
|
MONGODB_URL=mongodb://localhost:27017/{{projectNameKebab}}_db
|
|
19
28
|
{{/if}}
|
|
@@ -54,6 +54,10 @@ This project uses **Prisma** as the ORM. Available commands:
|
|
|
54
54
|
{{#if isPnpm}}pnpm prisma:migrate{{else if isYarn}}yarn prisma:migrate{{else if isBun}}bun run prisma:migrate{{else}}npm run prisma:migrate{{/if}}
|
|
55
55
|
{{#if isPnpm}}pnpm prisma:migrate:deploy{{else if isYarn}}yarn prisma:migrate:deploy{{else if isBun}}bun run prisma:migrate:deploy{{else}}npm run prisma:migrate:deploy{{/if}}
|
|
56
56
|
```
|
|
57
|
+
{{#if hasSqlserver}}
|
|
58
|
+
|
|
59
|
+
Set `SQLSERVER_HOST`, `SQLSERVER_PORT`, `SQLSERVER_DATABASE`, `SQLSERVER_USER`, and `SQLSERVER_PASSWORD` in `.env` before running Prisma commands. The SQL Server database must already exist. The generated password is a development-only example that satisfies SQL Server's password policy; replace it with a unique secret before sharing the project or deploying it. For local development, set `SQLSERVER_TRUST_SERVER_CERTIFICATE=true` when using a self-signed certificate; keep certificate validation enabled for production.
|
|
60
|
+
{{/if}}
|
|
57
61
|
{{/if}}
|
|
58
62
|
|
|
59
63
|
{{#if useDrizzle}}
|
|
@@ -229,3 +233,11 @@ Send queries to `POST /graphql`. `{ hello }` is always available. With the Todo
|
|
|
229
233
|
|
|
230
234
|
Set `MONGODB_URL` including the database name. The native client connects and pings MongoDB during startup and closes with the Nest application. No Prisma migration commands are required. Todo identifiers are serialized ObjectId strings; malformed IDs return 400 and missing mutation targets return 404. Listing returns at most 100 items in identifier order. This baseline performs single-document writes and does not promise multi-document transactions.
|
|
231
235
|
{{/if}}
|
|
236
|
+
{{#if docker}}
|
|
237
|
+
## Docker Compose
|
|
238
|
+
|
|
239
|
+
Start the application and its database with `docker compose up --build`. Compose publishes the API on `127.0.0.1:3000` by default (Fastify uses `3001`). If that host port is already in use or reserved, set `APP_PORT` to a free host port before starting; the container's internal port stays unchanged. In PowerShell, for example: `$env:APP_PORT = "3100"; docker compose up --build`.
|
|
240
|
+
{{#if hasSqlserver}}
|
|
241
|
+
Compose also publishes SQL Server on `127.0.0.1:1433` so Prisma commands run on the host can connect. The API container uses the internal `sqlserver:1433` address. If host port 1433 is occupied, change `SQLSERVER_PORT` in `.env`; keep the API container's internal database port at 1433.
|
|
242
|
+
{{/if}}
|
|
243
|
+
{{/if}}
|
|
@@ -31,6 +31,7 @@ export default defineConfig({
|
|
|
31
31
|
{{#if hasPostgres}}url: env.POSTGRES_URL,{{/if}}
|
|
32
32
|
{{#if hasMysql}}url: env.MYSQL_URL,{{/if}}
|
|
33
33
|
{{#if hasSqlite}}url: env.SQLITE_PATH,{{/if}}
|
|
34
|
+
{{#if hasSqlserver}}url: `sqlserver://${env.SQLSERVER_HOST}:${env.SQLSERVER_PORT};database=${env.SQLSERVER_DATABASE};user={${env.SQLSERVER_USER.replaceAll("}", "}}")}};password={${env.SQLSERVER_PASSWORD.replaceAll("}", "}}")}};encrypt=${env.SQLSERVER_ENCRYPT};trustServerCertificate=${env.SQLSERVER_TRUST_SERVER_CERTIFICATE}`,{{/if}}
|
|
34
35
|
{{#if hasMongodb}}url: env.MONGODB_URL,{{/if}}
|
|
35
36
|
},
|
|
36
37
|
});
|
|
@@ -86,6 +86,7 @@ class GraphqlThrottlerGuard extends ThrottlerGuard {
|
|
|
86
86
|
{{#if hasPostgres}}postgresUrl: env.POSTGRES_URL,{{/if}}
|
|
87
87
|
{{#if hasMysql}}mysqlUrl: env.MYSQL_URL,{{/if}}
|
|
88
88
|
{{#if hasSqlite}}sqlitePath: env.SQLITE_PATH,{{/if}}
|
|
89
|
+
{{#if hasSqlserver}}sqlserver: { server: env.SQLSERVER_HOST, port: env.SQLSERVER_PORT, database: env.SQLSERVER_DATABASE, user: env.SQLSERVER_USER, password: env.SQLSERVER_PASSWORD, options: { encrypt: env.SQLSERVER_ENCRYPT, trustServerCertificate: env.SQLSERVER_TRUST_SERVER_CERTIFICATE } },{{/if}}
|
|
89
90
|
{{#if hasMongodb}}mongodbUrl: env.MONGODB_URL,{{/if}}
|
|
90
91
|
}),
|
|
91
92
|
{{/if}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
1
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
2
2
|
export interface ISqlAdapter<TClient = unknown> {
|
|
3
3
|
query: <T = unknown>(sql: string, params?: unknown[]) => Promise<T[]>;
|
|
4
4
|
execute: (sql: string, params?: unknown[]) => Promise<unknown>;
|
|
@@ -27,7 +27,7 @@ import { PrismaClient } from '@prisma/client';
|
|
|
27
27
|
import { PrismaClient } from '../database/orm/prisma/generated/client.js';
|
|
28
28
|
{{/if}}
|
|
29
29
|
{{/if}}
|
|
30
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
30
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
31
31
|
import { PrismaSqlAdapter } from './adapters/sql/prisma-sql.adapter.js';
|
|
32
32
|
{{/if}}
|
|
33
33
|
{{#if hasPostgres}}
|
|
@@ -38,6 +38,9 @@ import { PrismaMariaDb } from '@prisma/adapter-mariadb';
|
|
|
38
38
|
{{/if}}
|
|
39
39
|
{{#if hasSqlite}}
|
|
40
40
|
import { PrismaBetterSqlite3 } from '@prisma/adapter-better-sqlite3';
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#if hasSqlserver}}
|
|
43
|
+
import { PrismaMssql } from '@prisma/adapter-mssql';
|
|
41
44
|
{{/if}}
|
|
42
45
|
{{#if hasMongodb}}
|
|
43
46
|
import { PrismaMongoAdapter } from './adapters/mongo/prisma-mongo.adapter.js';
|
|
@@ -99,6 +102,9 @@ export interface DbModuleOptions {
|
|
|
99
102
|
{{#if hasSqlite}}
|
|
100
103
|
sqlitePath?: string;
|
|
101
104
|
{{/if}}
|
|
105
|
+
{{#if hasSqlserver}}
|
|
106
|
+
sqlserver?: { server: string; port: number; database: string; user: string; password: string; options: { encrypt: boolean; trustServerCertificate: boolean } };
|
|
107
|
+
{{/if}}
|
|
102
108
|
{{#if hasMongodb}}
|
|
103
109
|
mongodbUrl?: string;
|
|
104
110
|
{{/if}}
|
|
@@ -119,7 +125,7 @@ export class DbModule {
|
|
|
119
125
|
const providers = initialProviders;
|
|
120
126
|
|
|
121
127
|
{{#if usePrisma}}
|
|
122
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
128
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
123
129
|
{{#if hasPostgres}}
|
|
124
130
|
const sqlAdapter = new PrismaPg({
|
|
125
131
|
connectionString: options.postgresUrl,
|
|
@@ -137,6 +143,13 @@ export class DbModule {
|
|
|
137
143
|
const sqlAdapter = new PrismaBetterSqlite3({
|
|
138
144
|
url: options.sqlitePath || ':memory:',
|
|
139
145
|
});
|
|
146
|
+
const prismaSql = new PrismaClient({ adapter: sqlAdapter });
|
|
147
|
+
{{/if}}
|
|
148
|
+
{{#if hasSqlserver}}
|
|
149
|
+
if (!options.sqlserver) {
|
|
150
|
+
throw new Error("SQL Server connection settings are required to initialize Prisma");
|
|
151
|
+
}
|
|
152
|
+
const sqlAdapter = new PrismaMssql(options.sqlserver);
|
|
140
153
|
const prismaSql = new PrismaClient({ adapter: sqlAdapter });
|
|
141
154
|
{{/if}}
|
|
142
155
|
providers.push({
|
|
@@ -18,7 +18,7 @@ export class DbService {
|
|
|
18
18
|
}
|
|
19
19
|
{{else}}
|
|
20
20
|
import { Injectable, Inject } from '@nestjs/common';
|
|
21
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
21
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
22
22
|
import type { ISqlAdapter } from './adapters/interfaces/db-adapter.interface.js';
|
|
23
23
|
{{/if}}
|
|
24
24
|
{{#if hasMongodb}}
|
|
@@ -58,7 +58,7 @@ import type * as schema from './orm/drizzle/schema.js';
|
|
|
58
58
|
{{#if useTypeorm}}
|
|
59
59
|
import type { DataSource } from 'typeorm';
|
|
60
60
|
{{/if}}
|
|
61
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
61
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
62
62
|
{{#if usePrisma}}
|
|
63
63
|
type SqlClient = PrismaClient;
|
|
64
64
|
{{else if useTypeorm}}
|
|
@@ -91,7 +91,7 @@ import { db as prismaDb } from './prisma/db.js';
|
|
|
91
91
|
@Injectable()
|
|
92
92
|
export class DbService {
|
|
93
93
|
constructor(
|
|
94
|
-
|
|
94
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
95
95
|
@Inject('SQL_ADAPTER') readonly sql: ISqlAdapter<SqlClient>{{#if hasMongodb}},{{/if}}
|
|
96
96
|
{{/if}}
|
|
97
97
|
{{#if hasMongodb}}
|
|
@@ -101,7 +101,7 @@ export class DbService {
|
|
|
101
101
|
|
|
102
102
|
get raw() {
|
|
103
103
|
return {
|
|
104
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
104
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
105
105
|
sql: this.sql.getClient(),
|
|
106
106
|
{{/if}}
|
|
107
107
|
{{#if hasMongodb}}
|
|
@@ -114,7 +114,7 @@ export class DbService {
|
|
|
114
114
|
return prismaDb;
|
|
115
115
|
}
|
|
116
116
|
{{else if usePrisma}}
|
|
117
|
-
{{#if (or hasPostgres hasMysql hasSqlite)}}
|
|
117
|
+
{{#if (or hasPostgres hasMysql hasSqlite hasSqlserver)}}
|
|
118
118
|
get prisma(): PrismaClient {
|
|
119
119
|
return this.sql.getClient();
|
|
120
120
|
}
|
|
@@ -61,7 +61,6 @@ async function bootstrap() {
|
|
|
61
61
|
apiReference({
|
|
62
62
|
content: await createDocs(app, {
|
|
63
63
|
description: "{{description}}",
|
|
64
|
-
title: "{{projectNamePascalCase}} API",
|
|
65
64
|
integrations: {
|
|
66
65
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless") hasBetterAuthWithoutRest)}}
|
|
67
66
|
betterAuth: {
|
|
@@ -79,17 +78,17 @@ async function bootstrap() {
|
|
|
79
78
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
80
79
|
},
|
|
81
80
|
},
|
|
81
|
+
title: "{{projectNamePascalCase}} API",
|
|
82
82
|
version: "1.0.0",
|
|
83
83
|
}),
|
|
84
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
84
85
|
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
85
86
|
theme: "default",
|
|
86
87
|
}),
|
|
87
88
|
);
|
|
88
89
|
{{else}}
|
|
89
90
|
const document = await createDocs(app, {
|
|
90
|
-
title: "{{projectNamePascalCase}} API",
|
|
91
91
|
description: "{{description}}",
|
|
92
|
-
version: "1.0.0",
|
|
93
92
|
integrations: {
|
|
94
93
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless") hasBetterAuthWithoutRest)}}
|
|
95
94
|
betterAuth: {
|
|
@@ -107,12 +106,14 @@ async function bootstrap() {
|
|
|
107
106
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
108
107
|
},
|
|
109
108
|
},
|
|
109
|
+
title: "{{projectNamePascalCase}} API",
|
|
110
|
+
version: "1.0.0",
|
|
110
111
|
});
|
|
111
112
|
SwaggerModule.setup(docsPath, app, document);
|
|
112
113
|
{{/if}}
|
|
113
114
|
Logger.log(`Swagger documentation available at http://localhost:${env.PORT}${docsPath}`, "SwaggerDocs");
|
|
114
115
|
{{/if}}
|
|
115
|
-
await app.listen(env.PORT);
|
|
116
|
+
await app.listen(env.PORT, "0.0.0.0");
|
|
116
117
|
{{#if hasRest}}
|
|
117
118
|
Logger.log(`Started backend server on http://localhost:${env.PORT}/api`, "Main");
|
|
118
119
|
{{else if hasTrpc}}
|
|
@@ -184,7 +184,11 @@ describe("AppController (e2e)", () => {
|
|
|
184
184
|
},
|
|
185
185
|
});
|
|
186
186
|
{{#if useSwaggerScalar}}
|
|
187
|
-
app.use("/docs", apiReference({
|
|
187
|
+
app.use("/docs", apiReference({
|
|
188
|
+
content: generatedOpenApi,
|
|
189
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
190
|
+
theme: "default",
|
|
191
|
+
}));
|
|
188
192
|
{{/if}}
|
|
189
193
|
{{/if}}
|
|
190
194
|
await app.init();
|
|
@@ -236,7 +240,7 @@ describe("AppController (e2e)", () => {
|
|
|
236
240
|
{{/if}}
|
|
237
241
|
|
|
238
242
|
{{#if swagger}}
|
|
239
|
-
it("generates authenticated OpenAPI docs and serves the Scalar reference", async () => {
|
|
243
|
+
it("generates authenticated OpenAPI docs and serves the Scalar reference", {{#if useSwaggerScalar}}async {{/if}}() => {
|
|
240
244
|
expect(generatedOpenApi.openapi).toMatch(/^3\./u);
|
|
241
245
|
{{#if isBetterAuth}}
|
|
242
246
|
expect(generatedOpenApi.paths?.["/api/auth/sign-up/email"]).toBeDefined();
|
|
@@ -19,7 +19,7 @@ async function getFreePort(): Promise<number> {
|
|
|
19
19
|
return address.port;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
async function waitForServer(url: string, application: ChildProcess, deadline = Date.now() +
|
|
22
|
+
async function waitForServer(url: string, application: ChildProcess, deadline = Date.now() + 60000): Promise<Response> {
|
|
23
23
|
if (application.exitCode !== null) throw new Error(`Generated application exited during startup with code ${application.exitCode}.`);
|
|
24
24
|
try {
|
|
25
25
|
return await fetch(url, { signal: AbortSignal.timeout(500) });
|
|
@@ -81,4 +81,4 @@ it("boots the compiled application through main.ts", async () => {
|
|
|
81
81
|
const body = await response.json();
|
|
82
82
|
expect(body.data.hello).toBe("Hello GraphQL!");
|
|
83
83
|
{{/if}}
|
|
84
|
-
},
|
|
84
|
+
}, 65_000);
|
|
@@ -10,7 +10,7 @@ RUN corepack enable
|
|
|
10
10
|
{{/if}}
|
|
11
11
|
|
|
12
12
|
COPY . .
|
|
13
|
-
RUN POSTGRES_URL=postgresql://postgres:postgres@postgres:5432/build_db MYSQL_URL=mysql://root:mysql@mysql:3306/build_db MONGODB_URL=mongodb://mongodb:27017/build_db {{#if (eq auth "passport")}}JWT_ACCESS_SECRET=build-only-access-secret-that-is-long-enough JWT_REFRESH_SECRET=build-only-refresh-secret-that-is-long-enough {{/if}}{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}BETTER_AUTH_SECRET=build-only-better-auth-secret-that-is-long-enough BETTER_AUTH_URL=http://localhost:{{#if (eq httpProvider "fastify")}}3001{{else}}3000{{/if}} {{/if}}{{#if (eq packageManager "pnpm")}}pnpm install --no-lockfile{{else if (eq packageManager "yarn")}}yarn install{{else if (eq packageManager "bun")}}bun install{{
|
|
13
|
+
RUN POSTGRES_URL=postgresql://postgres:postgres@postgres:5432/build_db MYSQL_URL=mysql://root:mysql@mysql:3306/build_db MONGODB_URL=mongodb://mongodb:27017/build_db {{#if hasSqlserver}}SQLSERVER_HOST=localhost SQLSERVER_PORT=1433 SQLSERVER_DATABASE=build_db SQLSERVER_USER=sa SQLSERVER_PASSWORD=Build_only_Password_2026!X9 SQLSERVER_ENCRYPT=true SQLSERVER_TRUST_SERVER_CERTIFICATE=true {{/if}}{{#if (eq auth "passport")}}JWT_ACCESS_SECRET=build-only-access-secret-that-is-long-enough JWT_REFRESH_SECRET=build-only-refresh-secret-that-is-long-enough {{/if}}{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}BETTER_AUTH_SECRET=build-only-better-auth-secret-that-is-long-enough BETTER_AUTH_URL=http://localhost:{{#if (eq httpProvider "fastify")}}3001{{else}}3000{{/if}} {{/if}}{{#if (eq packageManager "pnpm")}}pnpm install --no-lockfile{{else if (eq packageManager "yarn")}}yarn install{{else if (eq packageManager "bun")}}bun install{{/if}}
|
|
14
14
|
RUN {{#if (eq packageManager "pnpm")}}pnpm run{{else if (eq packageManager "yarn")}}yarn{{else if (eq packageManager "bun")}}bun run{{else}}npm run{{/if}} build
|
|
15
15
|
|
|
16
16
|
ENV NODE_ENV=production
|
|
@@ -41,9 +41,7 @@ async function bootstrap() {
|
|
|
41
41
|
docsPath,
|
|
42
42
|
apiReference({
|
|
43
43
|
content: await createDocs(app, {
|
|
44
|
-
title: "{{projectNamePascalCase}} API",
|
|
45
44
|
description: "{{description}}",
|
|
46
|
-
version: "1.0.0",
|
|
47
45
|
integrations: {
|
|
48
46
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
49
47
|
betterAuth: {
|
|
@@ -61,16 +59,17 @@ async function bootstrap() {
|
|
|
61
59
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
62
60
|
},
|
|
63
61
|
},
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
title: "{{projectNamePascalCase}} API",
|
|
63
|
+
version: "1.0.0",
|
|
64
|
+
}),
|
|
65
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
66
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
66
67
|
theme: "default",
|
|
67
68
|
}),
|
|
68
69
|
);
|
|
69
70
|
{{else}}
|
|
70
71
|
const document = await createDocs(app, {
|
|
71
|
-
title: "{{projectNamePascalCase}} API",
|
|
72
72
|
description: "{{description}}",
|
|
73
|
-
version: "1.0.0",
|
|
74
73
|
integrations: {
|
|
75
74
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
76
75
|
betterAuth: {
|
|
@@ -88,13 +87,15 @@ async function bootstrap() {
|
|
|
88
87
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
89
88
|
},
|
|
90
89
|
},
|
|
90
|
+
title: "{{projectNamePascalCase}} API",
|
|
91
|
+
version: "1.0.0",
|
|
91
92
|
});
|
|
92
93
|
SwaggerModule.setup(docsPath, app, document);
|
|
93
94
|
{{/if}}
|
|
94
95
|
Logger.log(`Swagger documentation available at http://localhost:${env.PORT ?? 3000}${docsPath}`, "SwaggerDocs");
|
|
95
96
|
}
|
|
96
97
|
{{/if}}
|
|
97
|
-
await app.listen(env.PORT ?? 3000);
|
|
98
|
+
await app.listen(env.PORT ?? 3000, "0.0.0.0");
|
|
98
99
|
{{#if hasRest}}
|
|
99
100
|
Logger.log(`Started backend server on http://localhost:${env.PORT ?? 3000}/api`, "Main");
|
|
100
101
|
{{else if hasTrpc}}
|
|
@@ -13,6 +13,15 @@ MYSQL_URL=mysql://root:mysql@localhost:3306/{{projectNameKebab}}_db
|
|
|
13
13
|
{{#if hasSqlite}}
|
|
14
14
|
SQLITE_PATH=file:./src/database/dev.db
|
|
15
15
|
{{/if}}
|
|
16
|
+
{{#if hasSqlserver}}
|
|
17
|
+
SQLSERVER_HOST=localhost
|
|
18
|
+
SQLSERVER_PORT=1433
|
|
19
|
+
SQLSERVER_DATABASE={{projectNameKebab}}_db
|
|
20
|
+
SQLSERVER_USER=sa
|
|
21
|
+
SQLSERVER_PASSWORD=DevOnly_Strong_Password_2026!X9
|
|
22
|
+
SQLSERVER_ENCRYPT=true
|
|
23
|
+
SQLSERVER_TRUST_SERVER_CERTIFICATE=true
|
|
24
|
+
{{/if}}
|
|
16
25
|
{{#if hasMongodb}}
|
|
17
26
|
MONGODB_URL=mongodb://localhost:27017/{{projectNameKebab}}_db
|
|
18
27
|
{{/if}}
|
|
@@ -61,9 +61,7 @@ async function bootstrap() {
|
|
|
61
61
|
docsPath,
|
|
62
62
|
apiReference({
|
|
63
63
|
content: await createDocs(app, {
|
|
64
|
-
title: "{{projectNamePascalCase}} API",
|
|
65
64
|
description: "{{description}}",
|
|
66
|
-
version: "1.0.0",
|
|
67
65
|
integrations: {
|
|
68
66
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
69
67
|
betterAuth: {
|
|
@@ -81,16 +79,17 @@ async function bootstrap() {
|
|
|
81
79
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
82
80
|
},
|
|
83
81
|
},
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
title: "{{projectNamePascalCase}} API",
|
|
83
|
+
version: "1.0.0",
|
|
84
|
+
}),
|
|
85
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
86
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
86
87
|
theme: "default",
|
|
87
88
|
}),
|
|
88
89
|
);
|
|
89
90
|
{{else}}
|
|
90
91
|
const document = await createDocs(app, {
|
|
91
|
-
title: "{{projectNamePascalCase}} API",
|
|
92
92
|
description: "{{description}}",
|
|
93
|
-
version: "1.0.0",
|
|
94
93
|
integrations: {
|
|
95
94
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
96
95
|
betterAuth: {
|
|
@@ -108,6 +107,8 @@ async function bootstrap() {
|
|
|
108
107
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
109
108
|
},
|
|
110
109
|
},
|
|
110
|
+
title: "{{projectNamePascalCase}} API",
|
|
111
|
+
version: "1.0.0",
|
|
111
112
|
});
|
|
112
113
|
SwaggerModule.setup(docsPath, app, document);
|
|
113
114
|
{{/if}}
|
|
@@ -115,7 +116,7 @@ async function bootstrap() {
|
|
|
115
116
|
}
|
|
116
117
|
{{/if}}
|
|
117
118
|
|
|
118
|
-
await app.listen(env.PORT);
|
|
119
|
+
await app.listen(env.PORT, "0.0.0.0");
|
|
119
120
|
{{#if hasRest}}
|
|
120
121
|
Logger.log(`Started backend server on http://localhost:${env.PORT}/api`, "Main");
|
|
121
122
|
{{else if hasTrpc}}
|
|
@@ -33,9 +33,7 @@ async function bootstrap() {
|
|
|
33
33
|
docsPath,
|
|
34
34
|
apiReference({
|
|
35
35
|
content: await createDocs(app, {
|
|
36
|
-
title: "{{projectNamePascalCase}} API",
|
|
37
36
|
description: "{{description}}",
|
|
38
|
-
version: "1.0.0",
|
|
39
37
|
integrations: {
|
|
40
38
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
41
39
|
betterAuth: {
|
|
@@ -53,16 +51,17 @@ async function bootstrap() {
|
|
|
53
51
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
54
52
|
},
|
|
55
53
|
},
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
title: "{{projectNamePascalCase}} API",
|
|
55
|
+
version: "1.0.0",
|
|
56
|
+
}),
|
|
57
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
58
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
58
59
|
theme: "default",
|
|
59
60
|
}),
|
|
60
61
|
);
|
|
61
62
|
{{else}}
|
|
62
63
|
const document = await createDocs(app, {
|
|
63
|
-
title: "{{projectNamePascalCase}} API",
|
|
64
64
|
description: "{{description}}",
|
|
65
|
-
version: "1.0.0",
|
|
66
65
|
integrations: {
|
|
67
66
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
68
67
|
betterAuth: {
|
|
@@ -80,6 +79,8 @@ async function bootstrap() {
|
|
|
80
79
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
81
80
|
},
|
|
82
81
|
},
|
|
82
|
+
title: "{{projectNamePascalCase}} API",
|
|
83
|
+
version: "1.0.0",
|
|
83
84
|
});
|
|
84
85
|
SwaggerModule.setup(docsPath, app, document);
|
|
85
86
|
{{/if}}
|
|
@@ -87,7 +88,7 @@ async function bootstrap() {
|
|
|
87
88
|
}
|
|
88
89
|
{{/if}}
|
|
89
90
|
|
|
90
|
-
await app.listen(env.PORT ?? 3000);
|
|
91
|
+
await app.listen(env.PORT ?? 3000, "0.0.0.0");
|
|
91
92
|
{{#if hasRest}}
|
|
92
93
|
Logger.log(`Started backend server on http://localhost:${env.PORT ?? 3000}/api`, "Main");
|
|
93
94
|
{{else if hasTrpc}}
|
|
@@ -68,9 +68,7 @@ async function bootstrap() {
|
|
|
68
68
|
docsPath,
|
|
69
69
|
apiReference({
|
|
70
70
|
content: await createDocs(app, {
|
|
71
|
-
title: "{{projectNamePascalCase}} API",
|
|
72
71
|
description: "{{description}}",
|
|
73
|
-
version: "1.0.0",
|
|
74
72
|
integrations: {
|
|
75
73
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
76
74
|
betterAuth: {
|
|
@@ -88,16 +86,17 @@ async function bootstrap() {
|
|
|
88
86
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
89
87
|
},
|
|
90
88
|
},
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
title: "{{projectNamePascalCase}} API",
|
|
90
|
+
version: "1.0.0",
|
|
91
|
+
}),
|
|
92
|
+
{{#if (eq httpProvider "fastify")}}withFastify: true,{{/if}}
|
|
93
|
+
pageTitle: "{{projectNamePascalCase}} API Docs",
|
|
93
94
|
theme: "default",
|
|
94
95
|
}),
|
|
95
96
|
);
|
|
96
97
|
{{else}}
|
|
97
98
|
const document = await createDocs(app, {
|
|
98
|
-
title: "{{projectNamePascalCase}} API",
|
|
99
99
|
description: "{{description}}",
|
|
100
|
-
version: "1.0.0",
|
|
101
100
|
integrations: {
|
|
102
101
|
{{#if (or (eq auth "better-auth") (eq auth "better-auth:stateless"))}}
|
|
103
102
|
betterAuth: {
|
|
@@ -115,6 +114,8 @@ async function bootstrap() {
|
|
|
115
114
|
withFastify: {{#if (eq httpProvider "fastify")}}true{{else}}false{{/if}},
|
|
116
115
|
},
|
|
117
116
|
},
|
|
117
|
+
title: "{{projectNamePascalCase}} API",
|
|
118
|
+
version: "1.0.0",
|
|
118
119
|
});
|
|
119
120
|
SwaggerModule.setup(docsPath, app, document);
|
|
120
121
|
{{/if}}
|
|
@@ -123,7 +124,7 @@ async function bootstrap() {
|
|
|
123
124
|
{{/if}}
|
|
124
125
|
|
|
125
126
|
await app.startAllMicroservices();
|
|
126
|
-
await app.listen(env.PORT ?? 3000);
|
|
127
|
+
await app.listen(env.PORT ?? 3000, "0.0.0.0");
|
|
127
128
|
{{#if hasRest}}
|
|
128
129
|
Logger.log(`Started backend server on http://localhost:${env.PORT ?? 3000}/api`, "Main");
|
|
129
130
|
{{else if hasTrpc}}
|
|
@@ -64,6 +64,15 @@ export const env = createEnv({
|
|
|
64
64
|
{{#if hasSqlite}}
|
|
65
65
|
SQLITE_PATH: z.string().default("sqlite.db"),
|
|
66
66
|
{{/if}}
|
|
67
|
+
{{#if hasSqlserver}}
|
|
68
|
+
SQLSERVER_HOST: z.string().default("localhost"),
|
|
69
|
+
SQLSERVER_PORT: z.string().transform(Number).default(1433),
|
|
70
|
+
SQLSERVER_DATABASE: z.string().default("{{projectNameKebab}}_db"),
|
|
71
|
+
SQLSERVER_USER: z.string(),
|
|
72
|
+
SQLSERVER_PASSWORD: z.string(),
|
|
73
|
+
SQLSERVER_ENCRYPT: z.string().transform((value) => value !== "false").default(true),
|
|
74
|
+
SQLSERVER_TRUST_SERVER_CERTIFICATE: z.string().transform((value) => value === "true").default(false),
|
|
75
|
+
{{/if}}
|
|
67
76
|
{{#if hasMongodb}}
|
|
68
77
|
MONGODB_URL: z.url(),
|
|
69
78
|
{{/if}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-arch/tui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactive terminal UI for generating NestJS projects",
|
|
6
6
|
"keywords": [
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"pkgroll": "^2.5.2",
|
|
52
52
|
"tsx": "^4.19.2",
|
|
53
53
|
"vitest": "^4.1.7",
|
|
54
|
-
"@nest-arch/core": "0.4.3",
|
|
55
54
|
"@nest-arch/env": "0.0.0",
|
|
55
|
+
"@nest-arch/core": "0.4.3",
|
|
56
56
|
"@nest-arch/shared": "0.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|