@nest-arch/tui 0.1.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 (68) hide show
  1. package/README.md +53 -0
  2. package/dist/cli.js +2 -0
  3. package/dist/index-BEmiTZdl.js +31157 -0
  4. package/dist/index-CAPJ7KZy.js +4 -0
  5. package/dist/index.js +1 -0
  6. package/dist/templates/addons/husky/pre-commit.hbs +31 -0
  7. package/dist/templates/base/.env.hbs +2 -0
  8. package/dist/templates/base/.gitignore.hbs +56 -0
  9. package/dist/templates/base/.yarnrc.yml.hbs +6 -0
  10. package/dist/templates/base/README.md.hbs +37 -0
  11. package/dist/templates/base/nest-cli.json.hbs +8 -0
  12. package/dist/templates/base/pnpm-workspace.yaml.hbs +2 -0
  13. package/dist/templates/base/src/app.controller.spec.ts.hbs +25 -0
  14. package/dist/templates/base/src/app.controller.ts.hbs +13 -0
  15. package/dist/templates/base/src/app.module.ts.hbs +11 -0
  16. package/dist/templates/base/src/app.service.ts.hbs +8 -0
  17. package/dist/templates/base/src/main.ts.hbs +14 -0
  18. package/dist/templates/base/test/app.e2e-spec.ts.hbs +22 -0
  19. package/dist/templates/base/tsconfig.build.json.hbs +12 -0
  20. package/dist/templates/base/tsconfig.json.hbs +27 -0
  21. package/dist/templates/base/vitest.config.e2e.ts.hbs +9 -0
  22. package/dist/templates/base/vitest.config.ts.hbs +9 -0
  23. package/dist/templates/extras/docker/.dockerignore.hbs +1 -0
  24. package/dist/templates/extras/docker/Dockerfile.hbs +2 -0
  25. package/dist/templates/extras/docker/docker-compose.yml.hbs +3 -0
  26. package/dist/templates/extras/swagger/dependencies.hbs +1 -0
  27. package/dist/templates/monorepo/apps/api-gateway/nest-cli.json.hbs +8 -0
  28. package/dist/templates/monorepo/apps/api-gateway/package.json.hbs +49 -0
  29. package/dist/templates/monorepo/apps/api-gateway/src/app.controller.spec.ts.hbs +25 -0
  30. package/dist/templates/monorepo/apps/api-gateway/src/app.controller.ts.hbs +13 -0
  31. package/dist/templates/monorepo/apps/api-gateway/src/app.module.ts.hbs +11 -0
  32. package/dist/templates/monorepo/apps/api-gateway/src/app.service.ts.hbs +8 -0
  33. package/dist/templates/monorepo/apps/api-gateway/src/main.ts.hbs +13 -0
  34. package/dist/templates/monorepo/apps/api-gateway/test/app.e2e-spec.ts.hbs +22 -0
  35. package/dist/templates/monorepo/apps/api-gateway/tsconfig.build.json.hbs +9 -0
  36. package/dist/templates/monorepo/apps/api-gateway/tsconfig.json.hbs +4 -0
  37. package/dist/templates/monorepo/apps/api-gateway/vitest.config.e2e.ts.hbs +9 -0
  38. package/dist/templates/monorepo/apps/api-gateway/vitest.config.ts.hbs +9 -0
  39. package/dist/templates/monorepo/packages/config/package.json.hbs +5 -0
  40. package/dist/templates/monorepo/packages/config/tsconfig.base.json.hbs +22 -0
  41. package/dist/templates/monorepo/packages/config/tsconfig.nestjs.json.hbs +24 -0
  42. package/dist/templates/monorepo/packages/env/package.json.hbs +19 -0
  43. package/dist/templates/monorepo/packages/env/src/api-gateway.ts.hbs +37 -0
  44. package/dist/templates/monorepo/packages/env/tsconfig.json.hbs +4 -0
  45. package/dist/templates/monorepo/packages/shared/package.json.hbs +17 -0
  46. package/dist/templates/monorepo/packages/shared/tsconfig.json.hbs +4 -0
  47. package/dist/templates/monorepo/root/.gitignore.hbs +48 -0
  48. package/dist/templates/monorepo/root/.yarnrc.yml.hbs +6 -0
  49. package/dist/templates/monorepo/root/README.md.hbs +33 -0
  50. package/dist/templates/monorepo/root/package.json.hbs +35 -0
  51. package/dist/templates/monorepo/root/pnpm-workspace.yaml.hbs +11 -0
  52. package/dist/templates/monorepo/root/tsconfig.json.hbs +3 -0
  53. package/dist/templates/monorepo/root/turbo.json.hbs +21 -0
  54. package/dist/templates/single-project/architecture/nest-api/.env.hbs +2 -0
  55. package/dist/templates/single-project/architecture/nest-api/package.json.hbs +49 -0
  56. package/dist/templates/single-project/architecture/nest-api/pnpm-workspace.yaml.hbs +4 -0
  57. package/dist/templates/single-project/architecture/nest-api/src/main.ts.hbs +15 -0
  58. package/dist/templates/single-project/architecture/nest-gateway/src/app.controller.ts.hbs +19 -0
  59. package/dist/templates/single-project/architecture/nest-gateway/src/app.module.ts.hbs +12 -0
  60. package/dist/templates/single-project/architecture/nest-gateway/src/app.service.ts.hbs +26 -0
  61. package/dist/templates/single-project/architecture/nest-gateway/src/main.ts.hbs +15 -0
  62. package/dist/templates/single-project/architecture/nest-microservice/.env.hbs +3 -0
  63. package/dist/templates/single-project/architecture/nest-microservice/src/app.controller.ts.hbs +18 -0
  64. package/dist/templates/single-project/architecture/nest-microservice/src/app.module.ts.hbs +11 -0
  65. package/dist/templates/single-project/architecture/nest-microservice/src/app.service.ts.hbs +12 -0
  66. package/dist/templates/single-project/architecture/nest-microservice/src/main.ts.hbs +21 -0
  67. package/dist/templates/single-project/shared/config/env.ts.hbs +37 -0
  68. package/package.json +63 -0
