@tdk-landscape/tdk-cli-core 1.3.89 → 1.3.91

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/README.md CHANGED
@@ -70,6 +70,15 @@ curl -fsSL https://tdk-landscape.github.io/install.sh | sh
70
70
  - [Architecture and repository map](docs/project-overview.md)
71
71
  - [Scale fixture measurements and caveats](docs/benchmarks/scale-bench.md)
72
72
 
73
+ ## History
74
+
75
+ TDK is older than this repository and its npm package suggest. Development started on 21 April 2026 in
76
+ [tdk-landscape/tdk](https://github.com/tdk-landscape/tdk), now archived and kept as read-only history; its first commit is
77
+ [`1714637`](https://github.com/tdk-landscape/tdk/commit/1714637637196ed54cbfa18534230a782c05ab36) ("Initial commit: TDK specs,
78
+ generators, CLI, and standards"). This repository, `tdk-cli-core`, was created on 19 September 2026 and is where development
79
+ continues; the `@tdk-landscape/tdk-cli-core` package on npm was first published on 21 September 2026. So the code lineage is about
80
+ five months older than the repository and package dates that you will see on GitHub and npm.
81
+
73
82
  ## Requirements and support
74
83
 
75
84
  For the local runtime, install Docker (Desktop, OrbStack, or Colima; Engine 25+, Compose 2.20+) and [Tilt](https://docs.tilt.dev/install.html). Bun 1.2+ is used by the default generated services. TDK selects host ports from bounded fallback ranges for HTTP, HTTPS, and Postgres; set `TDK_HTTP_PORT`, `TDK_HTTPS_PORT`, or `TDK_POSTGRES_PORT` to override them. TDK supports macOS, Linux, and Windows through WSL2 Ubuntu; native Windows supports CLI inspection only. Run `tdk doctor` to check local readiness. See [WSL2 setup](docs/wsl2.md).
@@ -0,0 +1,38 @@
1
+ export function getH3IndexTemplate(name) {
2
+ return `import { createServer } from 'node:http';
3
+ import { createApp, createRouter, defineEventHandler, toNodeListener } from 'h3';
4
+
5
+ const app = createApp();
6
+ const router = createRouter();
7
+
8
+ // Health check endpoint (required by TILT_RESOURCE_DEFAULTS.star)
9
+ router.get('/health', defineEventHandler(() => ({ status: 'ok', service: '${name}' })));
10
+
11
+ router.get('/health/live', defineEventHandler(() => ({ status: 'alive', timestamp: Date.now() })));
12
+
13
+ router.get('/', defineEventHandler(() => ({
14
+ service: '${name}',
15
+ version: '1.0.0',
16
+ endpoints: ['/health', '/health/live']
17
+ })));
18
+
19
+ app.use(router);
20
+
21
+ const port = Number(process.env.PORT || 3000);
22
+
23
+ // node:http works on Bun. Bind beyond loopback: Traefik reaches the container over the Docker network.
24
+ createServer(toNodeListener(app)).listen(port, '0.0.0.0', () => {
25
+ console.log('\\nšŸš€ ${name} running on http://localhost:' + port);
26
+ console.log('šŸ“Š Health check: http://localhost:' + port + '/health\\n');
27
+ });
28
+ `;
29
+ }
30
+ export const h3BackendProvider = {
31
+ id: "h3",
32
+ label: "Bun + h3",
33
+ // h3's npm "latest" tag is a 2.0 release candidate; the scaffold stays on the stable 1.x line.
34
+ dependencies: { h3: "^1.15.0" },
35
+ devDependencies: {},
36
+ createIndex: getH3IndexTemplate,
37
+ };
38
+ //# sourceMappingURL=h3.js.map
@@ -0,0 +1,48 @@
1
+ export function getKoaIndexTemplate(name) {
2
+ return `import Koa from 'koa';
3
+
4
+ const app = new Koa();
5
+
6
+ // Plain Koa middleware, so the scaffold needs no router dependency.
7
+ app.use(async (ctx) => {
8
+ // Health check endpoint (required by TILT_RESOURCE_DEFAULTS.star)
9
+ if (ctx.path === '/health') {
10
+ ctx.body = { status: 'ok', service: '${name}' };
11
+ return;
12
+ }
13
+
14
+ if (ctx.path === '/health/live') {
15
+ ctx.body = { status: 'alive', timestamp: Date.now() };
16
+ return;
17
+ }
18
+
19
+ if (ctx.path === '/') {
20
+ ctx.body = {
21
+ service: '${name}',
22
+ version: '1.0.0',
23
+ endpoints: ['/health', '/health/live']
24
+ };
25
+ return;
26
+ }
27
+
28
+ ctx.status = 404;
29
+ ctx.body = { error: 'not_found' };
30
+ });
31
+
32
+ const port = Number(process.env.PORT || 3000);
33
+
34
+ // Bind beyond loopback: Traefik reaches the container over the Docker network.
35
+ app.listen(port, '0.0.0.0', () => {
36
+ console.log('\\nšŸš€ ${name} running on http://localhost:' + port);
37
+ console.log('šŸ“Š Health check: http://localhost:' + port + '/health\\n');
38
+ });
39
+ `;
40
+ }
41
+ export const koaBackendProvider = {
42
+ id: "koa",
43
+ label: "Bun + Koa",
44
+ dependencies: { koa: "^3.0.0" },
45
+ devDependencies: { "@types/koa": "^3.0.0" },
46
+ createIndex: getKoaIndexTemplate,
47
+ };
48
+ //# sourceMappingURL=koa.js.map
@@ -0,0 +1,56 @@
1
+ export function getNestIndexTemplate(name) {
2
+ return `import 'reflect-metadata';
3
+ import { Controller, Get, Module } from '@nestjs/common';
4
+ import { NestFactory } from '@nestjs/core';
5
+
6
+ @Controller()
7
+ class AppController {
8
+ // Health check endpoint (required by TILT_RESOURCE_DEFAULTS.star)
9
+ @Get('health')
10
+ health() {
11
+ return { status: 'ok', service: '${name}' };
12
+ }
13
+
14
+ @Get('health/live')
15
+ live() {
16
+ return { status: 'alive', timestamp: Date.now() };
17
+ }
18
+
19
+ @Get()
20
+ root() {
21
+ return { service: '${name}', version: '1.0.0', endpoints: ['/health', '/health/live'] };
22
+ }
23
+ }
24
+
25
+ @Module({ controllers: [AppController] })
26
+ class AppModule {}
27
+
28
+ async function bootstrap() {
29
+ const app = await NestFactory.create(AppModule, { logger: ['error', 'warn', 'log'] });
30
+ const port = Number(process.env.PORT || 3000);
31
+
32
+ // Bind beyond loopback: Traefik reaches the container over the Docker network.
33
+ await app.listen(port, '0.0.0.0');
34
+ console.log('\\nšŸš€ ${name} running on http://localhost:' + port);
35
+ console.log('šŸ“Š Health check: http://localhost:' + port + '/health\\n');
36
+ }
37
+
38
+ bootstrap();
39
+ `;
40
+ }
41
+ export const nestBackendProvider = {
42
+ id: "nestjs",
43
+ label: "Bun + NestJS",
44
+ dependencies: {
45
+ "@nestjs/common": "^11.0.0",
46
+ "@nestjs/core": "^11.0.0",
47
+ "@nestjs/platform-express": "^11.0.0",
48
+ "reflect-metadata": "^0.2.2",
49
+ rxjs: "^7.8.1",
50
+ },
51
+ devDependencies: {},
52
+ // Nest's decorators need these; the engine's generated Docker tsconfig already sets them.
53
+ compilerOptions: { experimentalDecorators: true, emitDecoratorMetadata: true },
54
+ createIndex: getNestIndexTemplate,
55
+ };
56
+ //# sourceMappingURL=nestjs.js.map
@@ -3,6 +3,9 @@ import { TdkError } from "../utils/errors.js";
3
3
  import { elysiaBackendProvider } from "./elysia.js";
4
4
  import { expressBackendProvider } from "./express.js";
5
5
  import { fastifyBackendProvider } from "./fastify.js";
6
+ import { h3BackendProvider } from "./h3.js";
7
+ import { koaBackendProvider } from "./koa.js";
8
+ import { nestBackendProvider } from "./nestjs.js";
6
9
  /** Hono is the historical default; omitting --framework keeps the exact historical output. */
7
10
  export const DEFAULT_BACKEND_FRAMEWORK = "hono";
8
11
  export const honoBackendProvider = {
@@ -17,6 +20,9 @@ export const BACKEND_FRAMEWORKS = {
17
20
  express: expressBackendProvider,
18
21
  elysia: elysiaBackendProvider,
19
22
  fastify: fastifyBackendProvider,
23
+ h3: h3BackendProvider,
24
+ koa: koaBackendProvider,
25
+ nestjs: nestBackendProvider,
20
26
  };
21
27
  export function getBackendFramework(frameworkId) {
22
28
  const id = (frameworkId ?? DEFAULT_BACKEND_FRAMEWORK).trim().toLowerCase();
@@ -2,11 +2,13 @@ import { TdkError } from "../utils/errors.js";
2
2
  import { bunBackendProvider } from "./bun.js";
3
3
  import { goBackendProvider } from "./go.js";
4
4
  import { pythonBackendProvider } from "./python.js";
5
+ import { rustBackendProvider } from "./rust.js";
5
6
  export const DEFAULT_BACKEND_LANGUAGE = "bun";
6
7
  export const BACKEND_LANGUAGES = {
7
8
  bun: bunBackendProvider,
8
9
  python: pythonBackendProvider,
9
10
  go: goBackendProvider,
11
+ rust: rustBackendProvider,
10
12
  };
11
13
  export function getBackendLanguage(languageId) {
12
14
  const id = (languageId ?? DEFAULT_BACKEND_LANGUAGE).trim().toLowerCase();
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Rust is compiled into the image and has no reload process, so the dev command is only what a developer
3
+ * would run by hand. Tilt rebuilds the image when a watched file changes (the engine returns no live-update rules).
4
+ */
5
+ export const RUST_DEV_COMMAND = "cargo run";
6
+ export const rustBackendProvider = {
7
+ id: "rust",
8
+ label: "Rust (axum)",
9
+ devCommand: RUST_DEV_COMMAND,
10
+ watch: ["src/**/*.rs", "Cargo.toml", "Cargo.lock"],
11
+ installHint: "cargo build # optional: Docker builds the image for you",
12
+ createFiles(name) {
13
+ return [
14
+ {
15
+ filename: "Cargo.toml",
16
+ content: `[package]
17
+ name = "${name}"
18
+ version = "0.1.0"
19
+ edition = "2021"
20
+
21
+ # The image copies the release binary by this fixed name.
22
+ [[bin]]
23
+ name = "app"
24
+ path = "src/main.rs"
25
+
26
+ [dependencies]
27
+ axum = "0.8"
28
+ serde_json = "1"
29
+ tokio = { version = "1", features = ["macros", "rt-multi-thread", "net"] }
30
+ `,
31
+ description: "Generating Cargo.toml",
32
+ emoji: "šŸ“¦",
33
+ },
34
+ {
35
+ filename: "src/main.rs",
36
+ content: `use axum::{routing::get, Json, Router};
37
+ use serde_json::{json, Value};
38
+
39
+ fn app() -> Router {
40
+ Router::new()
41
+ .route("/", get(root))
42
+ // Health check endpoint (required by TILT_RESOURCE_DEFAULTS.star)
43
+ .route("/health", get(health))
44
+ }
45
+
46
+ async fn root() -> Json<Value> {
47
+ Json(json!({ "service": "${name}", "version": "1.0.0", "endpoints": ["/health"] }))
48
+ }
49
+
50
+ async fn health() -> Json<Value> {
51
+ Json(json!({ "status": "ok", "service": "${name}" }))
52
+ }
53
+
54
+ #[tokio::main]
55
+ async fn main() {
56
+ let port = std::env::var("PORT").unwrap_or_else(|_| "3000".to_string());
57
+
58
+ // 0.0.0.0 listens on every interface, which Traefik needs inside the container network.
59
+ let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{port}"))
60
+ .await
61
+ .expect("failed to bind the port");
62
+ println!("${name} listening on 0.0.0.0:{port}");
63
+ axum::serve(listener, app()).await.expect("server error");
64
+ }
65
+
66
+ #[cfg(test)]
67
+ mod tests {
68
+ use super::*;
69
+
70
+ #[tokio::test]
71
+ async fn health_reports_ok() {
72
+ let Json(body) = health().await;
73
+ assert_eq!(body["status"], "ok");
74
+ }
75
+ }
76
+ `,
77
+ description: "Generating backend source and smoke test",
78
+ emoji: "šŸ’»",
79
+ },
80
+ ];
81
+ },
82
+ };
83
+ //# sourceMappingURL=rust.js.map
@@ -154,11 +154,13 @@ export function createPackageJson(name, type, frameworkId) {
154
154
  }
155
155
  export function createResourceTsconfig(resourceType, frameworkId) {
156
156
  const framework = resolveFrontendFramework(resourceType, frameworkId);
157
+ const backendFramework = resolveBackendFramework(resourceType, frameworkId);
157
158
  return {
158
159
  ...TSCONFIG_TEMPLATE,
159
160
  compilerOptions: {
160
161
  ...TSCONFIG_TEMPLATE.compilerOptions,
161
162
  ...(framework?.compilerOptions ?? {}),
163
+ ...(backendFramework?.compilerOptions ?? {}),
162
164
  },
163
165
  };
164
166
  }
@@ -295,8 +297,8 @@ export const resourceCommand = new Command("resource")
295
297
  .description("Create a new resource (service) from scratch, or register an existing one")
296
298
  .argument("[name]", "Resource name (kebab-case)")
297
299
  .option("-t, --type <type>", "Resource type: backend, frontend, worker, bring-your-own, sdk", "backend")
298
- .option("--framework <id>", "Framework: frontend react (default), vue, svelte, preact, lit, solid, qwik, vanilla; backend hono (default), express, elysia, fastify")
299
- .option("--language <id>", "Backend language: bun (default), python, go")
300
+ .option("--framework <id>", "Framework: frontend react (default), vue, svelte, preact, lit, solid, qwik, vanilla; backend hono (default), express, elysia, fastify, nestjs, koa, h3")
301
+ .option("--language <id>", "Backend language: bun (default), python, go, rust")
300
302
  .option("-s, --stack <stack>", "Stack to assign resource to", "default")
301
303
  .option("-p, --path <path>", "Custom path for resource directory")
302
304
  .option("--resource-path <path>", "Alias for --path (for backward compatibility)")
@@ -620,7 +622,7 @@ This file contains the resource configuration for TDK.
620
622
  {
621
623
  type: "json",
622
624
  filename: "tsconfig.json",
623
- content: createResourceTsconfig(resourceType, frontendFramework?.id),
625
+ content: createResourceTsconfig(resourceType, frontendFramework?.id ?? backendFramework?.id),
624
626
  description: "Generating tsconfig.json",
625
627
  emoji: "āš™ļø",
626
628
  },
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tdk-cli-internal",
3
3
  "private": true,
4
- "version": "1.3.89",
4
+ "version": "1.3.91",
5
5
  "description": "TDK CLI — start services on your laptop.",
6
6
  "keywords": [
7
7
  "tdk",
@@ -238,7 +238,10 @@
238
238
  "hono",
239
239
  "express",
240
240
  "elysia",
241
- "fastify"
241
+ "fastify",
242
+ "nestjs",
243
+ "koa",
244
+ "h3"
242
245
  ],
243
246
  "pattern": "^[a-z][a-z0-9-]*$",
244
247
  "type": "string"
@@ -248,7 +251,8 @@
248
251
  "examples": [
249
252
  "bun",
250
253
  "python",
251
- "go"
254
+ "go",
255
+ "rust"
252
256
  ],
253
257
  "pattern": "^[a-z][a-z0-9-]*$",
254
258
  "type": "string"
@@ -8,12 +8,13 @@
8
8
  BASE_PORT_BACKEND = 4000
9
9
 
10
10
  # Languages whose runtime files are owned by the provider (no Vite/tsconfig/Bun config).
11
- PROVIDER_OWNED_LANGUAGES = ["python", "go"]
11
+ PROVIDER_OWNED_LANGUAGES = ["python", "go", "rust"]
12
12
 
13
13
  # Files a provider-owned language must scaffold; checked before generating anything.
14
14
  LANGUAGE_REQUIRED_FILES = {
15
15
  "python": ["pyproject.toml", "src/main.py"],
16
16
  "go": ["go.mod", "main.go"],
17
+ "rust": ["Cargo.toml", "src/main.rs"],
17
18
  }
18
19
 
19
20
  _CURL = """RUN apt-get update && apt-get install -y --no-install-recommends curl \\
@@ -73,9 +74,37 @@ EXPOSE {port}
73
74
  CMD ["app"]
74
75
  """
75
76
 
77
+ _RUST = """# Generated by TDK for a Rust backend. Do not edit; change service.json instead.
78
+ # BuildKit cache mounts keep the registry and the target directory between builds, so a rebuild after a
79
+ # source change recompiles only the crate itself, not every dependency.
80
+ FROM rust:1-slim-bookworm AS build
81
+
82
+ WORKDIR /app/{res_path}
83
+
84
+ COPY {res_path}/ ./
85
+ RUN --mount=type=cache,target=/usr/local/cargo/registry \\
86
+ --mount=type=cache,target=/app/{res_path}/target \\
87
+ cargo build --release && mkdir -p /out && cp target/release/app /out/app
88
+
89
+ FROM build AS test
90
+ RUN --mount=type=cache,target=/usr/local/cargo/registry \\
91
+ --mount=type=cache,target=/app/{res_path}/target \\
92
+ cargo test
93
+
94
+ FROM debian:bookworm-slim AS production
95
+
96
+ {curl}
97
+ COPY --from=build /out/app /usr/local/bin/app
98
+
99
+ {healthcheck}
100
+ EXPOSE {port}
101
+
102
+ CMD ["app"]
103
+ """
104
+
76
105
  def generate_language_dockerfile(res_path, language, port = BASE_PORT_BACKEND):
77
106
  """Dockerfile text for a provider-owned backend language, or fail for an unknown one."""
78
- template = {"python": _PYTHON, "go": _GO}.get(language)
107
+ template = {"python": _PYTHON, "go": _GO, "rust": _RUST}.get(language)
79
108
  if template == None:
80
109
  fail("No Dockerfile generator for backend language '{}'".format(language))
81
110
  return template.format(
@@ -559,6 +559,7 @@ def generate_resource_health_check(resource_name, resource_path, manifest, check
559
559
  backend_files = {
560
560
  "python": ["pyproject.toml", "src/main.py"],
561
561
  "go": ["go.mod", "main.go"],
562
+ "rust": ["Cargo.toml", "src/main.rs"],
562
563
  }.get(manifest.get("language", "bun"), ["package.json", "prisma/schema.prisma"])
563
564
  required_files = {
564
565
  "backend": backend_files,
@@ -575,7 +576,7 @@ fi
575
576
  '''.format(req_file, req_file))
576
577
 
577
578
  # Check 2: Package.json is valid JSON (Python and Go backends have no package.json)
578
- if manifest.get("language", "bun") not in ["python", "go"]:
579
+ if manifest.get("language", "bun") not in ["python", "go", "rust"]:
579
580
  health_checks.append('''
580
581
  if ! cat package.json | head -1 > /dev/null 2>&1; then
581
582
  echo "āŒ package.json is not valid"
@@ -220,12 +220,12 @@ def _build_live_update_rules(res_path, full_res_path, syncs, project_root='', la
220
220
 
221
221
  Python backends reload their own process after a sync (uvicorn --reload), so they have
222
222
  no Bun install step. A changed pyproject.toml is not synced, so Tilt rebuilds the image instead.
223
- Go backends have no live update at all (see the early return).
223
+ Go and Rust backends have no live update at all (see the early return).
224
224
  """
225
- # Go is compiled into the image and has no reload process, so syncing sources would leave the old
226
- # binary running. Return before any sync() step is built (Tilt rejects sync steps that are created
225
+ # Go and Rust are compiled into the image and have no reload process, so syncing sources would leave the
226
+ # old binary running. Return before any sync() step is built (Tilt rejects sync steps that are created
227
227
  # but never used): no live-update rules means Tilt rebuilds the image when a watched file changes.
228
- if language == 'go':
228
+ if language in ['go', 'rust']:
229
229
  return []
230
230
 
231
231
  live_update_rules = []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdk-landscape/tdk-cli-core",
3
- "version": "1.3.89",
3
+ "version": "1.3.91",
4
4
  "description": "TDK CLI — start services on your laptop.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {