@geekmidas/cli 10.0.0-alpha.99 → 10.0.0

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 (676) hide show
  1. package/CHANGELOG.md +667 -0
  2. package/FUNCTION_CRON_SUPPORT.md +266 -0
  3. package/README.md +533 -382
  4. package/bin/gkm.mjs +2 -16
  5. package/dist/CachedStateProvider-BdX7klRc.cjs +3 -0
  6. package/dist/CachedStateProvider-CzyFct42.mjs +54 -0
  7. package/dist/CachedStateProvider-CzyFct42.mjs.map +1 -0
  8. package/dist/CachedStateProvider-GcGziXh1.mjs +3 -0
  9. package/dist/CachedStateProvider-klLWZXWF.cjs +60 -0
  10. package/dist/CachedStateProvider-klLWZXWF.cjs.map +1 -0
  11. package/dist/{HostingerProvider-BNpS9aRJ.mjs → HostingerProvider-B2ZYz7Yc.mjs} +26 -31
  12. package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +1 -0
  13. package/dist/{HostingerProvider-DR1iws1P.cjs → HostingerProvider-CrHfsgz9.cjs} +26 -31
  14. package/dist/HostingerProvider-CrHfsgz9.cjs.map +1 -0
  15. package/dist/LocalStateProvider-CP49rjzt.mjs +42 -0
  16. package/dist/LocalStateProvider-CP49rjzt.mjs.map +1 -0
  17. package/dist/LocalStateProvider-CalzNfNA.cjs +43 -0
  18. package/dist/LocalStateProvider-CalzNfNA.cjs.map +1 -0
  19. package/dist/{Route53Provider-Bllus2NR.cjs → Route53Provider-DwgXiLxt.cjs} +22 -21
  20. package/dist/Route53Provider-DwgXiLxt.cjs.map +1 -0
  21. package/dist/{Route53Provider-QXxjkZO1.mjs → Route53Provider-tlgBzrRQ.mjs} +13 -13
  22. package/dist/Route53Provider-tlgBzrRQ.mjs.map +1 -0
  23. package/dist/SSMStateProvider-BlrTiV5m.mjs +66 -0
  24. package/dist/SSMStateProvider-BlrTiV5m.mjs.map +1 -0
  25. package/dist/SSMStateProvider-Bt6r8CTL.cjs +66 -0
  26. package/dist/SSMStateProvider-Bt6r8CTL.cjs.map +1 -0
  27. package/dist/{backup-provisioner-oDEsPj02.cjs → backup-provisioner-B3HBN-2k.cjs} +20 -22
  28. package/dist/backup-provisioner-B3HBN-2k.cjs.map +1 -0
  29. package/dist/{backup-provisioner-C8DnCmxK.mjs → backup-provisioner-Xunq-p_8.mjs} +9 -12
  30. package/dist/backup-provisioner-Xunq-p_8.mjs.map +1 -0
  31. package/dist/bundler-DkA4qzUD.mjs +135 -0
  32. package/dist/bundler-DkA4qzUD.mjs.map +1 -0
  33. package/dist/bundler-Dufq3uvI.cjs +136 -0
  34. package/dist/bundler-Dufq3uvI.cjs.map +1 -0
  35. package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
  36. package/dist/chunk-Duj1WY3L.mjs +7 -0
  37. package/dist/config-Bbu1JKvf.mjs +211 -0
  38. package/dist/config-Bbu1JKvf.mjs.map +1 -0
  39. package/dist/config-DujV8DbR.cjs +253 -0
  40. package/dist/config-DujV8DbR.cjs.map +1 -0
  41. package/dist/config.cjs +10 -421
  42. package/dist/config.d.cts +120 -4
  43. package/dist/config.d.cts.map +1 -0
  44. package/dist/config.d.mts +120 -4
  45. package/dist/config.d.mts.map +1 -0
  46. package/dist/config.mjs +3 -405
  47. package/dist/credentials-C8DWtnMY.cjs +174 -0
  48. package/dist/credentials-C8DWtnMY.cjs.map +1 -0
  49. package/dist/credentials-s1kLcIzK.mjs +126 -0
  50. package/dist/credentials-s1kLcIzK.mjs.map +1 -0
  51. package/dist/deploy/sniffer-envkit-patch.cjs +10 -18
  52. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  53. package/dist/deploy/sniffer-envkit-patch.d.cts +2 -0
  54. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  55. package/dist/deploy/sniffer-envkit-patch.d.mts +2 -0
  56. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  57. package/dist/deploy/sniffer-envkit-patch.mjs +2 -10
  58. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  59. package/dist/deploy/sniffer-hooks.cjs +7 -13
  60. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  61. package/dist/deploy/sniffer-hooks.d.cts +2 -1
  62. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  63. package/dist/deploy/sniffer-hooks.d.mts +2 -1
  64. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  65. package/dist/deploy/sniffer-hooks.mjs +3 -10
  66. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  67. package/dist/deploy/sniffer-loader.cjs +7 -16
  68. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  69. package/dist/deploy/sniffer-loader.d.cts +1 -1
  70. package/dist/deploy/sniffer-loader.d.mts +1 -1
  71. package/dist/deploy/sniffer-loader.mjs +3 -14
  72. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  73. package/dist/deploy/sniffer-routes-worker.cjs +13 -17
  74. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  75. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  76. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  77. package/dist/deploy/sniffer-routes-worker.mjs +6 -10
  78. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  79. package/dist/deploy/sniffer-worker.cjs +6 -15
  80. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  81. package/dist/deploy/sniffer-worker.d.cts +3 -1
  82. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  83. package/dist/deploy/sniffer-worker.d.mts +3 -1
  84. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  85. package/dist/deploy/sniffer-worker.mjs +4 -15
  86. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  87. package/dist/dokploy-api-BPYkG-ZZ.cjs +3 -0
  88. package/dist/dokploy-api-BiSzWM4v.mjs +3 -0
  89. package/dist/dokploy-api-CqOIKHme.cjs +609 -0
  90. package/dist/dokploy-api-CqOIKHme.cjs.map +1 -0
  91. package/dist/dokploy-api-sfZFlWuE.mjs +597 -0
  92. package/dist/dokploy-api-sfZFlWuE.mjs.map +1 -0
  93. package/dist/encryption-BVS7Vmzs.cjs +4 -0
  94. package/dist/encryption-Bd_m4q3g.mjs +3 -0
  95. package/dist/encryption-CO5Q4Bhf.mjs +42 -0
  96. package/dist/encryption-CO5Q4Bhf.mjs.map +1 -0
  97. package/dist/encryption-MfXAiFTm.cjs +54 -0
  98. package/dist/encryption-MfXAiFTm.cjs.map +1 -0
  99. package/dist/fullstack-secrets-BYzi6Hwl.cjs +402 -0
  100. package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +1 -0
  101. package/dist/fullstack-secrets-l8s3II_H.mjs +336 -0
  102. package/dist/fullstack-secrets-l8s3II_H.mjs.map +1 -0
  103. package/dist/index-CoVW_fFS.d.cts +1737 -0
  104. package/dist/index-CoVW_fFS.d.cts.map +1 -0
  105. package/dist/index-oWibAYQY.d.mts +1737 -0
  106. package/dist/index-oWibAYQY.d.mts.map +1 -0
  107. package/dist/index.cjs +11324 -10240
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.d.cts +1 -1
  110. package/dist/index.d.mts +1 -1
  111. package/dist/index.mjs +11327 -10231
  112. package/dist/index.mjs.map +1 -1
  113. package/dist/openapi-BzNOC7_i.cjs +1931 -0
  114. package/dist/openapi-BzNOC7_i.cjs.map +1 -0
  115. package/dist/openapi-Cfwi0fqF.mjs +1883 -0
  116. package/dist/openapi-Cfwi0fqF.mjs.map +1 -0
  117. package/dist/openapi-react-query-C4iIvpPf.mjs +167 -0
  118. package/dist/openapi-react-query-C4iIvpPf.mjs.map +1 -0
  119. package/dist/openapi-react-query-CYWik72n.cjs +173 -0
  120. package/dist/openapi-react-query-CYWik72n.cjs.map +1 -0
  121. package/dist/openapi-react-query.cjs +4 -0
  122. package/dist/openapi-react-query.d.cts +11 -0
  123. package/dist/openapi-react-query.d.cts.map +1 -0
  124. package/dist/openapi-react-query.d.mts +11 -0
  125. package/dist/openapi-react-query.d.mts.map +1 -0
  126. package/dist/openapi-react-query.mjs +4 -0
  127. package/dist/openapi.cjs +7 -214
  128. package/dist/openapi.d.cts +15 -72
  129. package/dist/openapi.d.cts.map +1 -1
  130. package/dist/openapi.d.mts +15 -72
  131. package/dist/openapi.d.mts.map +1 -1
  132. package/dist/openapi.mjs +4 -208
  133. package/dist/{reconcile--I7V4Klj.mjs → reconcile-B2FoJE0a.mjs} +8 -6
  134. package/dist/reconcile-B2FoJE0a.mjs.map +1 -0
  135. package/dist/{reconcile-CuCQBa5-.cjs → reconcile-BzqKJ2Rt.cjs} +8 -6
  136. package/dist/reconcile-BzqKJ2Rt.cjs.map +1 -0
  137. package/dist/setup-DDXUXzzl.mjs +765 -0
  138. package/dist/setup-DDXUXzzl.mjs.map +1 -0
  139. package/dist/setup-DLwhfyt-.cjs +8 -0
  140. package/dist/setup-Dh-B7YTX.mjs +8 -0
  141. package/dist/setup-WZ-xqAQO.cjs +849 -0
  142. package/dist/setup-WZ-xqAQO.cjs.map +1 -0
  143. package/dist/storage-B1wvztiJ.cjs +363 -0
  144. package/dist/storage-B1wvztiJ.cjs.map +1 -0
  145. package/dist/storage-Cs4WBsc4.mjs +3 -0
  146. package/dist/storage-DOEtT2Hr.cjs +7 -0
  147. package/dist/storage-dbb9RyBl.mjs +297 -0
  148. package/dist/storage-dbb9RyBl.mjs.map +1 -0
  149. package/dist/sync-B5UHXwRM.mjs +3 -0
  150. package/dist/sync-BLA94rgC.cjs +4 -0
  151. package/dist/sync-CSooqRQ8.mjs +76 -0
  152. package/dist/sync-CSooqRQ8.mjs.map +1 -0
  153. package/dist/sync-o_CtEbvR.cjs +93 -0
  154. package/dist/sync-o_CtEbvR.cjs.map +1 -0
  155. package/dist/types-B3GQUg3k.d.mts +280 -0
  156. package/dist/types-B3GQUg3k.d.mts.map +1 -0
  157. package/dist/types-BWQDiooe.d.cts +280 -0
  158. package/dist/types-BWQDiooe.d.cts.map +1 -0
  159. package/dist/workspace/index.cjs +4 -12
  160. package/dist/workspace/index.d.cts +3 -3
  161. package/dist/workspace/index.d.mts +3 -3
  162. package/dist/workspace/index.mjs +3 -2
  163. package/dist/workspace-CQTT7HJQ.cjs +4361 -0
  164. package/dist/workspace-CQTT7HJQ.cjs.map +1 -0
  165. package/dist/workspace-D-37Ylqo.mjs +4236 -0
  166. package/dist/workspace-D-37Ylqo.mjs.map +1 -0
  167. package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +408 -0
  168. package/docs/dev-server-resilience-design.md +189 -0
  169. package/docs/manifest-refactor-design.md +287 -0
  170. package/examples/cron-example.ts +45 -0
  171. package/examples/env.ts +33 -0
  172. package/examples/function-example.ts +40 -0
  173. package/examples/gkm.config.json +22 -0
  174. package/examples/gkm.config.ts +14 -0
  175. package/examples/gkm.minimal.config.json +7 -0
  176. package/examples/gkm.production.config.json +27 -0
  177. package/examples/logger.ts +10 -0
  178. package/package.json +37 -87
  179. package/scripts/sync-versions.ts +108 -0
  180. package/src/__tests__/EndpointGenerator.hooks.spec.ts +204 -0
  181. package/src/__tests__/config.spec.ts +422 -0
  182. package/src/__tests__/loadEnvFiles.spec.ts +131 -0
  183. package/src/__tests__/normalizeHooksConfig.spec.ts +63 -0
  184. package/src/__tests__/openapi-react-query.spec.ts +506 -0
  185. package/src/__tests__/openapi.spec.ts +625 -0
  186. package/src/__tests__/test-helpers.ts +180 -0
  187. package/src/auth/__tests__/credentials.spec.ts +331 -0
  188. package/src/auth/__tests__/index.spec.ts +237 -0
  189. package/src/auth/credentials.ts +286 -0
  190. package/src/auth/index.ts +233 -0
  191. package/src/build/__tests__/bundler.spec.ts +446 -0
  192. package/src/build/__tests__/endpoint-analyzer.spec.ts +623 -0
  193. package/src/build/__tests__/handler-templates.spec.ts +1287 -0
  194. package/src/build/__tests__/index-new.spec.ts +550 -0
  195. package/src/build/__tests__/manifests.spec.ts +583 -0
  196. package/src/build/__tests__/partitions.spec.ts +110 -0
  197. package/src/build/__tests__/workspace-build.spec.ts +215 -0
  198. package/src/build/bundler.ts +256 -0
  199. package/src/build/endpoint-analyzer.ts +236 -0
  200. package/src/build/handler-templates.ts +1253 -0
  201. package/src/build/index.ts +616 -0
  202. package/src/build/manifests.ts +285 -0
  203. package/src/build/partitions.ts +58 -0
  204. package/src/build/providerResolver.ts +184 -0
  205. package/src/build/types.ts +104 -0
  206. package/src/config.ts +330 -0
  207. package/src/credentials/__tests__/fullDockerPorts.spec.ts +144 -0
  208. package/src/credentials/__tests__/helpers.ts +112 -0
  209. package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +125 -0
  210. package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +190 -0
  211. package/src/credentials/__tests__/workspaceCredentials.spec.ts +209 -0
  212. package/src/credentials/index.ts +843 -0
  213. package/src/debug.ts +68 -0
  214. package/src/deploy/CachedStateProvider.ts +86 -0
  215. package/src/deploy/LocalStateProvider.ts +57 -0
  216. package/src/deploy/SSMStateProvider.ts +117 -0
  217. package/src/deploy/StateProvider.ts +175 -0
  218. package/src/deploy/__tests__/CachedStateProvider.spec.ts +235 -0
  219. package/src/deploy/__tests__/HostingerProvider.spec.ts +347 -0
  220. package/src/deploy/__tests__/LocalStateProvider.spec.ts +130 -0
  221. package/src/deploy/__tests__/Route53Provider.spec.ts +425 -0
  222. package/src/deploy/__tests__/SSMStateProvider.spec.ts +201 -0
  223. package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +24 -0
  224. package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +24 -0
  225. package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +12 -0
  226. package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +14 -0
  227. package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +16 -0
  228. package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +10 -0
  229. package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +21 -0
  230. package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +18 -0
  231. package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +16 -0
  232. package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +16 -0
  233. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +16 -0
  234. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +13 -0
  235. package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +15 -0
  236. package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +55 -0
  237. package/src/deploy/__tests__/backup-provisioner.spec.ts +428 -0
  238. package/src/deploy/__tests__/createDnsProvider.spec.ts +195 -0
  239. package/src/deploy/__tests__/createStateProvider.spec.ts +126 -0
  240. package/src/deploy/__tests__/dns-orchestration.spec.ts +192 -0
  241. package/src/deploy/__tests__/dns-verification.spec.ts +229 -0
  242. package/src/deploy/__tests__/docker.spec.ts +149 -0
  243. package/src/deploy/__tests__/dokploy-api.spec.ts +697 -0
  244. package/src/deploy/__tests__/dokploy.spec.ts +435 -0
  245. package/src/deploy/__tests__/domain.spec.ts +235 -0
  246. package/src/deploy/__tests__/env-resolver.spec.ts +903 -0
  247. package/src/deploy/__tests__/index.spec.ts +1091 -0
  248. package/src/deploy/__tests__/init.spec.ts +793 -0
  249. package/src/deploy/__tests__/secrets.spec.ts +303 -0
  250. package/src/deploy/__tests__/sniffer.spec.ts +838 -0
  251. package/src/deploy/__tests__/state-e2e.spec.ts +387 -0
  252. package/src/deploy/__tests__/state.spec.ts +876 -0
  253. package/src/deploy/__tests__/undeploy.spec.ts +758 -0
  254. package/src/deploy/backup-provisioner.ts +316 -0
  255. package/src/deploy/dns/DnsProvider.ts +201 -0
  256. package/src/deploy/dns/HostingerProvider.ts +174 -0
  257. package/src/deploy/dns/Route53Provider.ts +340 -0
  258. package/src/deploy/dns/hostinger-api.ts +261 -0
  259. package/src/deploy/dns/index.ts +627 -0
  260. package/src/deploy/docker.ts +260 -0
  261. package/src/deploy/dokploy-api.ts +1101 -0
  262. package/src/deploy/dokploy.ts +177 -0
  263. package/src/deploy/domain.ts +134 -0
  264. package/src/deploy/env-resolver.ts +305 -0
  265. package/src/deploy/index.ts +2094 -0
  266. package/src/deploy/init.ts +427 -0
  267. package/src/deploy/secrets.ts +187 -0
  268. package/src/deploy/sniffer-envkit-patch.ts +61 -0
  269. package/src/deploy/sniffer-hooks.ts +57 -0
  270. package/src/deploy/sniffer-loader.ts +28 -0
  271. package/src/deploy/sniffer-routes-worker.ts +104 -0
  272. package/src/deploy/sniffer-worker.ts +75 -0
  273. package/src/deploy/sniffer.ts +578 -0
  274. package/src/deploy/state-commands.ts +274 -0
  275. package/src/deploy/state.ts +482 -0
  276. package/src/deploy/types.ts +102 -0
  277. package/src/deploy/undeploy.ts +407 -0
  278. package/src/dev/__tests__/entry-integration.spec.ts +347 -0
  279. package/src/dev/__tests__/entry.spec.ts +144 -0
  280. package/src/dev/__tests__/index.spec.ts +2084 -0
  281. package/src/dev/index.ts +1649 -0
  282. package/src/docker/__tests__/compose.spec.ts +1142 -0
  283. package/src/docker/__tests__/templates.spec.ts +694 -0
  284. package/src/docker/compose.ts +812 -0
  285. package/src/docker/index.ts +523 -0
  286. package/src/docker/templates.ts +1067 -0
  287. package/src/exec/index.ts +118 -0
  288. package/src/generators/CronGenerator.ts +105 -0
  289. package/src/generators/EndpointGenerator.ts +954 -0
  290. package/src/generators/FunctionGenerator.ts +117 -0
  291. package/src/generators/Generator.ts +147 -0
  292. package/src/generators/OpenApiTsGenerator.ts +821 -0
  293. package/src/generators/QueueGenerator.ts +245 -0
  294. package/src/generators/SubscriberGenerator.ts +282 -0
  295. package/src/generators/TopicGenerator.ts +45 -0
  296. package/src/generators/__tests__/CronGenerator.spec.ts +445 -0
  297. package/src/generators/__tests__/EndpointGenerator.spec.ts +544 -0
  298. package/src/generators/__tests__/FunctionGenerator.spec.ts +256 -0
  299. package/src/generators/__tests__/Generator.bustCache.spec.ts +72 -0
  300. package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +98 -0
  301. package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +56 -0
  302. package/src/generators/__tests__/QueueGenerator.spec.ts +141 -0
  303. package/src/generators/__tests__/SubscriberGenerator.spec.ts +410 -0
  304. package/src/generators/index.ts +11 -0
  305. package/src/index.ts +972 -0
  306. package/src/init/__tests__/generators.spec.ts +1072 -0
  307. package/src/init/__tests__/init.spec.ts +577 -0
  308. package/src/init/__tests__/utils.spec.ts +104 -0
  309. package/src/init/generators/auth.ts +225 -0
  310. package/src/init/generators/config.ts +316 -0
  311. package/src/init/generators/docker.ts +388 -0
  312. package/src/init/generators/env.ts +62 -0
  313. package/src/init/generators/index.ts +6 -0
  314. package/src/init/generators/mobile-expo.ts +576 -0
  315. package/src/init/generators/models.ts +153 -0
  316. package/src/init/generators/monorepo.ts +475 -0
  317. package/src/init/generators/package.ts +95 -0
  318. package/src/init/generators/source.ts +15 -0
  319. package/src/init/generators/test.ts +178 -0
  320. package/src/init/generators/ui.ts +1473 -0
  321. package/src/init/generators/web-tanstack.ts +348 -0
  322. package/src/init/generators/web.ts +363 -0
  323. package/src/init/index.ts +542 -0
  324. package/src/init/templates/api.ts +404 -0
  325. package/src/init/templates/index.ts +342 -0
  326. package/src/init/templates/minimal.ts +207 -0
  327. package/src/init/templates/serverless.ts +148 -0
  328. package/src/init/templates/worker.ts +216 -0
  329. package/src/init/utils.ts +197 -0
  330. package/src/init/versions.ts +52 -0
  331. package/src/openapi-react-query.ts +288 -0
  332. package/src/openapi.ts +259 -0
  333. package/src/secrets/__tests__/encryption.spec.ts +226 -0
  334. package/src/secrets/__tests__/generator.spec.ts +575 -0
  335. package/src/secrets/__tests__/index.spec.ts +91 -0
  336. package/src/secrets/__tests__/reconcile.spec.ts +123 -0
  337. package/src/secrets/__tests__/storage.spec.ts +645 -0
  338. package/src/secrets/encryption.ts +91 -0
  339. package/src/secrets/generator.ts +329 -0
  340. package/src/secrets/index.ts +417 -0
  341. package/src/secrets/keystore.ts +144 -0
  342. package/src/secrets/reconcile.ts +53 -0
  343. package/src/secrets/storage.ts +337 -0
  344. package/src/secrets/sync.ts +136 -0
  345. package/src/secrets/types.ts +70 -0
  346. package/src/setup/__tests__/auto-setup.spec.ts +147 -0
  347. package/src/setup/__tests__/reconcile-secrets.spec.ts +439 -0
  348. package/src/setup/fullstack-secrets.ts +140 -0
  349. package/src/setup/index.ts +411 -0
  350. package/src/test/__tests__/__fixtures__/workspace.ts +104 -0
  351. package/src/test/__tests__/api.spec.ts +199 -0
  352. package/src/test/__tests__/auth.spec.ts +162 -0
  353. package/src/test/__tests__/index.spec.ts +502 -0
  354. package/src/test/__tests__/web.spec.ts +210 -0
  355. package/src/test/index.ts +198 -0
  356. package/src/types.ts +363 -0
  357. package/src/upgrade/__tests__/index.spec.ts +354 -0
  358. package/src/upgrade/index.ts +253 -0
  359. package/src/workspace/__tests__/client-generator.spec.ts +326 -0
  360. package/src/workspace/__tests__/index.spec.ts +766 -0
  361. package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
  362. package/src/workspace/__tests__/schema.spec.ts +737 -0
  363. package/src/workspace/__tests__/type-inference.spec.ts +251 -0
  364. package/src/workspace/client-generator.ts +109 -0
  365. package/src/workspace/index.ts +433 -0
  366. package/src/workspace/publicEnv.ts +57 -0
  367. package/src/workspace/schema.ts +861 -0
  368. package/src/workspace/types.ts +943 -0
  369. package/tsconfig.json +9 -0
  370. package/tsdown.config.ts +22 -0
  371. package/bin/adjacent-tsconfig.mjs +0 -97
  372. package/bin/owning-tsconfig-jsx-register.mjs +0 -18
  373. package/bin/owning-tsconfig-jsx.mjs +0 -108
  374. package/dist/EndpointGenerator-Bor2tZCm.mjs +0 -1031
  375. package/dist/EndpointGenerator-Bor2tZCm.mjs.map +0 -1
  376. package/dist/EndpointGenerator-De03t1hd.cjs +0 -1090
  377. package/dist/EndpointGenerator-De03t1hd.cjs.map +0 -1
  378. package/dist/GoDaddyProvider-206NguW1.mjs +0 -388
  379. package/dist/GoDaddyProvider-206NguW1.mjs.map +0 -1
  380. package/dist/GoDaddyProvider-D1aQy2i1.cjs +0 -388
  381. package/dist/GoDaddyProvider-D1aQy2i1.cjs.map +0 -1
  382. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +0 -1
  383. package/dist/HostingerProvider-DR1iws1P.cjs.map +0 -1
  384. package/dist/LegacyStateStore-CgJEr1G7.cjs +0 -124
  385. package/dist/LegacyStateStore-CgJEr1G7.cjs.map +0 -1
  386. package/dist/LegacyStateStore-wmFfdzuh.mjs +0 -124
  387. package/dist/LegacyStateStore-wmFfdzuh.mjs.map +0 -1
  388. package/dist/LocalStateStore-BD14kra9.cjs +0 -178
  389. package/dist/LocalStateStore-BD14kra9.cjs.map +0 -1
  390. package/dist/LocalStateStore-C5mNp91D.mjs +0 -167
  391. package/dist/LocalStateStore-C5mNp91D.mjs.map +0 -1
  392. package/dist/OpenApiTsGenerator-CS_RtWOz.cjs +0 -541
  393. package/dist/OpenApiTsGenerator-CS_RtWOz.cjs.map +0 -1
  394. package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs +0 -536
  395. package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs.map +0 -1
  396. package/dist/Route53Provider-Bllus2NR.cjs.map +0 -1
  397. package/dist/Route53Provider-QXxjkZO1.mjs.map +0 -1
  398. package/dist/S3StateStore-CEGbsDHi.mjs +0 -223
  399. package/dist/S3StateStore-CEGbsDHi.mjs.map +0 -1
  400. package/dist/S3StateStore-Csu_kJCy.cjs +0 -222
  401. package/dist/S3StateStore-Csu_kJCy.cjs.map +0 -1
  402. package/dist/SSMStateStore-Bd62qwp4.mjs +0 -205
  403. package/dist/SSMStateStore-Bd62qwp4.mjs.map +0 -1
  404. package/dist/SSMStateStore-Rp21jtP5.cjs +0 -204
  405. package/dist/SSMStateStore-Rp21jtP5.cjs.map +0 -1
  406. package/dist/SubscriberGenerator-CyN2VF5X.mjs +0 -449
  407. package/dist/SubscriberGenerator-CyN2VF5X.mjs.map +0 -1
  408. package/dist/SubscriberGenerator-Dvz7EzqK.cjs +0 -490
  409. package/dist/SubscriberGenerator-Dvz7EzqK.cjs.map +0 -1
  410. package/dist/add-DyIEYI97.mjs +0 -718
  411. package/dist/add-DyIEYI97.mjs.map +0 -1
  412. package/dist/add-Iuo3ao5E.cjs +0 -720
  413. package/dist/add-Iuo3ao5E.cjs.map +0 -1
  414. package/dist/appPorts-C9z9Pzn9.mjs +0 -223
  415. package/dist/appPorts-C9z9Pzn9.mjs.map +0 -1
  416. package/dist/appPorts-Cu79hJF6.cjs +0 -264
  417. package/dist/appPorts-Cu79hJF6.cjs.map +0 -1
  418. package/dist/aws-8QQ8n-t6.mjs +0 -89
  419. package/dist/aws-8QQ8n-t6.mjs.map +0 -1
  420. package/dist/aws-DY9NqQIT.cjs +0 -100
  421. package/dist/aws-DY9NqQIT.cjs.map +0 -1
  422. package/dist/awsStore-Bx5nCFnS.mjs +0 -121
  423. package/dist/awsStore-Bx5nCFnS.mjs.map +0 -1
  424. package/dist/awsStore-u3ehhMoY.cjs +0 -138
  425. package/dist/awsStore-u3ehhMoY.cjs.map +0 -1
  426. package/dist/backup-provisioner-C8DnCmxK.mjs.map +0 -1
  427. package/dist/backup-provisioner-oDEsPj02.cjs.map +0 -1
  428. package/dist/bundler-Bgoq8IyR.cjs +0 -169
  429. package/dist/bundler-Bgoq8IyR.cjs.map +0 -1
  430. package/dist/bundler-Q6Kp8b0r.mjs +0 -169
  431. package/dist/bundler-Q6Kp8b0r.mjs.map +0 -1
  432. package/dist/cli-B9BudUV0.mjs +0 -71
  433. package/dist/cli-B9BudUV0.mjs.map +0 -1
  434. package/dist/cli-W2DMRIbP.cjs +0 -71
  435. package/dist/cli-W2DMRIbP.cjs.map +0 -1
  436. package/dist/compose-CIrFNWHb.cjs +0 -3147
  437. package/dist/compose-CIrFNWHb.cjs.map +0 -1
  438. package/dist/compose-CLsRcHkA.mjs +0 -3052
  439. package/dist/compose-CLsRcHkA.mjs.map +0 -1
  440. package/dist/config-BVdHfj8b.d.cts +0 -269
  441. package/dist/config-BVdHfj8b.d.cts.map +0 -1
  442. package/dist/config-D2OqCmAM.d.mts +0 -269
  443. package/dist/config-D2OqCmAM.d.mts.map +0 -1
  444. package/dist/config.cjs.map +0 -1
  445. package/dist/config.mjs.map +0 -1
  446. package/dist/credentialSchemas-BJFvfkaz.mjs +0 -237
  447. package/dist/credentialSchemas-BJFvfkaz.mjs.map +0 -1
  448. package/dist/credentialSchemas-CAPKFkrG.cjs +0 -272
  449. package/dist/credentialSchemas-CAPKFkrG.cjs.map +0 -1
  450. package/dist/credentials-B5N5yKk6.mjs +0 -267
  451. package/dist/credentials-B5N5yKk6.mjs.map +0 -1
  452. package/dist/credentials-Zqr3QQYB.cjs +0 -350
  453. package/dist/credentials-Zqr3QQYB.cjs.map +0 -1
  454. package/dist/databases-BeGP5eDh.mjs +0 -495
  455. package/dist/databases-BeGP5eDh.mjs.map +0 -1
  456. package/dist/databases-DGALFDG3.cjs +0 -598
  457. package/dist/databases-DGALFDG3.cjs.map +0 -1
  458. package/dist/define-6poNqm5O.mjs +0 -106
  459. package/dist/define-6poNqm5O.mjs.map +0 -1
  460. package/dist/define-crmMcXFS.cjs +0 -153
  461. package/dist/define-crmMcXFS.cjs.map +0 -1
  462. package/dist/deploy/public.cjs +0 -212
  463. package/dist/deploy/public.cjs.map +0 -1
  464. package/dist/deploy/public.d.cts +0 -653
  465. package/dist/deploy/public.d.cts.map +0 -1
  466. package/dist/deploy/public.d.mts +0 -653
  467. package/dist/deploy/public.d.mts.map +0 -1
  468. package/dist/deploy/public.mjs +0 -145
  469. package/dist/deploy/public.mjs.map +0 -1
  470. package/dist/deploy/sniffer-envparser-worker.cjs +0 -54
  471. package/dist/deploy/sniffer-envparser-worker.cjs.map +0 -1
  472. package/dist/deploy/sniffer-envparser-worker.d.cts +0 -1
  473. package/dist/deploy/sniffer-envparser-worker.d.mts +0 -1
  474. package/dist/deploy/sniffer-envparser-worker.mjs +0 -55
  475. package/dist/deploy/sniffer-envparser-worker.mjs.map +0 -1
  476. package/dist/deploy-CbJMJsgX.cjs +0 -2032
  477. package/dist/deploy-CbJMJsgX.cjs.map +0 -1
  478. package/dist/deploy-n_IB8r6H.mjs +0 -1977
  479. package/dist/deploy-n_IB8r6H.mjs.map +0 -1
  480. package/dist/derive-B4vDpzgP.mjs +0 -150
  481. package/dist/derive-B4vDpzgP.mjs.map +0 -1
  482. package/dist/derive-DAbo49sm.cjs +0 -161
  483. package/dist/derive-DAbo49sm.cjs.map +0 -1
  484. package/dist/discover-Caf6Hnv1.d.cts +0 -108
  485. package/dist/discover-Caf6Hnv1.d.cts.map +0 -1
  486. package/dist/discover-Cd5M2jPv.d.mts +0 -108
  487. package/dist/discover-Cd5M2jPv.d.mts.map +0 -1
  488. package/dist/discover-DPgu-ScS.cjs +0 -600
  489. package/dist/discover-DPgu-ScS.cjs.map +0 -1
  490. package/dist/discover-qjFapetL.mjs +0 -527
  491. package/dist/discover-qjFapetL.mjs.map +0 -1
  492. package/dist/dns-C_LPS3qV.mjs +0 -610
  493. package/dist/dns-C_LPS3qV.mjs.map +0 -1
  494. package/dist/dns-kp8To8Qj.cjs +0 -663
  495. package/dist/dns-kp8To8Qj.cjs.map +0 -1
  496. package/dist/dokploy-Dl_kNVeE.mjs +0 -38
  497. package/dist/dokploy-Dl_kNVeE.mjs.map +0 -1
  498. package/dist/dokploy-gRIae9Ht.cjs +0 -38
  499. package/dist/dokploy-gRIae9Ht.cjs.map +0 -1
  500. package/dist/drivers-CTaWrA_L.mjs +0 -177
  501. package/dist/drivers-CTaWrA_L.mjs.map +0 -1
  502. package/dist/drivers-DDojgzz0.cjs +0 -200
  503. package/dist/drivers-DDojgzz0.cjs.map +0 -1
  504. package/dist/emit-C1e8qD08.mjs +0 -193
  505. package/dist/emit-C1e8qD08.mjs.map +0 -1
  506. package/dist/emit-Dmc1nvdS.cjs +0 -210
  507. package/dist/emit-Dmc1nvdS.cjs.map +0 -1
  508. package/dist/encryption-C3DcVZQs.mjs +0 -89
  509. package/dist/encryption-C3DcVZQs.mjs.map +0 -1
  510. package/dist/encryption-CmQvQOSe.cjs +0 -90
  511. package/dist/encryption-CmQvQOSe.cjs.map +0 -1
  512. package/dist/engine-DBXuhHyf.mjs +0 -3081
  513. package/dist/engine-DBXuhHyf.mjs.map +0 -1
  514. package/dist/engine-Dk19Mxc4.cjs +0 -3194
  515. package/dist/engine-Dk19Mxc4.cjs.map +0 -1
  516. package/dist/errors-D8Gwp5kU.mjs +0 -23
  517. package/dist/errors-D8Gwp5kU.mjs.map +0 -1
  518. package/dist/errors-DMC4Umsb.cjs +0 -34
  519. package/dist/errors-DMC4Umsb.cjs.map +0 -1
  520. package/dist/github-Ds2RYnSU.cjs +0 -819
  521. package/dist/github-Ds2RYnSU.cjs.map +0 -1
  522. package/dist/github-RawRLERq.mjs +0 -819
  523. package/dist/github-RawRLERq.mjs.map +0 -1
  524. package/dist/identity-CBXr4wNi.mjs +0 -129
  525. package/dist/identity-CBXr4wNi.mjs.map +0 -1
  526. package/dist/identity-CbLfgQNT.cjs +0 -182
  527. package/dist/identity-CbLfgQNT.cjs.map +0 -1
  528. package/dist/index-BU4G20G6.d.cts +0 -190
  529. package/dist/index-BU4G20G6.d.cts.map +0 -1
  530. package/dist/index-yDbd1WcM.d.mts +0 -190
  531. package/dist/index-yDbd1WcM.d.mts.map +0 -1
  532. package/dist/local-BwC2v2Y8.mjs +0 -224
  533. package/dist/local-BwC2v2Y8.mjs.map +0 -1
  534. package/dist/local-DNhnkugT.cjs +0 -241
  535. package/dist/local-DNhnkugT.cjs.map +0 -1
  536. package/dist/migrate-CZIGT3kB.mjs +0 -266
  537. package/dist/migrate-CZIGT3kB.mjs.map +0 -1
  538. package/dist/migrate-CxZYzF_u.cjs +0 -181
  539. package/dist/migrate-CxZYzF_u.cjs.map +0 -1
  540. package/dist/migrate-DR1x96I4.mjs +0 -181
  541. package/dist/migrate-DR1x96I4.mjs.map +0 -1
  542. package/dist/migrate-DjrTwWJA.cjs +0 -271
  543. package/dist/migrate-DjrTwWJA.cjs.map +0 -1
  544. package/dist/openapi.cjs.map +0 -1
  545. package/dist/openapi.mjs.map +0 -1
  546. package/dist/projectBucket-BYOxRnHY.mjs +0 -177
  547. package/dist/projectBucket-BYOxRnHY.mjs.map +0 -1
  548. package/dist/projectBucket-CDu5rXjp.cjs +0 -206
  549. package/dist/projectBucket-CDu5rXjp.cjs.map +0 -1
  550. package/dist/provider-BqpjG9QM.cjs +0 -57
  551. package/dist/provider-BqpjG9QM.cjs.map +0 -1
  552. package/dist/provider-CEOKk8NS.mjs +0 -46
  553. package/dist/provider-CEOKk8NS.mjs.map +0 -1
  554. package/dist/ready-D3PIjx3S.cjs +0 -403
  555. package/dist/ready-D3PIjx3S.cjs.map +0 -1
  556. package/dist/ready-naOSJpeJ.mjs +0 -374
  557. package/dist/ready-naOSJpeJ.mjs.map +0 -1
  558. package/dist/reconcile/public.cjs +0 -7
  559. package/dist/reconcile/public.d.cts +0 -49
  560. package/dist/reconcile/public.d.cts.map +0 -1
  561. package/dist/reconcile/public.d.mts +0 -49
  562. package/dist/reconcile/public.d.mts.map +0 -1
  563. package/dist/reconcile/public.mjs +0 -3
  564. package/dist/reconcile--I7V4Klj.mjs.map +0 -1
  565. package/dist/reconcile-CuCQBa5-.cjs.map +0 -1
  566. package/dist/resolve-CNYbGH8g.mjs +0 -263
  567. package/dist/resolve-CNYbGH8g.mjs.map +0 -1
  568. package/dist/resolve-DC98Rl1t.cjs +0 -316
  569. package/dist/resolve-DC98Rl1t.cjs.map +0 -1
  570. package/dist/rollback-BkIkE8Qe.mjs +0 -136
  571. package/dist/rollback-BkIkE8Qe.mjs.map +0 -1
  572. package/dist/rollback-DBfLvC8k.cjs +0 -165
  573. package/dist/rollback-DBfLvC8k.cjs.map +0 -1
  574. package/dist/rolldown-runtime-BhDjJH2R.mjs +0 -15
  575. package/dist/run-BJLIerMM.mjs +0 -133
  576. package/dist/run-BJLIerMM.mjs.map +0 -1
  577. package/dist/run-fVZ-rLnc.cjs +0 -174
  578. package/dist/run-fVZ-rLnc.cjs.map +0 -1
  579. package/dist/runtime-CLz3bf07.d.mts +0 -82
  580. package/dist/runtime-CLz3bf07.d.mts.map +0 -1
  581. package/dist/runtime-CUWf0IUk.d.cts +0 -82
  582. package/dist/runtime-CUWf0IUk.d.cts.map +0 -1
  583. package/dist/s3-BwhQk3QM.mjs +0 -215
  584. package/dist/s3-BwhQk3QM.mjs.map +0 -1
  585. package/dist/s3-DLp0V-Ox.cjs +0 -215
  586. package/dist/s3-DLp0V-Ox.cjs.map +0 -1
  587. package/dist/sandbox/config-worker.cjs +0 -43
  588. package/dist/sandbox/config-worker.cjs.map +0 -1
  589. package/dist/sandbox/config-worker.d.cts +0 -1
  590. package/dist/sandbox/config-worker.d.mts +0 -1
  591. package/dist/sandbox/config-worker.mjs +0 -44
  592. package/dist/sandbox/config-worker.mjs.map +0 -1
  593. package/dist/sandbox/credentials-worker.cjs +0 -54
  594. package/dist/sandbox/credentials-worker.cjs.map +0 -1
  595. package/dist/sandbox/credentials-worker.d.cts +0 -1
  596. package/dist/sandbox/credentials-worker.d.mts +0 -1
  597. package/dist/sandbox/credentials-worker.mjs +0 -55
  598. package/dist/sandbox/credentials-worker.mjs.map +0 -1
  599. package/dist/sandbox/discover-worker.cjs +0 -47
  600. package/dist/sandbox/discover-worker.cjs.map +0 -1
  601. package/dist/sandbox/discover-worker.d.cts +0 -1
  602. package/dist/sandbox/discover-worker.d.mts +0 -1
  603. package/dist/sandbox/discover-worker.mjs +0 -48
  604. package/dist/sandbox/discover-worker.mjs.map +0 -1
  605. package/dist/sandbox/migrate-worker.cjs +0 -75
  606. package/dist/sandbox/migrate-worker.cjs.map +0 -1
  607. package/dist/sandbox/migrate-worker.d.cts +0 -1
  608. package/dist/sandbox/migrate-worker.d.mts +0 -1
  609. package/dist/sandbox/migrate-worker.mjs +0 -76
  610. package/dist/sandbox/migrate-worker.mjs.map +0 -1
  611. package/dist/sandbox-CHv3OYXg.cjs +0 -165
  612. package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
  613. package/dist/sandbox-CbVB7uOD.mjs +0 -118
  614. package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
  615. package/dist/sandbox-CfpLWTPP.d.mts +0 -104
  616. package/dist/sandbox-CfpLWTPP.d.mts.map +0 -1
  617. package/dist/sandbox-D1XeNEJ9.d.cts +0 -104
  618. package/dist/sandbox-D1XeNEJ9.d.cts.map +0 -1
  619. package/dist/schemas-BObwxB_t.cjs +0 -6017
  620. package/dist/schemas-BObwxB_t.cjs.map +0 -1
  621. package/dist/schemas-D-xeKJDD.mjs +0 -5916
  622. package/dist/schemas-D-xeKJDD.mjs.map +0 -1
  623. package/dist/secretsManager-CQORubp9.mjs +0 -97
  624. package/dist/secretsManager-CQORubp9.mjs.map +0 -1
  625. package/dist/secretsManager-RAGcEDX1.cjs +0 -108
  626. package/dist/secretsManager-RAGcEDX1.cjs.map +0 -1
  627. package/dist/seeds-BNHSpjNP.cjs +0 -9096
  628. package/dist/seeds-BNHSpjNP.cjs.map +0 -1
  629. package/dist/seeds-C4bZ8L-T.mjs +0 -8141
  630. package/dist/seeds-C4bZ8L-T.mjs.map +0 -1
  631. package/dist/sniffer-BIBm9dAb.mjs +0 -1825
  632. package/dist/sniffer-BIBm9dAb.mjs.map +0 -1
  633. package/dist/sniffer-Cylp9W2D.cjs +0 -1998
  634. package/dist/sniffer-Cylp9W2D.cjs.map +0 -1
  635. package/dist/sst-CGdjHn2A.mjs +0 -441
  636. package/dist/sst-CGdjHn2A.mjs.map +0 -1
  637. package/dist/sst-DGuHDxVU.cjs +0 -464
  638. package/dist/sst-DGuHDxVU.cjs.map +0 -1
  639. package/dist/stages-CcS9vnNu.mjs +0 -176
  640. package/dist/stages-CcS9vnNu.mjs.map +0 -1
  641. package/dist/stages-DdBV7msu.cjs +0 -176
  642. package/dist/stages-DdBV7msu.cjs.map +0 -1
  643. package/dist/target/public.cjs +0 -15
  644. package/dist/target/public.d.cts +0 -28
  645. package/dist/target/public.d.cts.map +0 -1
  646. package/dist/target/public.d.mts +0 -28
  647. package/dist/target/public.d.mts.map +0 -1
  648. package/dist/target/public.mjs +0 -4
  649. package/dist/terminal-CPHuH4S1.cjs +0 -85
  650. package/dist/terminal-CPHuH4S1.cjs.map +0 -1
  651. package/dist/terminal-iNmAXXjs.mjs +0 -85
  652. package/dist/terminal-iNmAXXjs.mjs.map +0 -1
  653. package/dist/types-BhThob0H.d.mts +0 -7621
  654. package/dist/types-BhThob0H.d.mts.map +0 -1
  655. package/dist/types-DwoLHelT.d.cts +0 -7622
  656. package/dist/types-DwoLHelT.d.cts.map +0 -1
  657. package/dist/utils-D2Nk1Nv2.cjs +0 -205
  658. package/dist/utils-D2Nk1Nv2.cjs.map +0 -1
  659. package/dist/utils-D_fxUqvU.mjs +0 -156
  660. package/dist/utils-D_fxUqvU.mjs.map +0 -1
  661. package/dist/vitest.cjs +0 -65
  662. package/dist/vitest.cjs.map +0 -1
  663. package/dist/vitest.d.cts +0 -29
  664. package/dist/vitest.d.cts.map +0 -1
  665. package/dist/vitest.d.mts +0 -29
  666. package/dist/vitest.d.mts.map +0 -1
  667. package/dist/vitest.mjs +0 -65
  668. package/dist/vitest.mjs.map +0 -1
  669. package/dist/workerRuntime-BXfhbe13.cjs +0 -108
  670. package/dist/workerRuntime-BXfhbe13.cjs.map +0 -1
  671. package/dist/workerRuntime-CsOyBRx2.mjs +0 -79
  672. package/dist/workerRuntime-CsOyBRx2.mjs.map +0 -1
  673. package/dist/workspace-D5CpOp1y.mjs +0 -2108
  674. package/dist/workspace-D5CpOp1y.mjs.map +0 -1
  675. package/dist/workspace-DRjdu1OY.cjs +0 -2514
  676. package/dist/workspace-DRjdu1OY.cjs.map +0 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ A powerful CLI tool for building and managing TypeScript-based backend APIs with