@@ -0,0 +1,4 @@
1
+ var i=Object.defineProperty;var r=(e,a)=>i(e,"name",{value:a,configurable:!0});import{e as t}from"./index-BEmiTZdl.js";import"react/jsx-runtime";import"ink";import"react";import"ink-text-input";import"node:fs";import"node:os";import"node:path";import"node:fs/promises";import"fs";import"node:child_process";import"node:util";import"path";import"os";import"inspector";import"util";import"stream";import"events";import"fs/promises";import"open";function s(e){return[`pnpm create nest-arch@latest ${e.projectName}`,`--package-manager ${e.packageManager}`,`--http-provider ${e.httpProvider}`,`--project-type ${e.projectType}`,`--architecture ${e.architecture}`,`--database ${e.database.length>0?e.database.join(" "):"none"}`,`--orm ${e.orm.length>0?e.orm.join(" "):"none"}`,`--api ${e.api.length>0?e.api.join(" "):"none"}`,`--auth ${e.auth}`,`--extras ${e.extras.length>0?e.extras.join(" "):"none"}`,`--microservices ${e.microservices.length>0?e.microservices.join(" "):"none"}`,`--addons ${e.addons.length>0?e.addons.join(" "):"none"}`,e.initGit?"--git":"--no-git"].join(" ")}r(s,"buildReproducibleCommand");function p(e){return{$schema:t.NEST_ARCH_SCHEMA_URL,addons:e.addons,api:e.api,architecture:e.architecture,auth:e.auth,createdAt:new Date().toISOString(),database:e.database,description:e.description,extras:e.extras,httpProvider:e.httpProvider,initGit:e.initGit,microservices:e.microservices,orm:e.orm,packageManager:e.packageManager,projectName:e.projectName,projectType:e.projectType,reproducibleCommand:s(e),version:t.NEST_ARCH_VERSION}}r(p,"buildMetadata");function o(e){return`${["// nest-arch","//","// Project scaffolding tool for NestJS applications","//","// This file records the options used to generate this project.","// It can be used to reproduce the exact same project setup.","// This file is safe to delete.",""].join(`
2
+ `)+JSON.stringify(e,null,2)}
3
+ `}r(o,"serializeMetadata");function n(){return`${JSON.stringify({$schema:"http://json-schema.org/draft-07/schema#",description:"NestArch project configuration metadata file schema",properties:{$schema:{type:"string"},addons:{items:{enum:["agent-skills","husky","ultracite","nestjs-zod","scalar-ui"]},type:"array"},api:{items:{enum:["rest","trpc","graphql"]},type:"array"},architecture:{enum:["nest-api","nest-gateway","nest-microservice"]},auth:{enum:["jwt","passport","better-auth","none"]},createdAt:{format:"date-time",type:"string"},database:{items:{enum:["postgresql","mysql","sqlite","mongodb"]},type:"array"},description:{type:"string"},extras:{items:{enum:["docker","health-check","rate-limiting","swagger","packages/shared"]},type:"array"},httpProvider:{enum:["express","fastify"]},initGit:{type:"boolean"},microservices:{items:{enum:["redis","mqtt","nats","rabbitmq","kafka","grpc"]},type:"array"},orm:{items:{enum:["prisma","typeorm","drizzle"]},type:"array"},packageManager:{enum:["pnpm","npm","yarn","bun"]},projectName:{type:"string"},projectType:{enum:["single","monorepo"]},reproducibleCommand:{type:"string"},version:{type:"string"}},required:["version","createdAt","reproducibleCommand","projectName","packageManager","httpProvider","projectType","architecture","database","orm","api","auth","extras","microservices","addons","initGit"],title:"NestArchMetadata",type:"object"},null,2)}
4
+ `}r(n,"buildSchemaContent");export{p as buildMetadata,n as buildSchemaContent,o as serializeMetadata};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import"react/jsx-runtime";import"ink";import"react";import"./index-BEmiTZdl.js";import"ink-text-input";import"node:fs";import"node:os";import"node:path";import"node:fs/promises";import"fs";import"node:child_process";import"node:util";import"path";import"os";import"inspector";import"util";import"stream";import"events";import"fs/promises";import"open";
@@ -0,0 +1,31 @@
1
+ {{#if isPnpm}}pnpm test{{else if isYarn}}yarn test{{else if isBun}}bun run test{{else}}npm test{{/if}}
2
+
3
+ # ultracite
4
+ #!/bin/sh
5
+ # Exit on any error
6
+ set -e
7
+
8
+ # Check if there are any staged files
9
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
10
+ if [ -z "$STAGED_FILES" ]; then
11
+ echo "No staged files to format"
12
+ exit 0
13
+ fi
14
+
15
+ # Run formatter
16
+ {{#if isPnpm}}pnpm dlx ultracite fix{{else if isYarn}}yarn dlx ultracite fix{{else if isBun}}bunx ultracite fix{{else}}npx ultracite fix{{/if}}
17
+ FORMAT_EXIT_CODE=$?
18
+
19
+ # Re-stage files that were already staged
20
+ echo "$STAGED_FILES" | while IFS= read -r file; do
21
+ if [ -f "$file" ]; then
22
+ git add -- "$file"
23
+ fi
24
+ done
25
+
26
+ if [ $FORMAT_EXIT_CODE -ne 0 ]; then
27
+ echo "Ultracite found issues that could not be auto-fixed."
28
+ exit $FORMAT_EXIT_CODE
29
+ fi
30
+
31
+ echo "✨ Files formatted by Ultracite"
@@ -0,0 +1,2 @@
1
+ CORS_ORIGIN=http://localhost:3001
2
+ PORT=3000
@@ -0,0 +1,56 @@
1
+ # compiled output
2
+ /dist
3
+ /node_modules
4
+ /build
5
+
6
+ # Logs
7
+ logs
8
+ *.log
9
+ npm-debug.log*
10
+ pnpm-debug.log*
11
+ yarn-debug.log*
12
+ yarn-error.log*
13
+ lerna-debug.log*
14
+
15
+ # OS
16
+ .DS_Store
17
+
18
+ # Tests
19
+ /coverage
20
+ /.nyc_output
21
+
22
+ # IDEs and editors
23
+ /.idea
24
+ .project
25
+ .classpath
26
+ .c9/
27
+ *.launch
28
+ .settings/
29
+ *.sublime-workspace
30
+
31
+ # IDE - VSCode
32
+ .vscode/*
33
+ !.vscode/settings.json
34
+ !.vscode/tasks.json
35
+ !.vscode/launch.json
36
+ !.vscode/extensions.json
37
+
38
+ # dotenv environment variable files
39
+ .env
40
+ .env.development.local
41
+ .env.test.local
42
+ .env.production.local
43
+ .env.local
44
+
45
+ # temp directory
46
+ .temp
47
+ .tmp
48
+
49
+ # Runtime data
50
+ pids
51
+ *.pid
52
+ *.seed
53
+ *.pid.lock
54
+
55
+ # Diagnostic reports (https://nodejs.org/api/report.html)
56
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -0,0 +1,6 @@
1
+ nodeLinker: node-modules
2
+ catalog:
3
+ "@types/node": ^22.13.14
4
+ dotenv: ^17.2.2
5
+ typescript: ^6.0.2
6
+ zod: ^4.4.3
@@ -0,0 +1,37 @@
1
+ # {{projectName}}
2
+
3
+ {{description}}
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ {{#if isPnpm}}pnpm install{{else if isYarn}}yarn install{{else if isBun}}bun install{{else}}npm install{{/if}}
10
+ ```
11
+
12
+ ## Running the App
13
+
14
+ ```bash
15
+ # development mode (live reload)
16
+ {{#if isPnpm}}pnpm dev{{else if isYarn}}yarn dev{{else if isBun}}bun run dev{{else}}npm run dev{{/if}}
17
+
18
+ # build and production mode
19
+ {{#if isPnpm}}pnpm build
20
+ pnpm start{{else if isYarn}}yarn build
21
+ yarn start{{else if isBun}}bun run build
22
+ bun run start{{else}}npm run build
23
+ npm run start{{/if}}
24
+ ```
25
+
26
+ ## Testing
27
+
28
+ ```bash
29
+ # unit tests
30
+ {{#if isPnpm}}pnpm test{{else if isYarn}}yarn test{{else if isBun}}bun run test{{else}}npm test{{/if}}
31
+
32
+ # e2e tests
33
+ {{#if isPnpm}}pnpm test:e2e{{else if isYarn}}yarn test:e2e{{else if isBun}}bun run test:e2e{{else}}npm run test:e2e{{/if}}
34
+
35
+ # test coverage
36
+ {{#if isPnpm}}pnpm test:cov{{else if isYarn}}yarn test:cov{{else if isBun}}bun run test:cov{{else}}npm run test:cov{{/if}}
37
+ ```
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/nest-cli",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "compilerOptions": {
6
+ "deleteOutDir": true
7
+ }
8
+ }
@@ -0,0 +1,2 @@
1
+ allowBuilds:
2
+ "@nestjs/core": true
@@ -0,0 +1,25 @@
1
+ import type { TestingModule } from "@nestjs/testing";
2
+ import { Test } from "@nestjs/testing";
3
+ import { beforeEach, describe, expect, it } from "vitest";
4
+
5
+ import { AppController } from "./app.controller.js";
6
+ import { AppService } from "./app.service.js";
7
+
8
+ describe(AppController, () => {
9
+ let appController: AppController;
10
+
11
+ beforeEach(async () => {
12
+ const app: TestingModule = await Test.createTestingModule({
13
+ controllers: [AppController],
14
+ providers: [AppService],
15
+ }).compile();
16
+
17
+ appController = app.get<AppController>(AppController);
18
+ });
19
+
20
+ describe("root", () => {
21
+ it('should return "Hello World!"', () => {
22
+ expect(appController.getHello()).toBe("Hello World!");
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,13 @@
1
+ import { Controller, Get } from "@nestjs/common";
2
+
3
+ import { AppService } from "./app.service.js";
4
+
5
+ @Controller()
6
+ export class AppController {
7
+ constructor(private readonly appService: AppService) {}
8
+
9
+ @Get()
10
+ getHello(): string {
11
+ return this.appService.getHello();
12
+ }
13
+ }
@@ -0,0 +1,11 @@
1
+ import { Module } from "@nestjs/common";
2
+
3
+ import { AppController } from "./app.controller.js";
4
+ import { AppService } from "./app.service.js";
5
+
6
+ @Module({
7
+ controllers: [AppController],
8
+ imports: [],
9
+ providers: [AppService],
10
+ })
11
+ export class AppModule {}
@@ -0,0 +1,8 @@
1
+ import { Injectable } from "@nestjs/common";
2
+
3
+ @Injectable()
4
+ export class AppService {
5
+ getHello(): string {
6
+ return "Hello World!";
7
+ }
8
+ }
@@ -0,0 +1,14 @@
1
+ import { NestFactory } from "@nestjs/core";
2
+
3
+ import { AppModule } from "./app.module.js";
4
+ import { env } from "./config/env.js";
5
+
6
+ async function bootstrap() {
7
+ const app = await NestFactory.create(AppModule);
8
+ app.enableCors({
9
+ origin: env.CORS_ORIGIN,
10
+ });
11
+ app.setGlobalPrefix("api");
12
+ await app.listen(env.PORT ?? 3000);
13
+ }
14
+ await bootstrap();
@@ -0,0 +1,22 @@
1
+ import { INestApplication } from "@nestjs/common";
2
+ import { Test, TestingModule } from "@nestjs/testing";
3
+ import request from "supertest";
4
+
5
+ import { AppModule } from "./../src/app.module.js";
6
+
7
+ describe("AppController (e2e)", () => {
8
+ let app: INestApplication;
9
+
10
+ beforeEach(async () => {
11
+ const moduleFixture: TestingModule = await Test.createTestingModule({
12
+ imports: [AppModule],
13
+ }).compile();
14
+
15
+ app = moduleFixture.createNestApplication();
16
+ await app.init();
17
+ });
18
+
19
+ it("/ (GET)", () => {
20
+ return request(app.getHttpServer()).get("/").expect(200).expect("Hello World!");
21
+ });
22
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": [
4
+ "node_modules",
5
+ "test",
6
+ "dist",
7
+ "**/*spec.ts"
8
+ ],
9
+ "compilerOptions": {
10
+ "strictNullChecks": true
11
+ }
12
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "module": "nodenext",
5
+ "moduleResolution": "nodenext",
6
+ "resolvePackageJsonExports": true,
7
+ "esModuleInterop": true,
8
+ "isolatedModules": true,
9
+ "declaration": true,
10
+ "removeComments": true,
11
+ "emitDecoratorMetadata": true,
12
+ "experimentalDecorators": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "target": "ES2023",
15
+ "sourceMap": true,
16
+ "outDir": "./dist",
17
+ "incremental": true,
18
+ "skipLibCheck": true,
19
+ "strict": false,
20
+ "strictPropertyInitialization": false,
21
+ "types": [
22
+ "vitest/globals",
23
+ "node"
24
+ ],
25
+ "strictNullChecks": true
26
+ }
27
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ include: ["**/*.e2e-spec.ts"],
7
+ root: "./",
8
+ },
9
+ });
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ include: ["**/*.spec.ts"],
7
+ root: "./",
8
+ },
9
+ });
@@ -0,0 +1 @@
1
+ node_modules dist npm-debug.log .env
@@ -0,0 +1,2 @@
1
+ FROM node:20-alpine WORKDIR /app COPY package*.json ./ RUN npm install COPY . .
2
+ RUN npm run build EXPOSE 3000 CMD ["npm", "run", "start:prod"]
@@ -0,0 +1,3 @@
1
+ version: '3.8' services:
2
+ {{projectName}}: build: . ports: - "3000:3000" environment: NODE_ENV:
3
+ development PORT: 3000 volumes: - .:/app - /app/node_modules
@@ -0,0 +1 @@
1
+ "@nestjs/swagger": "^7.0.0", "swagger-ui-express": "^5.0.0"
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/nest-cli",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "compilerOptions": {
6
+ "deleteOutDir": true
7
+ }
8
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "description": "{{description}}",
6
+ "license": "UNLICENSED",
7
+ "author": "",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "nest build",
11
+ "dev": "nest start --watch",
12
+ "start": "nest start",
13
+ "start:dev": "nest start --watch",
14
+ "start:debug": "nest start --debug --watch",
15
+ "start:prod": "node dist/main",
16
+ "test": "vitest run",
17
+ "test:watch": "vitest",
18
+ "test:cov": "vitest run --coverage",
19
+ "test:debug": "vitest --inspect-brk --no-file-parallelism",
20
+ "test:e2e": "vitest run --config ./vitest.config.e2e.ts"{{#if hasUltracite}},
21
+ "check": "ultracite check",
22
+ "fix": "ultracite fix"{{/if}}{{#if hasHusky}},
23
+ "prepare": "husky"{{/if}}
24
+ },
25
+ "dependencies": {
26
+ "@nestjs/common": "next",
27
+ "@nestjs/core": "next",
28
+ "@nestjs/platform-{{httpProvider}}": "next",
29
+ "@repo/env": "workspace:*",
30
+ "reflect-metadata": "^0.2.2",
31
+ "rxjs": "^7.8.1",
32
+ "zod": "catalog:"
33
+ },
34
+ "devDependencies": {
35
+ "@nestjs/cli": "next",
36
+ "@nestjs/schematics": "next",
37
+ "@nestjs/testing": "next",
38
+ "@repo/config": "workspace:*",
39
+ "@types/express": "^5.0.0",
40
+ "@types/node": "catalog:",
41
+ "@types/supertest": "^7.0.0",
42
+ "@vitest/coverage-v8": "4.1.6",
43
+ "source-map-support": "^0.5.21",
44
+ "supertest": "^7.0.0",
45
+ "typescript": "catalog:",
46
+ {{#if hasUltracite}}"ultracite": "7.8.0",{{/if}}
47
+ "vitest": "^4.1.2"
48
+ }
49
+ }
@@ -0,0 +1,25 @@
1
+ import type { TestingModule } from "@nestjs/testing";
2
+ import { Test } from "@nestjs/testing";
3
+ import { beforeEach, describe, expect, it } from "vitest";
4
+
5
+ import { AppController } from "./app.controller.js";
6
+ import { AppService } from "./app.service.js";
7
+
8
+ describe(AppController, () => {
9
+ let appController: AppController;
10
+
11
+ beforeEach(async () => {
12
+ const app: TestingModule = await Test.createTestingModule({
13
+ controllers: [AppController],
14
+ providers: [AppService],
15
+ }).compile();
16
+
17
+ appController = app.get<AppController>(AppController);
18
+ });
19
+
20
+ describe("root", () => {
21
+ it('should return "Hello World!"', () => {
22
+ expect(appController.getHello()).toBe("Hello World!");
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,13 @@
1
+ import { Controller, Get } from "@nestjs/common";
2
+
3
+ import { AppService } from "./app.service.js";
4
+
5
+ @Controller()
6
+ export class AppController {
7
+ constructor(private readonly appService: AppService) {}
8
+
9
+ @Get()
10
+ getHello(): string {
11
+ return this.appService.getHello();
12
+ }
13
+ }
@@ -0,0 +1,11 @@
1
+ import { Module } from "@nestjs/common";
2
+
3
+ import { AppController } from "./app.controller.js";
4
+ import { AppService } from "./app.service.js";
5
+
6
+ @Module({
7
+ controllers: [AppController],
8
+ imports: [],
9
+ providers: [AppService],
10
+ })
11
+ export class AppModule {}
@@ -0,0 +1,8 @@
1
+ import { Injectable } from "@nestjs/common";
2
+
3
+ @Injectable()
4
+ export class AppService {
5
+ getHello(): string {
6
+ return "Hello World!";
7
+ }
8
+ }
@@ -0,0 +1,13 @@
1
+ import { NestFactory } from "@nestjs/core";
2
+ import { env } from "@repo/env/api-gateway";
3
+
4
+ import { AppModule } from "./app.module.js";
5
+
6
+ async function bootstrap() {
7
+ const app = await NestFactory.create(AppModule);
8
+ app.enableCors({
9
+ origin: env.CORS_ORIGIN,
10
+ });
11
+ await app.listen(env.PORT ?? 3000);
12
+ }
13
+ await bootstrap();
@@ -0,0 +1,22 @@
1
+ import { INestApplication } from "@nestjs/common";
2
+ import { Test, TestingModule } from "@nestjs/testing";
3
+ import request from "supertest";
4
+
5
+ import { AppModule } from "./../src/app.module.js";
6
+
7
+ describe("AppController (e2e)", () => {
8
+ let app: INestApplication;
9
+
10
+ beforeEach(async () => {
11
+ const moduleFixture: TestingModule = await Test.createTestingModule({
12
+ imports: [AppModule],
13
+ }).compile();
14
+
15
+ app = moduleFixture.createNestApplication();
16
+ await app.init();
17
+ });
18
+
19
+ it("/ (GET)", () => {
20
+ return request(app.getHttpServer()).get("/").expect(200).expect("Hello World!");
21
+ });
22
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
9
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "@repo/config/tsconfig.nestjs.json"
4
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ include: ["**/*.e2e-spec.ts"],
7
+ root: "./",
8
+ },
9
+ });
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ include: ["**/*.spec.ts"],
7
+ root: "./",
8
+ },
9
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@repo/config",
3
+ "version": "0.0.0",
4
+ "private": true
5
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "lib": ["ESNext"],
8
+ "verbatimModuleSyntax": true,
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "resolveJsonModule": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "esModuleInterop": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "isolatedModules": true,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "types": ["node"]
21
+ }
22
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "module": "nodenext",
5
+ "moduleResolution": "nodenext",
6
+ "resolvePackageJsonExports": true,
7
+ "esModuleInterop": true,
8
+ "isolatedModules": true,
9
+ "declaration": true,
10
+ "removeComments": true,
11
+ "emitDecoratorMetadata": true,
12
+ "experimentalDecorators": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "target": "ES2023",
15
+ "sourceMap": true,
16
+ "outDir": "./dist",
17
+ "incremental": true,
18
+ "skipLibCheck": true,
19
+ "strict": false,
20
+ "strictPropertyInitialization": false,
21
+ "types": ["vitest/globals", "node"],
22
+ "strictNullChecks": true
23
+ }
24
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@repo/env",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "exports": {
7
+ "./api-gateway": "./src/api-gateway.ts"
8
+ },
9
+ "dependencies": {
10
+ "@t3-oss/env-core": "^0.13.11",
11
+ "dotenv": "catalog:",
12
+ "zod": "catalog:"
13
+ },
14
+ "devDependencies": {
15
+ "@repo/config": "workspace:*",
16
+ "@types/node": "catalog:",
17
+ "typescript": "catalog:"
18
+ }
19
+ }