7
7
  - **Project Scaffolding**: Interactive `init` command to bootstrap new projects with templates
8
8
  - **Multi-Provider Support**: Generate handlers for AWS Lambda (API Gateway v1/v2) and server applications
9
9
  - **Development Server**: Hot-reload development server with file watching
10
- - **Telescope Integration**: Laravel-style recording of requests, logs and exceptions, served as JSON
10
+ - **Telescope Integration**: Laravel-style debugging dashboard for inspecting requests, logs, and exceptions
11
11
  - **OpenAPI Generation**: Auto-generate OpenAPI 3.0 specifications from your endpoints
12
12
  - **Docker Support**: Generate optimized Dockerfiles with multi-stage builds, turbo prune for monorepos
13
13
  - **Secrets Management**: Secure credential generation, encryption, and stage-based secrets storage
@@ -54,7 +54,6 @@ Create a `gkm.config.ts` file in your project root:
54
54
  import { defineConfig } from '@geekmidas/cli/config';
55
55
 
56
56
  export default defineConfig({
57
- stages: { local: 'dev', deployed: ['prod'] },
58
57
  // Glob pattern to find endpoint files
59
58
  routes: 'src/routes/**/*.ts',
60
59
 
@@ -73,7 +72,7 @@ export default defineConfig({
73
72
  // Logger configuration
74
73
  logger: './src/logger.ts#logger',
75
74
 
76
- // Optional: Telescope request recording (enabled by default in dev)
75
+ // Optional: Telescope debugging dashboard (enabled by default in dev)
77
76
  telescope: {
78
77
  enabled: true,
79
78
  path: '/__telescope',
@@ -122,17 +121,17 @@ Create endpoint files in `src/routes/`:
122
121
 
123
122
  ```typescript
124
123
  // src/routes/users.ts
125
- import { api } from '../constructs/api';
124
+ import { e } from '@geekmidas/constructs/endpoints';
126
125
  import { z } from 'zod';
127
126
 
128
- export const getUsers = api
127
+ export const getUsers = e
129
128
  .get('/users')
130
129
  .output(z.array(z.object({ id: z.string(), name: z.string() })))
131
130
  .handle(async () => {
132
131
  return [{ id: '1', name: 'John Doe' }];
133
132
  });
134
133
 
135
- export const createUser = api
134
+ export const createUser = e
136
135
  .post('/users')
137
136
  .body(z.object({ name: z.string() }))
138
137
  .output(z.object({ id: z.string(), name: z.string() }))
@@ -143,32 +142,36 @@ export const createUser = api
143
142
 
144
143
  ### 5. Create Subscribers (Optional)
145
144
 
146
- Declare the topic once, and a worker to run what has no port; a subscriber is
147
- built from the worker and binds to the topic:
145
+ Create event subscribers in `src/subscribers/`:
148
146
 
149
147
  ```typescript
150
- // src/constructs/topics.ts
151
- import { Topic } from '@geekmidas/constructs/topic';
152
- import { z } from 'zod';
153
-
154
- export const users = new Topic('Users', {
155
- events: {
156
- 'user.created': z.object({ userId: z.string(), email: z.email() }),
157
- 'user.updated': z.object({ userId: z.string() }),
158
- },
159
- });
160
-
161
- // src/constructs/worker.ts
162
- import { Worker } from '@geekmidas/constructs/worker';
163
-
164
- export const worker = new Worker('Jobs', { logger });
165
-
166
148
  // src/subscribers/userSubscriber.ts
167
- import { users } from '../constructs/topics';
168
- import { worker } from '../constructs/worker';
149
+ import { SubscriberBuilder } from '@geekmidas/constructs/subscribers';
150
+ import type { Service } from '@geekmidas/services';
151
+ import type { EventPublisher, PublishableMessage } from '@geekmidas/events';
152
+ import type { EnvironmentParser } from '@geekmidas/envkit';
153
+
154
+ // Define event types
155
+ type UserEvents =
156
+ | PublishableMessage<'user.created', { userId: string; email: string }>
157
+ | PublishableMessage<'user.updated', { userId: string }>;
158
+
159
+ // Create event publisher service
160
+ const userEventPublisher = {
161
+ serviceName: 'userEventPublisher' as const,
162
+ async register(envParser: EnvironmentParser<{}>) {
163
+ const config = envParser.create((get) => ({
164
+ publisherUrl: get('EVENT_PUBLISHER_URL').string()
165
+ })).parse();
166
+
167
+ const { Publisher } = await import('@geekmidas/events');
168
+ return Publisher.fromConnectionString<UserEvents>(config.publisherUrl);
169
+ }
170
+ } satisfies Service<'userEventPublisher', EventPublisher<UserEvents>>;
169
171
 
170
- export const userCreatedSubscriber = worker
171
- .topic(users)
172
+ // Create subscriber
173
+ export const userCreatedSubscriber = new SubscriberBuilder()
174
+ .publisher(userEventPublisher)
172
175
  .subscribe(['user.created'])
173
176
  .handle(async ({ events, logger }) => {
174
177
  for (const event of events) {
@@ -178,16 +181,11 @@ export const userCreatedSubscriber = worker
178
181
  });
179
182
  ```
180
183
 
181
- An endpoint publishes to the topic with `.event(users, { type: 'user.created',
182
- payload: (user) => ({ userId: user.id, email: user.email }) })`. Declaring the
183
- topic is what puts a broker in the local plan and resolves
184
- `USERS_PUBLISHER_CONNECTION_STRING` for whatever publishes to it.
185
-
186
184
  ### 6. Build Handlers
187
185
 
188
186
  ```bash
189
- # Build for where gkm.config.ts deploys (AWS for `deploy: { default: 'sst' }`)
190
- npx gkm build
187
+ # Generate AWS Lambda handlers
188
+ npx gkm build --provider aws-apigatewayv1
191
189
 
192
190
  # Generate server application
193
191
  npx gkm build --provider server
@@ -226,7 +224,7 @@ When run without `--yes`, the command will ask:
226
224
  - `api` - Full API with auth, database, services
227
225
  - `serverless` - AWS Lambda handlers
228
226
  - `worker` - Background job processing
229
- 3. **Telescope** - Include request, exception and log recording (default: yes)
227
+ 3. **Telescope** - Include debugging dashboard (default: yes)
230
228
  4. **Database** - Include Kysely database support (default: yes)
231
229
  5. **Logger** - Choose logger implementation:
232
230
  - `pino` - Fast JSON logger for production (recommended)
@@ -311,20 +309,17 @@ Generate handlers from your endpoints.
311
309
  gkm build [options]
312
310
  ```
313
311
 
314
- By default it builds for where the project deploys: `deploy: { default: 'sst' }`
315
- builds for AWS, one Lambda per construct; `dokploy` (the default when nothing
316
- is declared) builds a server.
317
-
318
312
  **Options:**
319
- - `--provider <provider>`: Override the deploy target
320
- - `aws`: One Lambda handler per construct (API Gateway v2 for endpoints)
313
+ - `--provider <provider>`: Target provider (default: `aws-apigatewayv1`)
314
+ - `aws-apigatewayv1`: AWS API Gateway v1 Lambda handlers
315
+ - `aws-apigatewayv2`: AWS API Gateway v2 Lambda handlers
321
316
  - `server`: Server application with Hono
322
317
  - `--production`: Generate production-optimized bundle (server provider only)
323
318
 
324
319
  **Example:**
325
320
  ```bash
326
- # Build for where gkm.config.ts deploys
327
- gkm build
321
+ # Generate AWS Lambda handlers
322
+ gkm build --provider aws-apigatewayv1
328
323
 
329
324
  # Generate server application
330
325
  gkm build --provider server
@@ -338,7 +333,7 @@ gkm build --provider server --production
338
333
  When using `--production` with the server provider, the CLI generates an optimized bundle at `.gkm/server/dist/server.mjs`. This bundle:
339
334
  - Is minified and tree-shaken for smaller size
340
335
  - Includes all dependencies (single-file deployment)
341
- - Is what `gkm docker`'s images run — built inside the image, never copied in from the host
336
+ - Can be used with `gkm docker --slim` for minimal Docker images
342
337
 
343
338
  ### `gkm openapi`
344
339
 
@@ -438,44 +433,54 @@ gkm docker [options]
438
433
  ```
439
434
 
440
435
  **Options:**
441
- - `--build`: Build each app's image after generating files
442
- - `--push`: Push the images to the registry after building
436
+ - `--build`: Build Docker image after generating files
437
+ - `--push`: Push image to registry after building
443
438
  - `--tag <tag>`: Image tag (default: `latest`)
444
439
  - `--registry <url>`: Container registry URL
440
+ - `--slim`: Use slim Dockerfile (requires pre-built bundle from `gkm build --production`)
441
+ - `--turbo`: Enable turbo prune for monorepo optimization
442
+ - `--turbo-package <name>`: Package name for turbo prune (defaults to package.json name)
445
443
 
446
444
  **Generated Files:**
447
- - `.gkm/docker/Dockerfile.<app>` - one per app (`Dockerfile` for an app at the root)
448
- - `docker-compose.constructs.yml` - the containers the constructs imply, and the apps (project root)
449
- - `.dockerignore` - at the build root, created or completed
445
+ - `.gkm/docker/Dockerfile` - Multi-stage or slim Dockerfile
446
+ - `.gkm/docker/docker-compose.yml` - Docker Compose configuration
447
+ - `.gkm/docker/docker-entrypoint.sh` - Entrypoint script
448
+ - `.dockerignore` - Docker ignore file (project root)
450
449
 
451
- **How an image is built:**
450
+ **Dockerfile Types:**
452
451
 
453
- Every image is built inside Docker — `docker build` on a clean checkout is all
454
- it takes. The context is the build root (the directory holding the lockfile or
455
- `pnpm-workspace.yaml`, at or above the workspace); `turbo prune` cuts the app's
456
- slice of it; the image installs it, builds the workspace packages the app
457
- depends on, and builds the app (`gkm build --provider server --production` for
458
- a backend, the framework's build for a site). The runner holds `server.mjs`, a
459
- Next.js standalone server, or a Vite site's files served by Caddy.
452
+ | Type | Flag | Description |
453
+ |------|------|-------------|
454
+ | Multi-stage | (default) | Builds from source inside Docker, most reproducible |
455
+ | Turbo | `--turbo` | Optimized for monorepos with turbo prune |
456
+ | Slim | `--slim` | Uses pre-built bundle, requires prior `gkm build --production` |
460
457
 
461
458
  **Example:**
462
459
  ```bash
463
- # Generate the Dockerfiles
460
+ # Generate multi-stage Dockerfile (default, recommended)
464
461
  gkm docker
465
462
 
466
- # Generate and build the images
463
+ # Generate and build image
467
464
  gkm docker --build --tag v1.0.0
468
465
 
469
466
  # Build and push to registry
470
467
  gkm docker --build --push --registry ghcr.io/myorg --tag v1.0.0
468
+
469
+ # Use turbo prune for monorepo
470
+ gkm docker --turbo --turbo-package my-api
471
+
472
+ # Use slim Dockerfile (after running gkm build --production)
473
+ gkm build --provider server --production
474
+ gkm docker --slim
471
475
  ```
472
476
 
473
477
  **Package Manager Support:**
474
478
 
475
- The package manager is detected from the lockfile and pinned to the build
476
- root's `packageManager` field; turbo is pinned to the version the build root
477
- resolves. Dependencies install with a BuildKit cache mount for the package
478
- manager's store.
479
+ The CLI auto-detects your package manager from lockfiles and generates optimized Dockerfiles:
480
+ - **pnpm**: Uses `pnpm fetch` for better layer caching
481
+ - **npm**: Uses `npm ci` with cache mounts
482
+ - **yarn**: Uses `yarn install --frozen-lockfile`
483
+ - **bun**: Uses `bun install --frozen-lockfile`
479
484
 
480
485
  **Configuration:**
481
486
 
@@ -485,7 +490,6 @@ Configure Docker settings in `gkm.config.ts`:
485
490
  import { defineConfig } from '@geekmidas/cli/config';
486
491
 
487
492
  export default defineConfig({
488
- stages: { local: 'dev', deployed: ['prod'] },
489
493
  routes: 'src/routes/**/*.ts',
490
494
  envParser: './src/env.ts',
491
495
  logger: './src/logger.ts',
@@ -499,20 +503,38 @@ export default defineConfig({
499
503
  baseImage: 'node:22-alpine',
500
504
  // Port to expose (default: 3000)
501
505
  port: 3000,
506
+ // Docker Compose services
507
+ compose: {
508
+ services: {
509
+ postgres: { image: 'postgis/postgis:16-3.4-alpine' }, // Custom image
510
+ redis: true, // Default version
511
+ rabbitmq: { version: '3.12-management-alpine' }, // Custom version
512
+ },
513
+ },
502
514
  },
503
515
  });
504
516
  ```
505
517
 
506
- **Compose:** there is no `compose` option. `gkm docker` writes
507
- `docker-compose.constructs.yml` at the project root from the declared
508
- constructs; an image pin or an extra service goes in your own
509
- `docker-compose.yml`, which is merged over it:
518
+ **Docker Compose Services:**
510
519
 
511
- ```yaml
512
- # docker-compose.yml
513
- services:
514
- postgres:
515
- image: postgis/postgis:16-3.4-alpine
520
+ Services can be configured with custom versions, custom images, or use defaults:
521
+
522
+ ```typescript
523
+ // Object format (recommended)
524
+ services: {
525
+ postgres: { version: '15-alpine' }, // Custom version
526
+ redis: true, // Default: redis:7-alpine
527
+ rabbitmq: { version: '3.12-management-alpine' },
528
+ }
529
+
530
+ // Custom images (e.g., PostGIS, Redis Stack)
531
+ services: {
532
+ postgres: { image: 'postgis/postgis:16-3.4-alpine' }, // Full image reference
533
+ redis: { image: 'redis/redis-stack:latest' },
534
+ }
535
+
536
+ // Legacy array format - uses default versions
537
+ services: ['postgres', 'redis', 'rabbitmq']
516
538
  ```
517
539
 
518
540
  **Service Configuration Options:**
@@ -535,7 +557,7 @@ services:
535
557
 
536
558
  ### `gkm dev`
537
559
 
538
- Start a development server with hot-reload and optional Telescope recording.
560
+ Start a development server with hot-reload and optional Telescope debugging dashboard.
539
561
 
540
562
  ```bash
541
563
  gkm dev [options]
@@ -547,8 +569,7 @@ gkm dev [options]
547
569
  **Features:**
548
570
  - Hot-reload on file changes (endpoints, functions, crons, subscribers)
549
571
  - Automatic port switching if requested port is in use
550
- - Telescope JSON API at `/__telescope/api` (enabled by default)
551
- - The declared database, read-only, as JSON at `/__gkm/db`
572
+ - Telescope debugging dashboard (enabled by default)
552
573
  - Real-time WebSocket updates in Telescope
553
574
 
554
575
  **Example:**
@@ -661,8 +682,8 @@ gkm secrets:init --stage production --force
661
682
  ```
662
683
 
663
684
  **Generated:**
664
- - Custom secrets for the stage; the containers' credentials are provisioned by
665
- reconcile from the declared constructs, not stored here
685
+ - Secure passwords for postgres, redis, rabbitmq (based on `docker.compose.services` config)
686
+ - Connection URLs (`DATABASE_URL`, `REDIS_URL`, `RABBITMQ_URL`)
666
687
  - Stored in `.gkm/secrets/<stage>.json` (gitignored)
667
688
 
668
689
  ### `gkm secrets:set`
@@ -776,7 +797,7 @@ Store credentials locally to avoid setting environment variables for every comma
776
797
 
777
798
  ### `gkm login`
778
799
 
779
- Authenticate with a deployment service. Credentials are stored in `~/.gkm/credentials.json` (`$GKM_HOME/credentials.json` when `GKM_HOME` is set).
800
+ Authenticate with a deployment service. Credentials are stored in `~/.gkm/credentials.json`.
780
801
 
781
802
  ```bash
782
803
  gkm login [options]
@@ -804,7 +825,7 @@ gkm login --endpoint https://dokploy.example.com
804
825
  # These commands no longer need DOKPLOY_API_TOKEN
805
826
  gkm deploy:list
806
827
  gkm deploy:init --project my-project --app api
807
- gkm deploy --stage production
828
+ gkm deploy --provider dokploy --stage production
808
829
  ```
809
830
 
810
831
  ### `gkm logout`
@@ -850,99 +871,91 @@ gkm whoami
850
871
 
851
872
  ### `gkm deploy`
852
873
 
853
- Deploy a stage through its **target**: `deploy.default` in `gkm.config.ts`
854
- (`dokploy` when unset), or `--target` for one run. `dokploy`, `compose` and
855
- `sst` ship with the CLI; any other target is a package the project installs and
856
- names in `deploy.targets`.
874
+ Deploy application to a provider. Builds for production, injects encrypted secrets, and deploys.
857
875
 
858
876
  ```bash
859
- gkm deploy --stage <stage> [options]
877
+ gkm deploy --provider <provider> --stage <stage> [options]
860
878
  ```
861
879
 
862
880
  **Options:**
863
- - `--stage <stage>`: Deployment stage (required): one of `stages.deployed`, or the local stage through `compose`
864
- - `--target <name>`: `dokploy`, `compose`, `sst`, or a name in `deploy.targets` (default: `deploy.default`)
865
- - `--tag <tag>`: Image tag (default: `<stage>-<timestamp>`; compose: the commit). Through compose, a given tag is pulled
866
- - `--json`: Write the deploy's events as JSON lines on stdout instead of progress; never prompts
867
- - `--dry-run`: Show what would be created or reused, and change, build and push nothing
868
- - `--atomic`: If the release fails, roll back every app it released, not only the ones that failed
869
- - `--provider <provider>`: Deprecated. `dokploy` means `--target dokploy`; `docker` and `aws-lambda` fail with `ProviderRemoved`
870
- - `--skip-push`, `--skip-build`: Deprecated and ignored
881
+ - `--provider <provider>`: Deploy provider (`docker`, `dokploy`, `aws-lambda`)
882
+ - `--stage <stage>`: Deployment stage
883
+ - `--tag <tag>`: Image tag (default: `stage-timestamp`)
884
+ - `--skip-push`: Skip pushing image to registry
885
+ - `--skip-build`: Skip build step (use existing build)
871
886
 
872
887
  **Examples:**
873
888
  ```bash
874
- # deploy.default (dokploy unless configured otherwise)
875
- DOKPLOY_API_TOKEN=xxx gkm deploy --stage production
876
-
877
- # Plan only
878
- gkm deploy --stage production --dry-run
879
-
880
- # One Docker Compose stack behind Caddy, on this machine, from images CI pushed
881
- gkm deploy --target compose --stage production --tag v1.4.0
889
+ # Docker: build and push image
890
+ gkm deploy --provider docker --stage production
882
891
 
883
- # AWS, with deploy: { default: 'sst' }: gkm build --provider aws, then sst deploy
884
- AWS_PROFILE=acme-prod gkm deploy --stage production
892
+ # Dokploy: build, push, and trigger deployment
893
+ DOKPLOY_API_TOKEN=xxx gkm deploy --provider dokploy --stage production
885
894
 
886
- # Events for another program
887
- gkm deploy --stage production --json | jq -c 'select(.type == "app.deployed")'
895
+ # Custom tag
896
+ gkm deploy --provider docker --stage production --tag v1.0.0
888
897
  ```
889
898
 
890
- **What every deploy does:** loads the config and discovers the constructs in a
891
- sandbox, takes the stage's lock (a second run gets `StateLocked`; a crashed
892
- run's lock is released with `gkm state:unlock`), checks every credential and
893
- secret before anything changes, then runs the target's phases
894
- (`provision`, `build`, `release`, `verify`) and reports each as events.
899
+ **Workflow:**
900
+ 1. **Sniffs environment variables** - Automatically detects which env vars each app needs
901
+ 2. Builds production bundle with `gkm build --provider server --production --stage <stage>`
902
+ 3. Encrypts secrets from `.gkm/secrets/<stage>.json` into the bundle
903
+ 4. Generates Docker files with `gkm docker`
904
+ 5. Builds and pushes Docker image
905
+ 6. (Dokploy) Triggers deployment via API with `GKM_MASTER_KEY`
895
906
 
896
- **Verified, or rolled back (Dokploy).** An app counts as released once Dokploy's deployment has finished and the app has answered its health route 2xx three times in a row (`/health` for a backend, `/` for a site; an app without a domain gets the deployment check only). Backends are released and checked before any site is released, and a failed backend stops the run. Whatever fails is pointed back at the image it ran before. Pending migrations are applied before any app is switched, in the deploy's sandbox, with each database URL handed over as a secret file. Tune the checks with `deploy.dokploy.verify: { deploymentTimeoutMs, healthCheckPath, healthyAfter, intervalMs, healthTimeoutMs }`.
907
+ **Environment Variable Detection:**
897
908
 
898
- At a terminal a missing Dokploy or registry login is asked for (and the Dokploy one stored). With `--json` or without a terminal nothing is asked: the deploy stops with `MissingCredential` and exits 1.
909
+ The deploy command automatically detects required environment variables for each app using different strategies based on app configuration:
899
910
 
900
- **From a program:** the same deploy is `deploy()` from `@geekmidas/cli/deploy` — explicit `cwd`, an injected `CredentialProvider`, a logger and an `AbortSignal`; it returns a run you iterate for JSON events, plus a `result` promise. It never prompts, prints or exits.
911
+ | App Type | Detection Strategy |
912
+ |----------|-------------------|
913
+ | Frontend apps | Returns empty (no server secrets) |
914
+ | Apps with `requiredEnv` | Uses explicit list from config |
915
+ | Entry-based apps | Imports entry file in subprocess to capture `config.parse()` calls |
916
+ | Route-based apps | Loads routes and calls `getEnvironment()` on each construct |
917
+ | Apps with `envParser` only | Runs SnifferEnvironmentParser to detect usage |
901
918
 
902
- ```typescript
903
- import { deploy } from '@geekmidas/cli/deploy';
919
+ For route-based apps, the sniffer loads each endpoint/function/cron/subscriber and collects environment variables from:
920
+ - All services attached to the construct (via `service.register()`)
921
+ - Publisher service (if any)
922
+ - Auditor storage service (if any)
923
+ - Database service (if any)
904
924
 
905
- const run = deploy({ cwd: '/srv/shop', stage: 'production', signal });
906
- for await (const event of run) console.log(event.type);
907
- const result = await run.result;
908
- ```
925
+ This allows the CLI to validate that all required secrets are configured before deployment, preventing runtime errors from missing environment variables.
909
926
 
910
- The project's own code — loading `gkm.config.ts`, discovering constructs, sniffing each app's environment, running migrations — runs in a `Sandbox`, never in the host process and never with the deploy's credentials. The default `LocalSandbox` is a child process with an allowlisted environment and a timeout per step; a host building repositories it does not trust passes its own isolating one (`sandbox`), and a config holding live objects then fails with `ConfigObjectNotSerializable`.
927
+ **Configuration:**
911
928
 
912
- **Writing a target:** `defineTarget` from `@geekmidas/cli/target`, with the package's runtime declared in its `package.json` (`"gkm": { "runtime": "server" }`).
929
+ ```typescript
930
+ // gkm.config.ts
931
+ export default defineConfig({
932
+ routes: 'src/endpoints/**/*.ts',
933
+ envParser: './src/env.ts',
934
+ logger: './src/logger.ts',
913
935
 
914
- **Environment Variables:**
915
- - `DOKPLOY_API_TOKEN`: API token for Dokploy (not needed if logged in via `gkm login`)
916
- - `DOKPLOY_ENDPOINT`: Dokploy URL, if neither the stored login nor `deploy.dokploy.endpoint` gives one
917
- - `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`: a registry login, used only when Dokploy has no registry for `deploy.registry` and one has to be created
918
- - `AWS_PROFILE`, or `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`: the `sst` target's AWS credentials, handed to `sst deploy` only (the profile wins when both are set)
919
- - `GKM_HOME`: where stage keys and stored logins live (default `~/.gkm`)
920
- - `GKM_MASTER_KEY`: set in each container's runtime environment by the deploy; for an image you run yourself, from `.gkm/server/master.key`, which `gkm build --stage` writes (the key is never printed; output shows its fingerprint)
921
-
922
- **Guides:**
923
- [Deploy targets](https://geekmidas.github.io/toolbox/next/guide/deploy-targets) ·
924
- [Writing a target](https://geekmidas.github.io/toolbox/next/guide/writing-a-target) ·
925
- [Deploying from a program](https://geekmidas.github.io/toolbox/next/guide/deploy-api) ·
926
- [The sandbox](https://geekmidas.github.io/toolbox/next/guide/sandbox) ·
927
- [Deploy state](https://geekmidas.github.io/toolbox/next/guide/state) ·
928
- [Running in production](https://geekmidas.github.io/toolbox/next/guide/production) ·
929
- [Upgrading to 10.0.0-alpha](https://geekmidas.github.io/toolbox/next/guide/upgrading) ·
930
- [Deprecated deploy APIs](https://geekmidas.github.io/toolbox/next/guide/deploy-deprecations)
931
-
932
- ### `gkm deploy:rollback`
933
-
934
- Put a stage's app back on the release before the one it runs (Dokploy). One app by default; `--atomic` rolls back every app that has an earlier release, for apps that only work together. It restores images only: migrations are forward-only.
936
+ docker: {
937
+ registry: 'ghcr.io/myorg',
938
+ imageName: 'my-api',
939
+ },
935
940
 
936
- ```bash
937
- gkm deploy:rollback --stage production --app api
938
- gkm deploy:rollback --stage production --atomic
941
+ // For Dokploy deployments
942
+ providers: {
943
+ dokploy: {
944
+ endpoint: 'https://dokploy.example.com',
945
+ projectId: 'proj_xxx',
946
+ applicationId: 'app_xxx',
947
+ },
948
+ },
949
+ });
939
950
  ```
940
951
 
941
- From a program: `rollbackStage({ cwd, stage, app })` from `@geekmidas/cli/deploy`.
952
+ **Environment Variables:**
953
+ - `DOKPLOY_API_TOKEN`: API token for Dokploy (not needed if logged in via `gkm login`)
954
+ - `GKM_MASTER_KEY`: Automatically set by Dokploy, or manually for Docker deployments
942
955
 
943
956
  ### `gkm deploy:init`
944
957
 
945
- Initialize a new Dokploy deployment by creating a project and application via the Dokploy API. Nothing is written to `gkm.config.ts`: the ids are rediscovered by name on each run and kept in the deploy state file.
958
+ Initialize a new Dokploy deployment by creating a project and application via the Dokploy API. Automatically updates `gkm.config.ts` with the configuration.
946
959
 
947
960
  ```bash
948
961
  gkm deploy:init --project <name> --app <name> [options]
@@ -977,7 +990,8 @@ gkm deploy:init \
977
990
  1. Searches for existing project by name, or creates a new one
978
991
  2. Creates a new application in the project
979
992
  3. Configures registry if `--registry-id` is provided
980
- 4. Shows next steps for secrets and deployment
993
+ 4. Updates `gkm.config.ts` with the Dokploy configuration
994
+ 5. Shows next steps for secrets and deployment
981
995
 
982
996
  ### `gkm deploy:list`
983
997
 
@@ -1003,24 +1017,6 @@ gkm deploy:list --registries
1003
1017
  gkm deploy:list --endpoint https://dokploy.example.com
1004
1018
  ```
1005
1019
 
1006
- ### `gkm state:*`
1007
-
1008
- Deploy state records what a stage's deploys created, so the next deploy finds
1009
- it again. It lives where `state` in `gkm.config.ts` says: `.gkm/deploy-<stage>.json`
1010
- by default, or SSM (`{ provider: 'ssm', region }`) or S3
1011
- (`{ provider: 's3', bucket, region }`) for teams and CI. Every deploy holds the
1012
- stage's lock and writes conditionally.
1013
-
1014
- ```bash
1015
- gkm state:show --stage production [--json] # ids, releases, pending resources; secrets masked
1016
- gkm state:pull --stage production # remote → .gkm/
1017
- gkm state:push --stage production # .gkm/ → remote, under the remote lock
1018
- gkm state:diff --stage production
1019
- gkm state:unlock --stage production # release a crashed deploy's lock
1020
- ```
1021
-
1022
- See [Deploy state](https://geekmidas.github.io/toolbox/next/guide/state).
1023
-
1024
1020
  ### Using Encrypted Credentials
1025
1021
 
1026
1022
  After deploying with secrets, your application decrypts credentials at runtime:
@@ -1044,7 +1040,7 @@ export const envParser = new EnvironmentParser({...process.env, ...Credentials})
1044
1040
 
1045
1041
  **How it works:**
1046
1042
  - At build time, secrets are encrypted with AES-256-GCM and embedded in the bundle
1047
- - An ephemeral master key is generated per build and written to `.gkm/server/master.key` (mode `0600`); the build prints its path and fingerprint, never the key
1043
+ - An ephemeral master key is generated per build
1048
1044
  - At runtime, `Credentials` decrypts using `GKM_MASTER_KEY` environment variable
1049
1045
  - In development (no embedded secrets), `Credentials` returns `{}`
1050
1046
 
@@ -1063,23 +1059,28 @@ The following commands are planned for future releases:
1063
1059
  The `gkm.config.ts` file defines how the CLI discovers and processes your endpoints:
1064
1060
 
1065
1061
  ```typescript
1066
- // Construct types accept a glob string or an array of them
1067
- type Routes = string | string[];
1062
+ // Construct types accept a string, string[], or partitioned config
1063
+ type Routes = string | string[] | PartitionedRoutes;
1064
+
1065
+ interface PartitionedRoutes {
1066
+ paths: string | string[];
1067
+ partition: (filepath: string) => string;
1068
+ }
1068
1069
 
1069
1070
  interface GkmConfig {
1070
- routes: Routes; // Glob patterns
1071
+ routes: Routes; // Glob patterns or partitioned config
1071
1072
  envParser: string; // Path to environment parser
1072
1073
  logger: string; // Path to logger configuration
1073
- functions?: Routes; // Glob patterns
1074
- crons?: Routes; // Glob patterns
1075
- subscribers?: Routes; // Glob patterns
1074
+ functions?: Routes; // Glob patterns or partitioned config
1075
+ crons?: Routes; // Glob patterns or partitioned config
1076
+ subscribers?: Routes; // Glob patterns or partitioned config
1076
1077
  runtime?: 'node' | 'bun'; // Runtime environment (default: 'node')
1077
1078
  telescope?: boolean | TelescopeConfig; // Telescope debugging config
1078
1079
  }
1079
1080
 
1080
1081
  interface TelescopeConfig {
1081
1082
  enabled?: boolean; // Enable/disable (default: true in dev)
1082
- path?: string; // Where the JSON API is mounted (default: '/__telescope')
1083
+ path?: string; // Dashboard path (default: '/__telescope')
1083
1084
  ignore?: string[]; // URL patterns to ignore
1084
1085
  recordBody?: boolean; // Record request/response bodies (default: true)
1085
1086
  maxEntries?: number; // Max entries to keep (default: 1000)
@@ -1091,7 +1092,7 @@ interface TelescopeConfig {
1091
1092
 
1092
1093
  #### `routes`
1093
1094
 
1094
- Glob pattern(s) to discover endpoint files. Can be a single pattern or an array of patterns:
1095
+ Glob pattern(s) to discover endpoint files. Can be a single pattern, array of patterns, or a partitioned config:
1095
1096
 
1096
1097
  ```typescript
1097
1098
  // Single pattern
@@ -1103,8 +1104,19 @@ routes: [
1103
1104
  'src/api/**/*.ts',
1104
1105
  'src/handlers/**/*.ts'
1105
1106
  ]
1107
+
1108
+ // Partitioned — groups constructs in the generated manifest
1109
+ routes: {
1110
+ paths: './src/endpoints/**/*.ts',
1111
+ partition: (filepath) => {
1112
+ const match = filepath.match(/endpoints\/([^/]+)\//);
1113
+ return match?.[1] ?? 'default';
1114
+ },
1115
+ }
1106
1116
  ```
1107
1117
 
1118
+ The same partitioned format works for `functions`, `crons`, and `subscribers`. When a `partition` callback is provided, the generated manifest groups constructs by partition name (e.g., `manifest.routes.admin`). Without it, manifest fields remain flat arrays.
1119
+
1108
1120
  #### `envParser`
1109
1121
 
1110
1122
  Path to your environment parser configuration. Supports both default and named exports.
@@ -1137,7 +1149,7 @@ logger: './src/utils.ts#appLogger'
1137
1149
 
1138
1150
  #### `telescope`
1139
1151
 
1140
- Configuration for Telescope, which records requests, logs and exceptions and serves them as JSON. Telescope is enabled by default when using `gkm dev`.
1152
+ Configuration for the Telescope debugging dashboard. Telescope is enabled by default when using `gkm dev`.
1141
1153
 
1142
1154
  ```typescript
1143
1155
  // Disable telescope
@@ -1162,7 +1174,7 @@ telescope: {
1162
1174
  | Option | Type | Default | Description |
1163
1175
  |--------|------|---------|-------------|
1164
1176
  | `enabled` | `boolean` | `true` | Enable/disable Telescope |
1165
- | `path` | `string` | `/__telescope` | Where the JSON API is mounted |
1177
+ | `path` | `string` | `/__telescope` | Dashboard URL path |
1166
1178
  | `ignore` | `string[]` | `[]` | URL patterns to exclude from recording |
1167
1179
  | `recordBody` | `boolean` | `true` | Record request/response bodies |
1168
1180
  | `maxEntries` | `number` | `1000` | Maximum entries per type to keep |
@@ -1204,8 +1216,41 @@ import { defineWorkspace } from '@geekmidas/cli/config';
1204
1216
 
1205
1217
  export default defineWorkspace({
1206
1218
  name: 'my-project',
1207
- stages: { local: 'dev', deployed: ['prod'] },
1208
- constructs: './constructs/**/*.ts',
1219
+ apps: {
1220
+ api: {
1221
+ type: 'backend',
1222
+ path: 'apps/api',
1223
+ port: 3000,
1224
+ routes: './src/endpoints/**/*.ts',
1225
+ envParser: './src/config/env#envParser',
1226
+ logger: './src/config/logger#logger',
1227
+ telescope: {
1228
+ enabled: true,
1229
+ path: '/__telescope',
1230
+ },
1231
+ openapi: {
1232
+ enabled: true,
1233
+ },
1234
+ },
1235
+ auth: {
1236
+ type: 'backend',
1237
+ path: 'apps/auth',
1238
+ port: 3002,
1239
+ entry: './src/index.ts', // Entry-based app (no routes)
1240
+ envParser: './src/config/env#envParser',
1241
+ logger: './src/config/logger#logger',
1242
+ },
1243
+ web: {
1244
+ type: 'frontend',
1245
+ framework: 'nextjs',
1246
+ path: 'apps/web',
1247
+ port: 3001,
1248
+ dependencies: ['api', 'auth'],
1249
+ client: {
1250
+ output: './src/api',
1251
+ },
1252
+ },
1253
+ },
1209
1254
  shared: {
1210
1255
  packages: ['packages/*'],
1211
1256
  models: {
@@ -1213,61 +1258,85 @@ export default defineWorkspace({
1213
1258
  schema: 'zod',
1214
1259
  },
1215
1260
  },
1261
+ services: {
1262
+ db: true,
1263
+ cache: true,
1264
+ mail: true,
1265
+ },
1216
1266
  deploy: {
1217
1267
  default: 'dokploy',
1218
1268
  },
1219
1269
  });
1220
1270
  ```
1221
1271
 
1222
- ### Where Apps Come From
1272
+ ### App Types
1223
1273
 
1224
- Each one is a construct that said it has a process of its own. The CLI reads
1225
- them out of the manifest; none of them is listed in config.
1274
+ #### Routes-Based Backend Apps
1226
1275
 
1227
- #### A Surface With Discovered Routes
1276
+ Standard API apps using endpoint discovery:
1228
1277
 
1229
1278
  ```typescript
1230
- // constructs/api.ts
1231
- export const api = new RestApi('Api', { path: 'apps/api', defaultAuthorizer: 'none', logger });
1279
+ api: {
1280
+ type: 'backend',
1281
+ path: 'apps/api',
1282
+ port: 3000,
1283
+ routes: './src/endpoints/**/*.ts', // Glob pattern for endpoints
1284
+ envParser: './src/config/env#envParser',
1285
+ logger: './src/config/logger#logger',
1286
+ }
1232
1287
  ```
1233
1288
 
1234
- `gkm build --provider server` generates a Hono server from the endpoints built
1235
- on that surface. Where they are is the conventional directories under
1236
- `apps/api`, which is what the id resolves to.
1289
+ These apps use `gkm build --provider server` internally to generate a Hono server from discovered endpoints.
1237
1290
 
1238
- #### A Surface That Declares Its Own Routes
1291
+ #### Entry-Based Backend Apps
1239
1292
 
1240
- An auth server mounts a wildcard, so there is nothing for a glob to find:
1293
+ Apps with a custom entry point (like authentication services using better-auth):
1241
1294
 
1242
1295
  ```typescript
1243
- // constructs/auth.ts
1244
- export const auth = new BetterAuth('Auth', {
1296
+ auth: {
1297
+ type: 'backend',
1245
1298
  path: 'apps/auth',
1246
- database: authDb,
1247
- basePath: '/api/auth',
1248
- });
1299
+ port: 3002,
1300
+ entry: './src/index.ts', // Direct entry point
1301
+ envParser: './src/config/env#envParser',
1302
+ logger: './src/config/logger#logger',
1303
+ }
1249
1304
  ```
1250
1305
 
1251
- The build generates the entry from the declaration — a file that imports the
1252
- construct and starts it. There is no hand-written `src/index.ts`, and no
1253
- `entry` field pointing at one.
1254
-
1255
- It gets a container like every other surface, and nothing opts it in. Two
1256
- surfaces in one process share a filesystem, an environment and every credential
1257
- either was granted, so an auth server beside an API is one bug in the API away
1258
- from being read by it.
1306
+ Entry-based apps are bundled directly with esbuild into a standalone file. All dependencies are bundled, producing a single `index.mjs` file that runs without `node_modules`.
1259
1307
 
1260
- #### Frontends
1308
+ Example entry point for an auth service:
1261
1309
 
1262
1310
  ```typescript
1263
- // constructs/site.ts
1264
- export const web = new StaticSite('Web', { path: 'apps/web' }).dependsOn([api, auth]);
1265
- export const admin = new StaticSite('Admin', { path: 'apps/admin', variant: 'next' }).dependsOn([api]);
1311
+ // apps/auth/src/index.ts
1312
+ import { Hono } from 'hono';
1313
+ import { serve } from '@hono/node-server';
1314
+ import { auth } from './auth.js';
1315
+
1316
+ const app = new Hono();
1317
+
1318
+ app.get('/health', (c) => c.json({ status: 'ok' }));
1319
+ app.on(['POST', 'GET'], '/api/auth/*', (c) => auth.handler(c.req.raw));
1320
+
1321
+ serve({ fetch: app.fetch, port: 3002 });
1266
1322
  ```
1267
1323
 
1268
- `.dependsOn()` is the single fact behind four things that are hand-maintained
1269
- otherwise: the site's build-time `VITE_API_URL`, the API's CORS origins, the
1270
- auth server's trusted origins, and which generated client lands in which app.
1324
+ #### Frontend Apps
1325
+
1326
+ Next.js or other frontend frameworks:
1327
+
1328
+ ```typescript
1329
+ web: {
1330
+ type: 'frontend',
1331
+ framework: 'nextjs',
1332
+ path: 'apps/web',
1333
+ port: 3001,
1334
+ dependencies: ['api', 'auth'], // Apps this depends on
1335
+ client: {
1336
+ output: './src/api', // Where to generate API client
1337
+ },
1338
+ }
1339
+ ```
1271
1340
 
1272
1341
  ### Workspace Docker Generation
1273
1342
 
@@ -1281,7 +1350,7 @@ gkm docker
1281
1350
  - `.gkm/docker/Dockerfile.api` - Routes-based backend (uses `gkm build`)
1282
1351
  - `.gkm/docker/Dockerfile.auth` - Entry-based backend (uses esbuild bundling)
1283
1352
  - `.gkm/docker/Dockerfile.web` - Next.js standalone output
1284
- - `docker-compose.constructs.yml` - every container the constructs imply, and each app behind the `apps` profile (project root)
1353
+ - `.gkm/docker/docker-compose.yml` - Full stack with all apps and services
1285
1354
  - `.dockerignore` - Optimized ignore patterns
1286
1355
 
1287
1356
  **Dockerfile types by app:**
@@ -1313,10 +1382,8 @@ The `--packages=bundle` flag bundles all dependencies (unlike tsdown's default b
1313
1382
 
1314
1383
  ```typescript
1315
1384
  interface WorkspaceConfig {
1316
- /** The scope every physical name is built from. */
1317
1385
  name: string;
1318
- /** One glob, every kind. The apps come from what it finds. */
1319
- constructs: string;
1386
+ apps: Record<string, AppConfig>;
1320
1387
  shared?: {
1321
1388
  packages?: string[];
1322
1389
  models?: {
@@ -1324,59 +1391,78 @@ interface WorkspaceConfig {
1324
1391
  schema: 'zod' | 'valibot';
1325
1392
  };
1326
1393
  };
1327
- /**
1328
- * Backend selection, and nothing else. Whether a Postgres exists comes from
1329
- * declaring a database, so `db` and `storage` are ignored rather than obeyed.
1330
- */
1331
1394
  services?: {
1332
- cache?: 'db' | 'upstash' | 'elasticache';
1333
- storage?: 'minio' | 's3' | 'r2';
1334
- mail?: 'ses' | 'resend' | 'smtp';
1335
- events?: 'pgboss' | 'sns' | 'rabbitmq';
1395
+ db?: boolean;
1396
+ cache?: boolean;
1397
+ mail?: boolean;
1336
1398
  };
1337
1399
  deploy?: {
1338
- default?: 'dokploy' | 'docker' | 'aws';
1400
+ default?: 'dokploy' | 'docker';
1339
1401
  };
1340
- /**
1341
- * Overrides for an app the manifest already derived, keyed by its name.
1342
- * The exception, not the shape — a workspace normally has none.
1343
- */
1344
- apps?: Record<string, Partial<AppConfig>>;
1345
1402
  }
1346
- ```
1347
1403
 
1348
- What an app is comes from the declaration, not from here:
1404
+ interface BackendAppConfig {
1405
+ type: 'backend';
1406
+ path: string;
1407
+ port: number;
1408
+ routes?: string; // Glob pattern for routes-based apps
1409
+ entry?: string; // Entry file for entry-based apps
1410
+ envParser: string;
1411
+ logger: string;
1412
+ telescope?: TelescopeConfig;
1413
+ openapi?: { enabled: boolean };
1414
+ }
1349
1415
 
1350
- ```typescript
1351
- /** How a site is built and run. A surface declares only its `path`. */
1352
- interface AppSpec {
1353
- /** Required: where the app lives, relative to the workspace root. */
1416
+ interface FrontendAppConfig {
1417
+ type: 'frontend';
1418
+ framework: 'nextjs';
1354
1419
  path: string;
1355
- /** Default: assigned in a stable order, so adding an app renumbers nothing. */
1356
- port?: number;
1357
- entry?: string;
1358
- runtime?: 'node' | 'bun';
1420
+ port: number;
1421
+ dependencies?: string[]; // Other apps this depends on
1422
+ client?: {
1423
+ output: string; // Where to generate typed API client
1424
+ };
1359
1425
  }
1426
+
1427
+ type AppConfig = BackendAppConfig | FrontendAppConfig;
1428
+ ```
1429
+
1430
+ ## Providers
1431
+
1432
+ ### AWS API Gateway v1
1433
+
1434
+ Generates Lambda handlers compatible with AWS API Gateway v1 (REST API).
1435
+
1436
+ ```bash
1437
+ gkm build --provider aws-apigatewayv1
1360
1438
  ```
1361
1439
 
1362
- ## Build Targets
1440
+ **Generated Handler:**
1441
+ ```typescript
1442
+ import { AmazonApiGatewayV1Endpoint } from '@geekmidas/constructs/aws';
1443
+ import { myEndpoint } from '../src/routes/example.js';
1444
+ import { envParser } from '../src/env.js';
1445
+
1446
+ const adapter = new AmazonApiGatewayV1Endpoint(envParser, myEndpoint);
1447
+
1448
+ export const handler = adapter.handler;
1449
+ ```
1363
1450
 
1364
- ### AWS
1451
+ ### AWS API Gateway v2
1365
1452
 
1366
- Generates one Lambda handler per construct. Endpoints get an API Gateway v2
1367
- (HTTP API) adapter.
1453
+ Generates Lambda handlers compatible with AWS API Gateway v2 (HTTP API).
1368
1454
 
1369
1455
  ```bash
1370
- gkm build # with deploy: { default: 'sst' }
1371
- gkm build --provider aws # whatever the deploy target
1456
+ gkm build --provider aws-apigatewayv2
1372
1457
  ```
1373
1458
 
1374
1459
  **Generated Handler:**
1375
1460
  ```typescript
1376
1461
  import { AmazonApiGatewayV2Endpoint } from '@geekmidas/constructs/aws';
1377
- import { myEndpoint } from '../../../src/routes/example.js';
1462
+ import { myEndpoint } from '../src/routes/example.js';
1463
+ import { envParser } from '../src/env.js';
1378
1464
 
1379
- const adapter = new AmazonApiGatewayV2Endpoint(myEndpoint);
1465
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, myEndpoint);
1380
1466
 
1381
1467
  export const handler = adapter.handler;
1382
1468
  ```
@@ -1418,141 +1504,139 @@ export default createApp;
1418
1504
 
1419
1505
  ## Output Structure
1420
1506
 
1421
- Handlers are generated beside the app, in `<app>/.gkm/<target>`; the manifest
1422
- at the workspace root, where `sst.config.ts` runs:
1507
+ The CLI generates files in the `.gkm/<provider>` directory:
1423
1508
 
1424
1509
  ```
1425
- <root>/
1426
- ├── .gkm/manifest/
1427
- │ ├── aws.ts # AWS manifest with types
1428
- │ └── server.ts # Server manifest with types
1429
- └── apps/api/.gkm/
1430
- ├── aws/
1431
- │ ├── routes/getUsers.ts # One Lambda handler per endpoint
1432
- │ ├── functions/
1433
- │ ├── crons/
1434
- │ ├── queues/
1435
- │ └── subscribers/
1436
- └── server/
1437
- ├── app.ts # Server application
1438
- └── endpoints.ts # Endpoint exports
1510
+ .gkm/
1511
+ ├── aws-apigatewayv1/
1512
+ │ ├── getUsers.ts # Individual Lambda handler
1513
+ │ ├── createUser.ts # Individual Lambda handler
1514
+ ├── server/
1515
+ │ ├── app.ts # Server application
1516
+ │ ├── endpoints.ts # Endpoint exports
1517
+ ├── manifest/
1518
+ │ ├── aws.ts # AWS manifest with types
1519
+ │ └── server.ts # Server manifest with types
1520
+ └── openapi.json # OpenAPI specification
1439
1521
  ```
1440
1522
 
1441
1523
  ### Build Manifest
1442
1524
 
1443
- The manifest is the application's, not an app's: the root `gkm build` builds
1444
- every backend and writes it once, to `.gkm/manifest/aws.ts` or
1445
- `.gkm/manifest/server.ts` at the workspace root. An app's own build writes no
1446
- manifest. Every handler path in it is relative to the workspace root. `gkm init`
1447
- adds a root tsconfig alias for the manifest, `@<project>/manifest`.
1525
+ The CLI generates TypeScript manifests with full type information in the `.gkm/manifest/` directory. These manifests export both the data and derived types for type-safe usage.
1448
1526
 
1449
- It exports two values — every declared construct keyed by id, and the backends
1450
- the build resolved — and the types derived from them:
1527
+ #### AWS Manifest (`.gkm/manifest/aws.ts`)
1451
1528
 
1452
1529
  ```typescript
1453
- export const constructs = {
1454
- Database: { id: 'Database', kind: 'database' },
1455
- Api: {
1456
- id: 'Api',
1457
- kind: 'rest-api',
1458
- path: 'apps/api',
1459
- endpoints: [
1460
- {
1461
- id: 'ApiGET/users',
1462
- method: 'GET',
1463
- path: '/users',
1464
- handler: 'apps/api/.gkm/aws/routes/getUsers.handler',
1465
- dependencies: [{ target: 'Database', kind: 'database' }],
1466
- authorizer: 'iam',
1467
- },
1468
- ],
1469
- },
1470
- ProcessData: {
1471
- id: 'ProcessData',
1472
- kind: 'function',
1473
- handler: 'apps/api/.gkm/aws/functions/processData.handler',
1474
- dependencies: [],
1475
- },
1476
- DailyCleanup: {
1477
- id: 'DailyCleanup',
1478
- kind: 'cron',
1479
- handler: 'apps/api/.gkm/aws/crons/dailyCleanup.handler',
1480
- schedule: 'rate(1 day)',
1481
- dependencies: [{ target: 'Database', kind: 'database' }],
1482
- },
1483
- Emails: {
1484
- id: 'Emails',
1485
- kind: 'queue',
1486
- // The queue's consumer is nested in it
1487
- worker: {
1488
- id: 'emails',
1489
- handler: 'apps/api/.gkm/aws/queues/emails.handler',
1490
- dependencies: [],
1530
+ export const manifest = {
1531
+ routes: [
1532
+ {
1533
+ path: '/users',
1534
+ method: 'GET',
1535
+ handler: '.gkm/aws-apigatewayv1/getUsers.handler',
1536
+ authorizer: 'jwt',
1491
1537
  },
1492
- },
1493
- Users: {
1494
- id: 'Users',
1495
- kind: 'topic',
1496
- events: ['user.created'],
1497
- // As are a topic's subscribers
1498
- subscribers: [
1499
- {
1500
- id: 'onUser',
1501
- handler: 'apps/api/.gkm/aws/subscribers/onUser.handler',
1502
- events: ['user.created'],
1503
- dependencies: [],
1504
- },
1505
- ],
1506
- },
1507
- } as const satisfies ConstructManifest;
1508
-
1509
- export const backends = { cache: 'upstash', email: 'ses' } as const;
1538
+ {
1539
+ path: '/users',
1540
+ method: 'POST',
1541
+ handler: '.gkm/aws-apigatewayv1/createUser.handler',
1542
+ authorizer: 'jwt',
1543
+ },
1544
+ ],
1545
+ functions: [
1546
+ {
1547
+ name: 'processData',
1548
+ handler: '.gkm/aws-lambda/functions/processData.handler',
1549
+ timeout: 60,
1550
+ memorySize: 256,
1551
+ },
1552
+ ],
1553
+ crons: [
1554
+ {
1555
+ name: 'dailyCleanup',
1556
+ handler: '.gkm/aws-lambda/crons/dailyCleanup.handler',
1557
+ schedule: 'rate(1 day)',
1558
+ timeout: 300,
1559
+ memorySize: 512,
1560
+ },
1561
+ ],
1562
+ subscribers: [],
1563
+ } as const;
1510
1564
 
1511
1565
  // Derived types
1512
- export type Ids = IdsOf<typeof constructs>;
1513
- export type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;
1514
- export type Kind = Construct<Ids>['kind'];
1566
+ export type Route = (typeof manifest.routes)[number];
1567
+ export type Function = (typeof manifest.functions)[number];
1568
+ export type Cron = (typeof manifest.crons)[number];
1569
+ export type Subscriber = (typeof manifest.subscribers)[number];
1515
1570
 
1516
1571
  // Useful union types
1517
- export type ProvidedKeys = AllProvidedKeys<typeof constructs>;
1518
- export type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;
1519
- export type CacheBackend = (typeof backends)['cache'];
1520
- export type EmailBackend = (typeof backends)['email'];
1572
+ export type Authorizer = Route['authorizer'];
1573
+ export type HttpMethod = Route['method'];
1574
+ export type RoutePath = Route['path'];
1521
1575
  ```
1522
1576
 
1523
- A `RestApi` carries its endpoints, each with its method, path, handler, the
1524
- dependencies it declared and its authorizer. On AWS the handler is the
1525
- endpoint's own Lambda (`apps/api/.gkm/aws/routes/<export>.handler`); in the
1526
- server manifest every endpoint's handler is the app entry
1527
- (`apps/api/.gkm/server/app.ts`). Functions and crons are top-level
1528
- declarations; a queue's worker and a topic's subscribers are nested in the
1529
- queue or topic.
1577
+ When routes are partitioned, the manifest groups them by partition name and generates partition-aware types:
1530
1578
 
1531
- #### Using the Manifest
1579
+ ```typescript
1580
+ export const manifest = {
1581
+ routes: {
1582
+ "admin": [{ path: '/admin/users', method: 'GET', handler: '...', authorizer: 'jwt' }],
1583
+ "default": [{ path: '/users', method: 'GET', handler: '...', authorizer: 'jwt' }],
1584
+ },
1585
+ functions: [...], // flat if not partitioned
1586
+ } as const;
1587
+
1588
+ // Partition-aware derived types
1589
+ export type RoutePartition = keyof typeof manifest.routes;
1590
+ export type Route<P extends RoutePartition = RoutePartition> =
1591
+ (typeof manifest.routes)[P][number];
1592
+ ```
1532
1593
 
1533
- On AWS, `fromManifest` from `@geekmidas/cloud/sst` provisions all of it —
1534
- resources, each API's endpoints, queue consumers, functions and crons:
1594
+ #### Server Manifest (`.gkm/manifest/server.ts`)
1535
1595
 
1536
1596
  ```typescript
1537
- // sst.config.ts
1538
- const { App, fromManifest, Stack } = await import('@geekmidas/cloud/sst');
1539
- const { backends, constructs } = await import('./.gkm/manifest/aws.js');
1597
+ export const manifest = {
1598
+ app: {
1599
+ handler: '.gkm/server/app.ts',
1600
+ endpoints: '.gkm/server/endpoints.ts',
1601
+ },
1602
+ routes: [
1603
+ { path: '/users', method: 'GET', authorizer: 'jwt' },
1604
+ { path: '/users', method: 'POST', authorizer: 'jwt' },
1605
+ ],
1606
+ subscribers: [
1607
+ { name: 'orderHandler', subscribedEvents: ['order.created'] },
1608
+ ],
1609
+ } as const;
1540
1610
 
1541
- fromManifest(new Stack(app, 'Shop'), constructs, { Database: { vpc } }, backends);
1611
+ // Derived types
1612
+ export type Route = (typeof manifest.routes)[number];
1613
+ export type Subscriber = (typeof manifest.subscribers)[number];
1614
+
1615
+ // Useful union types
1616
+ export type Authorizer = Route['authorizer'];
1617
+ export type HttpMethod = Route['method'];
1618
+ export type RoutePath = Route['path'];
1542
1619
  ```
1543
1620
 
1544
- The types narrow to what was declared:
1621
+ #### Using Manifest Types
1622
+
1623
+ Import the manifest types for type-safe infrastructure configuration:
1545
1624
 
1546
1625
  ```typescript
1547
- import { constructs, type Construct, type Surfaces } from './.gkm/manifest/aws';
1626
+ import { manifest, type Route, type Authorizer } from './.gkm/manifest/aws';
1548
1627
 
1549
- const api: Construct<'Api'> = constructs.Api;
1628
+ // Type-safe route iteration
1629
+ for (const route of manifest.routes) {
1630
+ console.log(`${route.method} ${route.path} -> ${route.handler}`);
1631
+ }
1550
1632
 
1551
- for (const endpoint of api.endpoints) {
1552
- console.log(`${endpoint.method} ${endpoint.path} -> ${endpoint.handler}`);
1633
+ // Use union types for validation
1634
+ function isValidMethod(method: string): method is HttpMethod {
1635
+ return manifest.routes.some((r) => r.method === method);
1553
1636
  }
1554
1637
 
1555
- const surface: Surfaces = 'Api'; // any other id is a type error
1638
+ // Access authorizer names
1639
+ const authorizers = new Set(manifest.routes.map((r) => r.authorizer));
1556
1640
  ```
1557
1641
 
1558
1642
  ## OpenAPI Generation
@@ -1635,25 +1719,62 @@ gkm openapi --output api-docs.json --json
1635
1719
 
1636
1720
  ## Deployment Examples
1637
1721
 
1638
- Deploying goes through `gkm deploy` and a target, rather than through a
1639
- hand-written server file or framework config:
1722
+ ### AWS Lambda with Serverless Framework
1640
1723
 
1641
- ```bash
1642
- # Dokploy (the default target)
1643
- gkm deploy --stage production
1724
+ ```yaml
1725
+ # serverless.yml
1726
+ service: my-api
1727
+
1728
+ provider:
1729
+ name: aws
1730
+ runtime: nodejs18.x
1731
+
1732
+ functions:
1733
+ getUsers:
1734
+ handler: .gkm/aws-apigatewayv1/getUsers.handler
1735
+ events:
1736
+ - http:
1737
+ path: users
1738
+ method: get
1739
+
1740
+ createUser:
1741
+ handler: .gkm/aws-apigatewayv1/createUser.handler
1742
+ events:
1743
+ - http:
1744
+ path: users
1745
+ method: post
1746
+ ```
1747
+
1748
+ ### Server Deployment
1644
1749
 
1645
- # One Docker Compose stack behind Caddy, on this machine
1646
- gkm compose --stage production --tag v1.4.0
1750
+ ```typescript
1751
+ // server.ts
1752
+ import { createApp } from './.gkm/server/app.js';
1647
1753
 
1648
- # AWS through SST, with deploy: { default: 'sst' }
1649
- gkm deploy --stage production
1754
+ const app = createApp();
1650
1755
 
1651
- # Only the Docker files, to build and run images yourself
1652
- gkm docker --build --tag v1.4.0
1756
+ const port = process.env.PORT || 3000;
1757
+ app.listen(port, () => {
1758
+ console.log(`Server running on port ${port}`);
1759
+ });
1653
1760
  ```
1654
1761
 
1655
- See [Deploy targets](https://geekmidas.github.io/toolbox/next/guide/deploy-targets) and the
1656
- [deployment guide](https://geekmidas.github.io/toolbox/next/guide/deployment).
1762
+ ### Docker Deployment
1763
+
1764
+ ```dockerfile
1765
+ FROM node:18-alpine
1766
+
1767
+ WORKDIR /app
1768
+ COPY package*.json ./
1769
+ RUN npm ci --only=production
1770
+
1771
+ COPY . .
1772
+ RUN npm run build
1773
+
1774
+ EXPOSE 3000
1775
+
1776
+ CMD ["node", "server.js"]
1777
+ ```
1657
1778
 
1658
1779
  ## Advanced Usage
1659
1780
 
@@ -1718,7 +1839,7 @@ export const envParser = new EnvironmentParser(process.env)
1718
1839
 
1719
1840
  ```typescript
1720
1841
  // src/routes/protected.ts
1721
- import { api } from '../constructs/api';
1842
+ import { e } from '@geekmidas/constructs/endpoints';
1722
1843
  import { JwtMiddleware } from '@geekmidas/auth/hono/jwt';
1723
1844
  import { envParser } from '../env.js';
1724
1845
 
@@ -1818,7 +1939,6 @@ Configure multiple patterns for complex project structures:
1818
1939
  import { defineConfig } from '@geekmidas/cli/config';
1819
1940
 
1820
1941
  export default defineConfig({
1821
- stages: { local: 'dev', deployed: ['prod'] },
1822
1942
  routes: [
1823
1943
  'src/routes/**/*.ts',
1824
1944
  'src/api/v1/**/*.ts',
@@ -1850,8 +1970,8 @@ Error: Failed to load gkm.config.ts: Invalid configuration
1850
1970
  # No endpoints found
1851
1971
  No endpoints found to process
1852
1972
 
1853
- # Unknown deploy target
1854
- Unknown deploy target "fly". Use one of dokploy, compose, sst, or name the package that provides it in gkm.config.ts: deploy: { targets: { "fly": '<package>' } }.
1973
+ # Invalid provider
1974
+ Error: Unsupported provider: invalid-provider
1855
1975
  ```
1856
1976
 
1857
1977
  ### OpenAPI Errors
@@ -1871,22 +1991,44 @@ Error: OpenAPI generation failed: Invalid endpoint schema
1871
1991
  "dev": "gkm dev",
1872
1992
  "dev:port": "gkm dev --port 8080",
1873
1993
  "build": "gkm build",
1874
- "build:lambda": "gkm build --provider aws",
1994
+ "build:lambda": "gkm build --provider aws-apigatewayv1",
1875
1995
  "build:server": "gkm build --provider server",
1876
- "client": "gkm openapi"
1996
+ "docs": "gkm openapi --output src/api.ts"
1877
1997
  }
1878
1998
  }
1879
1999
  ```
1880
2000
 
1881
2001
  ### CI/CD Pipeline
1882
2002
 
1883
- `gkm init` writes a GitHub Actions deploy workflow that runs
1884
- `gkm deploy --stage "$STAGE"` for each stage. Its credentials come from the
1885
- stage's GitHub environment: `AWS_ROLE_ARN` for SST (set by
1886
- `gkm deploy:github --stage <stage>`), or `DOKPLOY_API_TOKEN` and
1887
- `DOKPLOY_ENDPOINT` for Dokploy. In any CI job, `gkm deploy --json` writes the
1888
- deploy's events as JSON lines and never prompts. See
1889
- [Deploying from GitHub Actions](https://geekmidas.github.io/toolbox/next/guide/deployment#deploying-from-github-actions).
2003
+ ```yaml
2004
+ # .github/workflows/deploy.yml
2005
+ name: Deploy API
2006
+
2007
+ on:
2008
+ push:
2009
+ branches: [main]
2010
+
2011
+ jobs:
2012
+ deploy:
2013
+ runs-on: ubuntu-latest
2014
+
2015
+ steps:
2016
+ - uses: actions/checkout@v3
2017
+
2018
+ - name: Setup Node.js
2019
+ uses: actions/setup-node@v3
2020
+ with:
2021
+ node-version: '18'
2022
+
2023
+ - name: Install dependencies
2024
+ run: npm ci
2025
+
2026
+ - name: Build handlers
2027
+ run: npm run build:lambda
2028
+
2029
+ - name: Deploy to AWS
2030
+ run: npx serverless deploy
2031
+ ```
1890
2032
 
1891
2033
  ## Troubleshooting
1892
2034
 
@@ -1943,8 +2085,8 @@ DEBUG=gkm:* npx gkm build
1943
2085
  ### Types
1944
2086
 
1945
2087
  ```typescript
1946
- // Build targets
1947
- type Provider = 'aws' | 'server';
2088
+ // Provider options
2089
+ type Provider = 'server' | 'aws-apigatewayv1' | 'aws-apigatewayv2';
1948
2090
 
1949
2091
  // Runtime options
1950
2092
  type Runtime = 'node' | 'bun';
@@ -1968,8 +2110,17 @@ interface DockerConfig {
1968
2110
  imageName?: string; // Image name (defaults to package.json name)
1969
2111
  baseImage?: string; // Base image (default: node:22-alpine)
1970
2112
  port?: number; // Port to expose (default: 3000)
2113
+ compose?: {
2114
+ services?: ComposeServicesConfig | ComposeServiceName[];
2115
+ };
1971
2116
  }
1972
2117
 
2118
+ // Service configuration for docker-compose
2119
+ type ComposeServiceName = 'postgres' | 'redis' | 'rabbitmq';
2120
+ type ComposeServicesConfig = {
2121
+ [K in ComposeServiceName]?: boolean | { version?: string };
2122
+ };
2123
+
1973
2124
  // Telescope configuration
1974
2125
  interface TelescopeConfig {
1975
2126
  enabled?: boolean;
@@ -1982,7 +2133,7 @@ interface TelescopeConfig {
1982
2133
 
1983
2134
  // Build options
1984
2135
  interface BuildOptions {
1985
- provider?: Provider; // default: where gkm.config.ts deploys
2136
+ provider: Provider;
1986
2137
  }
1987
2138
 
1988
2139
  // Dev options