@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.
- package/CHANGELOG.md +667 -0
- package/FUNCTION_CRON_SUPPORT.md +266 -0
- package/README.md +533 -382
- package/bin/gkm.mjs +2 -16
- package/dist/CachedStateProvider-BdX7klRc.cjs +3 -0
- package/dist/CachedStateProvider-CzyFct42.mjs +54 -0
- package/dist/CachedStateProvider-CzyFct42.mjs.map +1 -0
- package/dist/CachedStateProvider-GcGziXh1.mjs +3 -0
- package/dist/CachedStateProvider-klLWZXWF.cjs +60 -0
- package/dist/CachedStateProvider-klLWZXWF.cjs.map +1 -0
- package/dist/{HostingerProvider-BNpS9aRJ.mjs → HostingerProvider-B2ZYz7Yc.mjs} +26 -31
- package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +1 -0
- package/dist/{HostingerProvider-DR1iws1P.cjs → HostingerProvider-CrHfsgz9.cjs} +26 -31
- package/dist/HostingerProvider-CrHfsgz9.cjs.map +1 -0
- package/dist/LocalStateProvider-CP49rjzt.mjs +42 -0
- package/dist/LocalStateProvider-CP49rjzt.mjs.map +1 -0
- package/dist/LocalStateProvider-CalzNfNA.cjs +43 -0
- package/dist/LocalStateProvider-CalzNfNA.cjs.map +1 -0
- package/dist/{Route53Provider-Bllus2NR.cjs → Route53Provider-DwgXiLxt.cjs} +22 -21
- package/dist/Route53Provider-DwgXiLxt.cjs.map +1 -0
- package/dist/{Route53Provider-QXxjkZO1.mjs → Route53Provider-tlgBzrRQ.mjs} +13 -13
- package/dist/Route53Provider-tlgBzrRQ.mjs.map +1 -0
- package/dist/SSMStateProvider-BlrTiV5m.mjs +66 -0
- package/dist/SSMStateProvider-BlrTiV5m.mjs.map +1 -0
- package/dist/SSMStateProvider-Bt6r8CTL.cjs +66 -0
- package/dist/SSMStateProvider-Bt6r8CTL.cjs.map +1 -0
- package/dist/{backup-provisioner-oDEsPj02.cjs → backup-provisioner-B3HBN-2k.cjs} +20 -22
- package/dist/backup-provisioner-B3HBN-2k.cjs.map +1 -0
- package/dist/{backup-provisioner-C8DnCmxK.mjs → backup-provisioner-Xunq-p_8.mjs} +9 -12
- package/dist/backup-provisioner-Xunq-p_8.mjs.map +1 -0
- package/dist/bundler-DkA4qzUD.mjs +135 -0
- package/dist/bundler-DkA4qzUD.mjs.map +1 -0
- package/dist/bundler-Dufq3uvI.cjs +136 -0
- package/dist/bundler-Dufq3uvI.cjs.map +1 -0
- package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
- package/dist/chunk-Duj1WY3L.mjs +7 -0
- package/dist/config-Bbu1JKvf.mjs +211 -0
- package/dist/config-Bbu1JKvf.mjs.map +1 -0
- package/dist/config-DujV8DbR.cjs +253 -0
- package/dist/config-DujV8DbR.cjs.map +1 -0
- package/dist/config.cjs +10 -421
- package/dist/config.d.cts +120 -4
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +120 -4
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +3 -405
- package/dist/credentials-C8DWtnMY.cjs +174 -0
- package/dist/credentials-C8DWtnMY.cjs.map +1 -0
- package/dist/credentials-s1kLcIzK.mjs +126 -0
- package/dist/credentials-s1kLcIzK.mjs.map +1 -0
- package/dist/deploy/sniffer-envkit-patch.cjs +10 -18
- package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.cts +2 -0
- package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.mts +2 -0
- package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.mjs +2 -10
- package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
- package/dist/deploy/sniffer-hooks.cjs +7 -13
- package/dist/deploy/sniffer-hooks.cjs.map +1 -1
- package/dist/deploy/sniffer-hooks.d.cts +2 -1
- package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
- package/dist/deploy/sniffer-hooks.d.mts +2 -1
- package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
- package/dist/deploy/sniffer-hooks.mjs +3 -10
- package/dist/deploy/sniffer-hooks.mjs.map +1 -1
- package/dist/deploy/sniffer-loader.cjs +7 -16
- package/dist/deploy/sniffer-loader.cjs.map +1 -1
- package/dist/deploy/sniffer-loader.d.cts +1 -1
- package/dist/deploy/sniffer-loader.d.mts +1 -1
- package/dist/deploy/sniffer-loader.mjs +3 -14
- package/dist/deploy/sniffer-loader.mjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +13 -17
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
- package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +6 -10
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/deploy/sniffer-worker.cjs +6 -15
- package/dist/deploy/sniffer-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-worker.d.cts +3 -1
- package/dist/deploy/sniffer-worker.d.cts.map +1 -1
- package/dist/deploy/sniffer-worker.d.mts +3 -1
- package/dist/deploy/sniffer-worker.d.mts.map +1 -1
- package/dist/deploy/sniffer-worker.mjs +4 -15
- package/dist/deploy/sniffer-worker.mjs.map +1 -1
- package/dist/dokploy-api-BPYkG-ZZ.cjs +3 -0
- package/dist/dokploy-api-BiSzWM4v.mjs +3 -0
- package/dist/dokploy-api-CqOIKHme.cjs +609 -0
- package/dist/dokploy-api-CqOIKHme.cjs.map +1 -0
- package/dist/dokploy-api-sfZFlWuE.mjs +597 -0
- package/dist/dokploy-api-sfZFlWuE.mjs.map +1 -0
- package/dist/encryption-BVS7Vmzs.cjs +4 -0
- package/dist/encryption-Bd_m4q3g.mjs +3 -0
- package/dist/encryption-CO5Q4Bhf.mjs +42 -0
- package/dist/encryption-CO5Q4Bhf.mjs.map +1 -0
- package/dist/encryption-MfXAiFTm.cjs +54 -0
- package/dist/encryption-MfXAiFTm.cjs.map +1 -0
- package/dist/fullstack-secrets-BYzi6Hwl.cjs +402 -0
- package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +1 -0
- package/dist/fullstack-secrets-l8s3II_H.mjs +336 -0
- package/dist/fullstack-secrets-l8s3II_H.mjs.map +1 -0
- package/dist/index-CoVW_fFS.d.cts +1737 -0
- package/dist/index-CoVW_fFS.d.cts.map +1 -0
- package/dist/index-oWibAYQY.d.mts +1737 -0
- package/dist/index-oWibAYQY.d.mts.map +1 -0
- package/dist/index.cjs +11324 -10240
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +11327 -10231
- package/dist/index.mjs.map +1 -1
- package/dist/openapi-BzNOC7_i.cjs +1931 -0
- package/dist/openapi-BzNOC7_i.cjs.map +1 -0
- package/dist/openapi-Cfwi0fqF.mjs +1883 -0
- package/dist/openapi-Cfwi0fqF.mjs.map +1 -0
- package/dist/openapi-react-query-C4iIvpPf.mjs +167 -0
- package/dist/openapi-react-query-C4iIvpPf.mjs.map +1 -0
- package/dist/openapi-react-query-CYWik72n.cjs +173 -0
- package/dist/openapi-react-query-CYWik72n.cjs.map +1 -0
- package/dist/openapi-react-query.cjs +4 -0
- package/dist/openapi-react-query.d.cts +11 -0
- package/dist/openapi-react-query.d.cts.map +1 -0
- package/dist/openapi-react-query.d.mts +11 -0
- package/dist/openapi-react-query.d.mts.map +1 -0
- package/dist/openapi-react-query.mjs +4 -0
- package/dist/openapi.cjs +7 -214
- package/dist/openapi.d.cts +15 -72
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +15 -72
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +4 -208
- package/dist/{reconcile--I7V4Klj.mjs → reconcile-B2FoJE0a.mjs} +8 -6
- package/dist/reconcile-B2FoJE0a.mjs.map +1 -0
- package/dist/{reconcile-CuCQBa5-.cjs → reconcile-BzqKJ2Rt.cjs} +8 -6
- package/dist/reconcile-BzqKJ2Rt.cjs.map +1 -0
- package/dist/setup-DDXUXzzl.mjs +765 -0
- package/dist/setup-DDXUXzzl.mjs.map +1 -0
- package/dist/setup-DLwhfyt-.cjs +8 -0
- package/dist/setup-Dh-B7YTX.mjs +8 -0
- package/dist/setup-WZ-xqAQO.cjs +849 -0
- package/dist/setup-WZ-xqAQO.cjs.map +1 -0
- package/dist/storage-B1wvztiJ.cjs +363 -0
- package/dist/storage-B1wvztiJ.cjs.map +1 -0
- package/dist/storage-Cs4WBsc4.mjs +3 -0
- package/dist/storage-DOEtT2Hr.cjs +7 -0
- package/dist/storage-dbb9RyBl.mjs +297 -0
- package/dist/storage-dbb9RyBl.mjs.map +1 -0
- package/dist/sync-B5UHXwRM.mjs +3 -0
- package/dist/sync-BLA94rgC.cjs +4 -0
- package/dist/sync-CSooqRQ8.mjs +76 -0
- package/dist/sync-CSooqRQ8.mjs.map +1 -0
- package/dist/sync-o_CtEbvR.cjs +93 -0
- package/dist/sync-o_CtEbvR.cjs.map +1 -0
- package/dist/types-B3GQUg3k.d.mts +280 -0
- package/dist/types-B3GQUg3k.d.mts.map +1 -0
- package/dist/types-BWQDiooe.d.cts +280 -0
- package/dist/types-BWQDiooe.d.cts.map +1 -0
- package/dist/workspace/index.cjs +4 -12
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +3 -2
- package/dist/workspace-CQTT7HJQ.cjs +4361 -0
- package/dist/workspace-CQTT7HJQ.cjs.map +1 -0
- package/dist/workspace-D-37Ylqo.mjs +4236 -0
- package/dist/workspace-D-37Ylqo.mjs.map +1 -0
- package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +408 -0
- package/docs/dev-server-resilience-design.md +189 -0
- package/docs/manifest-refactor-design.md +287 -0
- package/examples/cron-example.ts +45 -0
- package/examples/env.ts +33 -0
- package/examples/function-example.ts +40 -0
- package/examples/gkm.config.json +22 -0
- package/examples/gkm.config.ts +14 -0
- package/examples/gkm.minimal.config.json +7 -0
- package/examples/gkm.production.config.json +27 -0
- package/examples/logger.ts +10 -0
- package/package.json +37 -87
- package/scripts/sync-versions.ts +108 -0
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +204 -0
- package/src/__tests__/config.spec.ts +422 -0
- package/src/__tests__/loadEnvFiles.spec.ts +131 -0
- package/src/__tests__/normalizeHooksConfig.spec.ts +63 -0
- package/src/__tests__/openapi-react-query.spec.ts +506 -0
- package/src/__tests__/openapi.spec.ts +625 -0
- package/src/__tests__/test-helpers.ts +180 -0
- package/src/auth/__tests__/credentials.spec.ts +331 -0
- package/src/auth/__tests__/index.spec.ts +237 -0
- package/src/auth/credentials.ts +286 -0
- package/src/auth/index.ts +233 -0
- package/src/build/__tests__/bundler.spec.ts +446 -0
- package/src/build/__tests__/endpoint-analyzer.spec.ts +623 -0
- package/src/build/__tests__/handler-templates.spec.ts +1287 -0
- package/src/build/__tests__/index-new.spec.ts +550 -0
- package/src/build/__tests__/manifests.spec.ts +583 -0
- package/src/build/__tests__/partitions.spec.ts +110 -0
- package/src/build/__tests__/workspace-build.spec.ts +215 -0
- package/src/build/bundler.ts +256 -0
- package/src/build/endpoint-analyzer.ts +236 -0
- package/src/build/handler-templates.ts +1253 -0
- package/src/build/index.ts +616 -0
- package/src/build/manifests.ts +285 -0
- package/src/build/partitions.ts +58 -0
- package/src/build/providerResolver.ts +184 -0
- package/src/build/types.ts +104 -0
- package/src/config.ts +330 -0
- package/src/credentials/__tests__/fullDockerPorts.spec.ts +144 -0
- package/src/credentials/__tests__/helpers.ts +112 -0
- package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +125 -0
- package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +190 -0
- package/src/credentials/__tests__/workspaceCredentials.spec.ts +209 -0
- package/src/credentials/index.ts +843 -0
- package/src/debug.ts +68 -0
- package/src/deploy/CachedStateProvider.ts +86 -0
- package/src/deploy/LocalStateProvider.ts +57 -0
- package/src/deploy/SSMStateProvider.ts +117 -0
- package/src/deploy/StateProvider.ts +175 -0
- package/src/deploy/__tests__/CachedStateProvider.spec.ts +235 -0
- package/src/deploy/__tests__/HostingerProvider.spec.ts +347 -0
- package/src/deploy/__tests__/LocalStateProvider.spec.ts +130 -0
- package/src/deploy/__tests__/Route53Provider.spec.ts +425 -0
- package/src/deploy/__tests__/SSMStateProvider.spec.ts +201 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +24 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +24 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +12 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +14 -0
- package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +10 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +21 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +18 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +16 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +13 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +15 -0
- package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +55 -0
- package/src/deploy/__tests__/backup-provisioner.spec.ts +428 -0
- package/src/deploy/__tests__/createDnsProvider.spec.ts +195 -0
- package/src/deploy/__tests__/createStateProvider.spec.ts +126 -0
- package/src/deploy/__tests__/dns-orchestration.spec.ts +192 -0
- package/src/deploy/__tests__/dns-verification.spec.ts +229 -0
- package/src/deploy/__tests__/docker.spec.ts +149 -0
- package/src/deploy/__tests__/dokploy-api.spec.ts +697 -0
- package/src/deploy/__tests__/dokploy.spec.ts +435 -0
- package/src/deploy/__tests__/domain.spec.ts +235 -0
- package/src/deploy/__tests__/env-resolver.spec.ts +903 -0
- package/src/deploy/__tests__/index.spec.ts +1091 -0
- package/src/deploy/__tests__/init.spec.ts +793 -0
- package/src/deploy/__tests__/secrets.spec.ts +303 -0
- package/src/deploy/__tests__/sniffer.spec.ts +838 -0
- package/src/deploy/__tests__/state-e2e.spec.ts +387 -0
- package/src/deploy/__tests__/state.spec.ts +876 -0
- package/src/deploy/__tests__/undeploy.spec.ts +758 -0
- package/src/deploy/backup-provisioner.ts +316 -0
- package/src/deploy/dns/DnsProvider.ts +201 -0
- package/src/deploy/dns/HostingerProvider.ts +174 -0
- package/src/deploy/dns/Route53Provider.ts +340 -0
- package/src/deploy/dns/hostinger-api.ts +261 -0
- package/src/deploy/dns/index.ts +627 -0
- package/src/deploy/docker.ts +260 -0
- package/src/deploy/dokploy-api.ts +1101 -0
- package/src/deploy/dokploy.ts +177 -0
- package/src/deploy/domain.ts +134 -0
- package/src/deploy/env-resolver.ts +305 -0
- package/src/deploy/index.ts +2094 -0
- package/src/deploy/init.ts +427 -0
- package/src/deploy/secrets.ts +187 -0
- package/src/deploy/sniffer-envkit-patch.ts +61 -0
- package/src/deploy/sniffer-hooks.ts +57 -0
- package/src/deploy/sniffer-loader.ts +28 -0
- package/src/deploy/sniffer-routes-worker.ts +104 -0
- package/src/deploy/sniffer-worker.ts +75 -0
- package/src/deploy/sniffer.ts +578 -0
- package/src/deploy/state-commands.ts +274 -0
- package/src/deploy/state.ts +482 -0
- package/src/deploy/types.ts +102 -0
- package/src/deploy/undeploy.ts +407 -0
- package/src/dev/__tests__/entry-integration.spec.ts +347 -0
- package/src/dev/__tests__/entry.spec.ts +144 -0
- package/src/dev/__tests__/index.spec.ts +2084 -0
- package/src/dev/index.ts +1649 -0
- package/src/docker/__tests__/compose.spec.ts +1142 -0
- package/src/docker/__tests__/templates.spec.ts +694 -0
- package/src/docker/compose.ts +812 -0
- package/src/docker/index.ts +523 -0
- package/src/docker/templates.ts +1067 -0
- package/src/exec/index.ts +118 -0
- package/src/generators/CronGenerator.ts +105 -0
- package/src/generators/EndpointGenerator.ts +954 -0
- package/src/generators/FunctionGenerator.ts +117 -0
- package/src/generators/Generator.ts +147 -0
- package/src/generators/OpenApiTsGenerator.ts +821 -0
- package/src/generators/QueueGenerator.ts +245 -0
- package/src/generators/SubscriberGenerator.ts +282 -0
- package/src/generators/TopicGenerator.ts +45 -0
- package/src/generators/__tests__/CronGenerator.spec.ts +445 -0
- package/src/generators/__tests__/EndpointGenerator.spec.ts +544 -0
- package/src/generators/__tests__/FunctionGenerator.spec.ts +256 -0
- package/src/generators/__tests__/Generator.bustCache.spec.ts +72 -0
- package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +98 -0
- package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +56 -0
- package/src/generators/__tests__/QueueGenerator.spec.ts +141 -0
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +410 -0
- package/src/generators/index.ts +11 -0
- package/src/index.ts +972 -0
- package/src/init/__tests__/generators.spec.ts +1072 -0
- package/src/init/__tests__/init.spec.ts +577 -0
- package/src/init/__tests__/utils.spec.ts +104 -0
- package/src/init/generators/auth.ts +225 -0
- package/src/init/generators/config.ts +316 -0
- package/src/init/generators/docker.ts +388 -0
- package/src/init/generators/env.ts +62 -0
- package/src/init/generators/index.ts +6 -0
- package/src/init/generators/mobile-expo.ts +576 -0
- package/src/init/generators/models.ts +153 -0
- package/src/init/generators/monorepo.ts +475 -0
- package/src/init/generators/package.ts +95 -0
- package/src/init/generators/source.ts +15 -0
- package/src/init/generators/test.ts +178 -0
- package/src/init/generators/ui.ts +1473 -0
- package/src/init/generators/web-tanstack.ts +348 -0
- package/src/init/generators/web.ts +363 -0
- package/src/init/index.ts +542 -0
- package/src/init/templates/api.ts +404 -0
- package/src/init/templates/index.ts +342 -0
- package/src/init/templates/minimal.ts +207 -0
- package/src/init/templates/serverless.ts +148 -0
- package/src/init/templates/worker.ts +216 -0
- package/src/init/utils.ts +197 -0
- package/src/init/versions.ts +52 -0
- package/src/openapi-react-query.ts +288 -0
- package/src/openapi.ts +259 -0
- package/src/secrets/__tests__/encryption.spec.ts +226 -0
- package/src/secrets/__tests__/generator.spec.ts +575 -0
- package/src/secrets/__tests__/index.spec.ts +91 -0
- package/src/secrets/__tests__/reconcile.spec.ts +123 -0
- package/src/secrets/__tests__/storage.spec.ts +645 -0
- package/src/secrets/encryption.ts +91 -0
- package/src/secrets/generator.ts +329 -0
- package/src/secrets/index.ts +417 -0
- package/src/secrets/keystore.ts +144 -0
- package/src/secrets/reconcile.ts +53 -0
- package/src/secrets/storage.ts +337 -0
- package/src/secrets/sync.ts +136 -0
- package/src/secrets/types.ts +70 -0
- package/src/setup/__tests__/auto-setup.spec.ts +147 -0
- package/src/setup/__tests__/reconcile-secrets.spec.ts +439 -0
- package/src/setup/fullstack-secrets.ts +140 -0
- package/src/setup/index.ts +411 -0
- package/src/test/__tests__/__fixtures__/workspace.ts +104 -0
- package/src/test/__tests__/api.spec.ts +199 -0
- package/src/test/__tests__/auth.spec.ts +162 -0
- package/src/test/__tests__/index.spec.ts +502 -0
- package/src/test/__tests__/web.spec.ts +210 -0
- package/src/test/index.ts +198 -0
- package/src/types.ts +363 -0
- package/src/upgrade/__tests__/index.spec.ts +354 -0
- package/src/upgrade/index.ts +253 -0
- package/src/workspace/__tests__/client-generator.spec.ts +326 -0
- package/src/workspace/__tests__/index.spec.ts +766 -0
- package/src/workspace/__tests__/publicEnv.spec.ts +64 -0
- package/src/workspace/__tests__/schema.spec.ts +737 -0
- package/src/workspace/__tests__/type-inference.spec.ts +251 -0
- package/src/workspace/client-generator.ts +109 -0
- package/src/workspace/index.ts +433 -0
- package/src/workspace/publicEnv.ts +57 -0
- package/src/workspace/schema.ts +861 -0
- package/src/workspace/types.ts +943 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +22 -0
- package/bin/adjacent-tsconfig.mjs +0 -97
- package/bin/owning-tsconfig-jsx-register.mjs +0 -18
- package/bin/owning-tsconfig-jsx.mjs +0 -108
- package/dist/EndpointGenerator-Bor2tZCm.mjs +0 -1031
- package/dist/EndpointGenerator-Bor2tZCm.mjs.map +0 -1
- package/dist/EndpointGenerator-De03t1hd.cjs +0 -1090
- package/dist/EndpointGenerator-De03t1hd.cjs.map +0 -1
- package/dist/GoDaddyProvider-206NguW1.mjs +0 -388
- package/dist/GoDaddyProvider-206NguW1.mjs.map +0 -1
- package/dist/GoDaddyProvider-D1aQy2i1.cjs +0 -388
- package/dist/GoDaddyProvider-D1aQy2i1.cjs.map +0 -1
- package/dist/HostingerProvider-BNpS9aRJ.mjs.map +0 -1
- package/dist/HostingerProvider-DR1iws1P.cjs.map +0 -1
- package/dist/LegacyStateStore-CgJEr1G7.cjs +0 -124
- package/dist/LegacyStateStore-CgJEr1G7.cjs.map +0 -1
- package/dist/LegacyStateStore-wmFfdzuh.mjs +0 -124
- package/dist/LegacyStateStore-wmFfdzuh.mjs.map +0 -1
- package/dist/LocalStateStore-BD14kra9.cjs +0 -178
- package/dist/LocalStateStore-BD14kra9.cjs.map +0 -1
- package/dist/LocalStateStore-C5mNp91D.mjs +0 -167
- package/dist/LocalStateStore-C5mNp91D.mjs.map +0 -1
- package/dist/OpenApiTsGenerator-CS_RtWOz.cjs +0 -541
- package/dist/OpenApiTsGenerator-CS_RtWOz.cjs.map +0 -1
- package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs +0 -536
- package/dist/OpenApiTsGenerator-DWAF-7Fu.mjs.map +0 -1
- package/dist/Route53Provider-Bllus2NR.cjs.map +0 -1
- package/dist/Route53Provider-QXxjkZO1.mjs.map +0 -1
- package/dist/S3StateStore-CEGbsDHi.mjs +0 -223
- package/dist/S3StateStore-CEGbsDHi.mjs.map +0 -1
- package/dist/S3StateStore-Csu_kJCy.cjs +0 -222
- package/dist/S3StateStore-Csu_kJCy.cjs.map +0 -1
- package/dist/SSMStateStore-Bd62qwp4.mjs +0 -205
- package/dist/SSMStateStore-Bd62qwp4.mjs.map +0 -1
- package/dist/SSMStateStore-Rp21jtP5.cjs +0 -204
- package/dist/SSMStateStore-Rp21jtP5.cjs.map +0 -1
- package/dist/SubscriberGenerator-CyN2VF5X.mjs +0 -449
- package/dist/SubscriberGenerator-CyN2VF5X.mjs.map +0 -1
- package/dist/SubscriberGenerator-Dvz7EzqK.cjs +0 -490
- package/dist/SubscriberGenerator-Dvz7EzqK.cjs.map +0 -1
- package/dist/add-DyIEYI97.mjs +0 -718
- package/dist/add-DyIEYI97.mjs.map +0 -1
- package/dist/add-Iuo3ao5E.cjs +0 -720
- package/dist/add-Iuo3ao5E.cjs.map +0 -1
- package/dist/appPorts-C9z9Pzn9.mjs +0 -223
- package/dist/appPorts-C9z9Pzn9.mjs.map +0 -1
- package/dist/appPorts-Cu79hJF6.cjs +0 -264
- package/dist/appPorts-Cu79hJF6.cjs.map +0 -1
- package/dist/aws-8QQ8n-t6.mjs +0 -89
- package/dist/aws-8QQ8n-t6.mjs.map +0 -1
- package/dist/aws-DY9NqQIT.cjs +0 -100
- package/dist/aws-DY9NqQIT.cjs.map +0 -1
- package/dist/awsStore-Bx5nCFnS.mjs +0 -121
- package/dist/awsStore-Bx5nCFnS.mjs.map +0 -1
- package/dist/awsStore-u3ehhMoY.cjs +0 -138
- package/dist/awsStore-u3ehhMoY.cjs.map +0 -1
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +0 -1
- package/dist/backup-provisioner-oDEsPj02.cjs.map +0 -1
- package/dist/bundler-Bgoq8IyR.cjs +0 -169
- package/dist/bundler-Bgoq8IyR.cjs.map +0 -1
- package/dist/bundler-Q6Kp8b0r.mjs +0 -169
- package/dist/bundler-Q6Kp8b0r.mjs.map +0 -1
- package/dist/cli-B9BudUV0.mjs +0 -71
- package/dist/cli-B9BudUV0.mjs.map +0 -1
- package/dist/cli-W2DMRIbP.cjs +0 -71
- package/dist/cli-W2DMRIbP.cjs.map +0 -1
- package/dist/compose-CIrFNWHb.cjs +0 -3147
- package/dist/compose-CIrFNWHb.cjs.map +0 -1
- package/dist/compose-CLsRcHkA.mjs +0 -3052
- package/dist/compose-CLsRcHkA.mjs.map +0 -1
- package/dist/config-BVdHfj8b.d.cts +0 -269
- package/dist/config-BVdHfj8b.d.cts.map +0 -1
- package/dist/config-D2OqCmAM.d.mts +0 -269
- package/dist/config-D2OqCmAM.d.mts.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/credentialSchemas-BJFvfkaz.mjs +0 -237
- package/dist/credentialSchemas-BJFvfkaz.mjs.map +0 -1
- package/dist/credentialSchemas-CAPKFkrG.cjs +0 -272
- package/dist/credentialSchemas-CAPKFkrG.cjs.map +0 -1
- package/dist/credentials-B5N5yKk6.mjs +0 -267
- package/dist/credentials-B5N5yKk6.mjs.map +0 -1
- package/dist/credentials-Zqr3QQYB.cjs +0 -350
- package/dist/credentials-Zqr3QQYB.cjs.map +0 -1
- package/dist/databases-BeGP5eDh.mjs +0 -495
- package/dist/databases-BeGP5eDh.mjs.map +0 -1
- package/dist/databases-DGALFDG3.cjs +0 -598
- package/dist/databases-DGALFDG3.cjs.map +0 -1
- package/dist/define-6poNqm5O.mjs +0 -106
- package/dist/define-6poNqm5O.mjs.map +0 -1
- package/dist/define-crmMcXFS.cjs +0 -153
- package/dist/define-crmMcXFS.cjs.map +0 -1
- package/dist/deploy/public.cjs +0 -212
- package/dist/deploy/public.cjs.map +0 -1
- package/dist/deploy/public.d.cts +0 -653
- package/dist/deploy/public.d.cts.map +0 -1
- package/dist/deploy/public.d.mts +0 -653
- package/dist/deploy/public.d.mts.map +0 -1
- package/dist/deploy/public.mjs +0 -145
- package/dist/deploy/public.mjs.map +0 -1
- package/dist/deploy/sniffer-envparser-worker.cjs +0 -54
- package/dist/deploy/sniffer-envparser-worker.cjs.map +0 -1
- package/dist/deploy/sniffer-envparser-worker.d.cts +0 -1
- package/dist/deploy/sniffer-envparser-worker.d.mts +0 -1
- package/dist/deploy/sniffer-envparser-worker.mjs +0 -55
- package/dist/deploy/sniffer-envparser-worker.mjs.map +0 -1
- package/dist/deploy-CbJMJsgX.cjs +0 -2032
- package/dist/deploy-CbJMJsgX.cjs.map +0 -1
- package/dist/deploy-n_IB8r6H.mjs +0 -1977
- package/dist/deploy-n_IB8r6H.mjs.map +0 -1
- package/dist/derive-B4vDpzgP.mjs +0 -150
- package/dist/derive-B4vDpzgP.mjs.map +0 -1
- package/dist/derive-DAbo49sm.cjs +0 -161
- package/dist/derive-DAbo49sm.cjs.map +0 -1
- package/dist/discover-Caf6Hnv1.d.cts +0 -108
- package/dist/discover-Caf6Hnv1.d.cts.map +0 -1
- package/dist/discover-Cd5M2jPv.d.mts +0 -108
- package/dist/discover-Cd5M2jPv.d.mts.map +0 -1
- package/dist/discover-DPgu-ScS.cjs +0 -600
- package/dist/discover-DPgu-ScS.cjs.map +0 -1
- package/dist/discover-qjFapetL.mjs +0 -527
- package/dist/discover-qjFapetL.mjs.map +0 -1
- package/dist/dns-C_LPS3qV.mjs +0 -610
- package/dist/dns-C_LPS3qV.mjs.map +0 -1
- package/dist/dns-kp8To8Qj.cjs +0 -663
- package/dist/dns-kp8To8Qj.cjs.map +0 -1
- package/dist/dokploy-Dl_kNVeE.mjs +0 -38
- package/dist/dokploy-Dl_kNVeE.mjs.map +0 -1
- package/dist/dokploy-gRIae9Ht.cjs +0 -38
- package/dist/dokploy-gRIae9Ht.cjs.map +0 -1
- package/dist/drivers-CTaWrA_L.mjs +0 -177
- package/dist/drivers-CTaWrA_L.mjs.map +0 -1
- package/dist/drivers-DDojgzz0.cjs +0 -200
- package/dist/drivers-DDojgzz0.cjs.map +0 -1
- package/dist/emit-C1e8qD08.mjs +0 -193
- package/dist/emit-C1e8qD08.mjs.map +0 -1
- package/dist/emit-Dmc1nvdS.cjs +0 -210
- package/dist/emit-Dmc1nvdS.cjs.map +0 -1
- package/dist/encryption-C3DcVZQs.mjs +0 -89
- package/dist/encryption-C3DcVZQs.mjs.map +0 -1
- package/dist/encryption-CmQvQOSe.cjs +0 -90
- package/dist/encryption-CmQvQOSe.cjs.map +0 -1
- package/dist/engine-DBXuhHyf.mjs +0 -3081
- package/dist/engine-DBXuhHyf.mjs.map +0 -1
- package/dist/engine-Dk19Mxc4.cjs +0 -3194
- package/dist/engine-Dk19Mxc4.cjs.map +0 -1
- package/dist/errors-D8Gwp5kU.mjs +0 -23
- package/dist/errors-D8Gwp5kU.mjs.map +0 -1
- package/dist/errors-DMC4Umsb.cjs +0 -34
- package/dist/errors-DMC4Umsb.cjs.map +0 -1
- package/dist/github-Ds2RYnSU.cjs +0 -819
- package/dist/github-Ds2RYnSU.cjs.map +0 -1
- package/dist/github-RawRLERq.mjs +0 -819
- package/dist/github-RawRLERq.mjs.map +0 -1
- package/dist/identity-CBXr4wNi.mjs +0 -129
- package/dist/identity-CBXr4wNi.mjs.map +0 -1
- package/dist/identity-CbLfgQNT.cjs +0 -182
- package/dist/identity-CbLfgQNT.cjs.map +0 -1
- package/dist/index-BU4G20G6.d.cts +0 -190
- package/dist/index-BU4G20G6.d.cts.map +0 -1
- package/dist/index-yDbd1WcM.d.mts +0 -190
- package/dist/index-yDbd1WcM.d.mts.map +0 -1
- package/dist/local-BwC2v2Y8.mjs +0 -224
- package/dist/local-BwC2v2Y8.mjs.map +0 -1
- package/dist/local-DNhnkugT.cjs +0 -241
- package/dist/local-DNhnkugT.cjs.map +0 -1
- package/dist/migrate-CZIGT3kB.mjs +0 -266
- package/dist/migrate-CZIGT3kB.mjs.map +0 -1
- package/dist/migrate-CxZYzF_u.cjs +0 -181
- package/dist/migrate-CxZYzF_u.cjs.map +0 -1
- package/dist/migrate-DR1x96I4.mjs +0 -181
- package/dist/migrate-DR1x96I4.mjs.map +0 -1
- package/dist/migrate-DjrTwWJA.cjs +0 -271
- package/dist/migrate-DjrTwWJA.cjs.map +0 -1
- package/dist/openapi.cjs.map +0 -1
- package/dist/openapi.mjs.map +0 -1
- package/dist/projectBucket-BYOxRnHY.mjs +0 -177
- package/dist/projectBucket-BYOxRnHY.mjs.map +0 -1
- package/dist/projectBucket-CDu5rXjp.cjs +0 -206
- package/dist/projectBucket-CDu5rXjp.cjs.map +0 -1
- package/dist/provider-BqpjG9QM.cjs +0 -57
- package/dist/provider-BqpjG9QM.cjs.map +0 -1
- package/dist/provider-CEOKk8NS.mjs +0 -46
- package/dist/provider-CEOKk8NS.mjs.map +0 -1
- package/dist/ready-D3PIjx3S.cjs +0 -403
- package/dist/ready-D3PIjx3S.cjs.map +0 -1
- package/dist/ready-naOSJpeJ.mjs +0 -374
- package/dist/ready-naOSJpeJ.mjs.map +0 -1
- package/dist/reconcile/public.cjs +0 -7
- package/dist/reconcile/public.d.cts +0 -49
- package/dist/reconcile/public.d.cts.map +0 -1
- package/dist/reconcile/public.d.mts +0 -49
- package/dist/reconcile/public.d.mts.map +0 -1
- package/dist/reconcile/public.mjs +0 -3
- package/dist/reconcile--I7V4Klj.mjs.map +0 -1
- package/dist/reconcile-CuCQBa5-.cjs.map +0 -1
- package/dist/resolve-CNYbGH8g.mjs +0 -263
- package/dist/resolve-CNYbGH8g.mjs.map +0 -1
- package/dist/resolve-DC98Rl1t.cjs +0 -316
- package/dist/resolve-DC98Rl1t.cjs.map +0 -1
- package/dist/rollback-BkIkE8Qe.mjs +0 -136
- package/dist/rollback-BkIkE8Qe.mjs.map +0 -1
- package/dist/rollback-DBfLvC8k.cjs +0 -165
- package/dist/rollback-DBfLvC8k.cjs.map +0 -1
- package/dist/rolldown-runtime-BhDjJH2R.mjs +0 -15
- package/dist/run-BJLIerMM.mjs +0 -133
- package/dist/run-BJLIerMM.mjs.map +0 -1
- package/dist/run-fVZ-rLnc.cjs +0 -174
- package/dist/run-fVZ-rLnc.cjs.map +0 -1
- package/dist/runtime-CLz3bf07.d.mts +0 -82
- package/dist/runtime-CLz3bf07.d.mts.map +0 -1
- package/dist/runtime-CUWf0IUk.d.cts +0 -82
- package/dist/runtime-CUWf0IUk.d.cts.map +0 -1
- package/dist/s3-BwhQk3QM.mjs +0 -215
- package/dist/s3-BwhQk3QM.mjs.map +0 -1
- package/dist/s3-DLp0V-Ox.cjs +0 -215
- package/dist/s3-DLp0V-Ox.cjs.map +0 -1
- package/dist/sandbox/config-worker.cjs +0 -43
- package/dist/sandbox/config-worker.cjs.map +0 -1
- package/dist/sandbox/config-worker.d.cts +0 -1
- package/dist/sandbox/config-worker.d.mts +0 -1
- package/dist/sandbox/config-worker.mjs +0 -44
- package/dist/sandbox/config-worker.mjs.map +0 -1
- package/dist/sandbox/credentials-worker.cjs +0 -54
- package/dist/sandbox/credentials-worker.cjs.map +0 -1
- package/dist/sandbox/credentials-worker.d.cts +0 -1
- package/dist/sandbox/credentials-worker.d.mts +0 -1
- package/dist/sandbox/credentials-worker.mjs +0 -55
- package/dist/sandbox/credentials-worker.mjs.map +0 -1
- package/dist/sandbox/discover-worker.cjs +0 -47
- package/dist/sandbox/discover-worker.cjs.map +0 -1
- package/dist/sandbox/discover-worker.d.cts +0 -1
- package/dist/sandbox/discover-worker.d.mts +0 -1
- package/dist/sandbox/discover-worker.mjs +0 -48
- package/dist/sandbox/discover-worker.mjs.map +0 -1
- package/dist/sandbox/migrate-worker.cjs +0 -75
- package/dist/sandbox/migrate-worker.cjs.map +0 -1
- package/dist/sandbox/migrate-worker.d.cts +0 -1
- package/dist/sandbox/migrate-worker.d.mts +0 -1
- package/dist/sandbox/migrate-worker.mjs +0 -76
- package/dist/sandbox/migrate-worker.mjs.map +0 -1
- package/dist/sandbox-CHv3OYXg.cjs +0 -165
- package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
- package/dist/sandbox-CbVB7uOD.mjs +0 -118
- package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
- package/dist/sandbox-CfpLWTPP.d.mts +0 -104
- package/dist/sandbox-CfpLWTPP.d.mts.map +0 -1
- package/dist/sandbox-D1XeNEJ9.d.cts +0 -104
- package/dist/sandbox-D1XeNEJ9.d.cts.map +0 -1
- package/dist/schemas-BObwxB_t.cjs +0 -6017
- package/dist/schemas-BObwxB_t.cjs.map +0 -1
- package/dist/schemas-D-xeKJDD.mjs +0 -5916
- package/dist/schemas-D-xeKJDD.mjs.map +0 -1
- package/dist/secretsManager-CQORubp9.mjs +0 -97
- package/dist/secretsManager-CQORubp9.mjs.map +0 -1
- package/dist/secretsManager-RAGcEDX1.cjs +0 -108
- package/dist/secretsManager-RAGcEDX1.cjs.map +0 -1
- package/dist/seeds-BNHSpjNP.cjs +0 -9096
- package/dist/seeds-BNHSpjNP.cjs.map +0 -1
- package/dist/seeds-C4bZ8L-T.mjs +0 -8141
- package/dist/seeds-C4bZ8L-T.mjs.map +0 -1
- package/dist/sniffer-BIBm9dAb.mjs +0 -1825
- package/dist/sniffer-BIBm9dAb.mjs.map +0 -1
- package/dist/sniffer-Cylp9W2D.cjs +0 -1998
- package/dist/sniffer-Cylp9W2D.cjs.map +0 -1
- package/dist/sst-CGdjHn2A.mjs +0 -441
- package/dist/sst-CGdjHn2A.mjs.map +0 -1
- package/dist/sst-DGuHDxVU.cjs +0 -464
- package/dist/sst-DGuHDxVU.cjs.map +0 -1
- package/dist/stages-CcS9vnNu.mjs +0 -176
- package/dist/stages-CcS9vnNu.mjs.map +0 -1
- package/dist/stages-DdBV7msu.cjs +0 -176
- package/dist/stages-DdBV7msu.cjs.map +0 -1
- package/dist/target/public.cjs +0 -15
- package/dist/target/public.d.cts +0 -28
- package/dist/target/public.d.cts.map +0 -1
- package/dist/target/public.d.mts +0 -28
- package/dist/target/public.d.mts.map +0 -1
- package/dist/target/public.mjs +0 -4
- package/dist/terminal-CPHuH4S1.cjs +0 -85
- package/dist/terminal-CPHuH4S1.cjs.map +0 -1
- package/dist/terminal-iNmAXXjs.mjs +0 -85
- package/dist/terminal-iNmAXXjs.mjs.map +0 -1
- package/dist/types-BhThob0H.d.mts +0 -7621
- package/dist/types-BhThob0H.d.mts.map +0 -1
- package/dist/types-DwoLHelT.d.cts +0 -7622
- package/dist/types-DwoLHelT.d.cts.map +0 -1
- package/dist/utils-D2Nk1Nv2.cjs +0 -205
- package/dist/utils-D2Nk1Nv2.cjs.map +0 -1
- package/dist/utils-D_fxUqvU.mjs +0 -156
- package/dist/utils-D_fxUqvU.mjs.map +0 -1
- package/dist/vitest.cjs +0 -65
- package/dist/vitest.cjs.map +0 -1
- package/dist/vitest.d.cts +0 -29
- package/dist/vitest.d.cts.map +0 -1
- package/dist/vitest.d.mts +0 -29
- package/dist/vitest.d.mts.map +0 -1
- package/dist/vitest.mjs +0 -65
- package/dist/vitest.mjs.map +0 -1
- package/dist/workerRuntime-BXfhbe13.cjs +0 -108
- package/dist/workerRuntime-BXfhbe13.cjs.map +0 -1
- package/dist/workerRuntime-CsOyBRx2.mjs +0 -79
- package/dist/workerRuntime-CsOyBRx2.mjs.map +0 -1
- package/dist/workspace-D5CpOp1y.mjs +0 -2108
- package/dist/workspace-D5CpOp1y.mjs.map +0 -1
- package/dist/workspace-DRjdu1OY.cjs +0 -2514
- 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
|
|
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
|
|
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 {
|
|
124
|
+
import { e } from '@geekmidas/constructs/endpoints';
|
|
126
125
|
import { z } from 'zod';
|
|
127
126
|
|
|
128
|
-
export const getUsers =
|
|
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 =
|
|
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
|
-
|
|
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 {
|
|
168
|
-
import {
|
|
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
|
-
|
|
171
|
-
|
|
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
|
-
#
|
|
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
|
|
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>`:
|
|
320
|
-
- `aws`:
|
|
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
|
-
#
|
|
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
|
-
-
|
|
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
|
|
442
|
-
- `--push`: Push
|
|
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
|
|
448
|
-
-
|
|
449
|
-
- `.
|
|
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
|
-
**
|
|
450
|
+
**Dockerfile Types:**
|
|
452
451
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
|
460
|
+
# Generate multi-stage Dockerfile (default, recommended)
|
|
464
461
|
gkm docker
|
|
465
462
|
|
|
466
|
-
# Generate and build
|
|
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
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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:**
|
|
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
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
|
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
|
|
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
|
-
-
|
|
665
|
-
|
|
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
|
|
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
|
|
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
|
-
- `--
|
|
864
|
-
- `--
|
|
865
|
-
- `--tag <tag>`: Image tag (default:
|
|
866
|
-
- `--
|
|
867
|
-
- `--
|
|
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
|
-
#
|
|
875
|
-
|
|
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
|
-
#
|
|
884
|
-
|
|
892
|
+
# Dokploy: build, push, and trigger deployment
|
|
893
|
+
DOKPLOY_API_TOKEN=xxx gkm deploy --provider dokploy --stage production
|
|
885
894
|
|
|
886
|
-
#
|
|
887
|
-
gkm deploy --stage production --
|
|
895
|
+
# Custom tag
|
|
896
|
+
gkm deploy --provider docker --stage production --tag v1.0.0
|
|
888
897
|
```
|
|
889
898
|
|
|
890
|
-
**
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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
|
-
**
|
|
907
|
+
**Environment Variable Detection:**
|
|
897
908
|
|
|
898
|
-
|
|
909
|
+
The deploy command automatically detects required environment variables for each app using different strategies based on app configuration:
|
|
899
910
|
|
|
900
|
-
|
|
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
|
-
|
|
903
|
-
|
|
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
|
-
|
|
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
|
-
|
|
927
|
+
**Configuration:**
|
|
911
928
|
|
|
912
|
-
|
|
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
|
-
|
|
915
|
-
|
|
916
|
-
-
|
|
917
|
-
|
|
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
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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; //
|
|
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
|
|
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
|
|
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` |
|
|
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
|
-
|
|
1208
|
-
|
|
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
|
-
###
|
|
1272
|
+
### App Types
|
|
1223
1273
|
|
|
1224
|
-
|
|
1225
|
-
them out of the manifest; none of them is listed in config.
|
|
1274
|
+
#### Routes-Based Backend Apps
|
|
1226
1275
|
|
|
1227
|
-
|
|
1276
|
+
Standard API apps using endpoint discovery:
|
|
1228
1277
|
|
|
1229
1278
|
```typescript
|
|
1230
|
-
|
|
1231
|
-
|
|
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`
|
|
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
|
-
####
|
|
1291
|
+
#### Entry-Based Backend Apps
|
|
1239
1292
|
|
|
1240
|
-
|
|
1293
|
+
Apps with a custom entry point (like authentication services using better-auth):
|
|
1241
1294
|
|
|
1242
1295
|
```typescript
|
|
1243
|
-
|
|
1244
|
-
|
|
1296
|
+
auth: {
|
|
1297
|
+
type: 'backend',
|
|
1245
1298
|
path: 'apps/auth',
|
|
1246
|
-
|
|
1247
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1308
|
+
Example entry point for an auth service:
|
|
1261
1309
|
|
|
1262
1310
|
```typescript
|
|
1263
|
-
//
|
|
1264
|
-
|
|
1265
|
-
|
|
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
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
1333
|
-
|
|
1334
|
-
mail?:
|
|
1335
|
-
events?: 'pgboss' | 'sns' | 'rabbitmq';
|
|
1395
|
+
db?: boolean;
|
|
1396
|
+
cache?: boolean;
|
|
1397
|
+
mail?: boolean;
|
|
1336
1398
|
};
|
|
1337
1399
|
deploy?: {
|
|
1338
|
-
default?: 'dokploy' | 'docker'
|
|
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
|
-
|
|
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
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
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
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
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
|
-
|
|
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
|
|
1367
|
-
(HTTP API) adapter.
|
|
1453
|
+
Generates Lambda handlers compatible with AWS API Gateway v2 (HTTP API).
|
|
1368
1454
|
|
|
1369
1455
|
```bash
|
|
1370
|
-
gkm build
|
|
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 '
|
|
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
|
-
|
|
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
|
-
|
|
1426
|
-
├──
|
|
1427
|
-
│ ├──
|
|
1428
|
-
│
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
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
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
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
|
|
1513
|
-
export type
|
|
1514
|
-
export type
|
|
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
|
|
1518
|
-
export type
|
|
1519
|
-
export type
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1534
|
-
resources, each API's endpoints, queue consumers, functions and crons:
|
|
1594
|
+
#### Server Manifest (`.gkm/manifest/server.ts`)
|
|
1535
1595
|
|
|
1536
1596
|
```typescript
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1621
|
+
#### Using Manifest Types
|
|
1622
|
+
|
|
1623
|
+
Import the manifest types for type-safe infrastructure configuration:
|
|
1545
1624
|
|
|
1546
1625
|
```typescript
|
|
1547
|
-
import {
|
|
1626
|
+
import { manifest, type Route, type Authorizer } from './.gkm/manifest/aws';
|
|
1548
1627
|
|
|
1549
|
-
|
|
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
|
-
|
|
1552
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1639
|
-
hand-written server file or framework config:
|
|
1722
|
+
### AWS Lambda with Serverless Framework
|
|
1640
1723
|
|
|
1641
|
-
```
|
|
1642
|
-
#
|
|
1643
|
-
|
|
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
|
-
|
|
1646
|
-
|
|
1750
|
+
```typescript
|
|
1751
|
+
// server.ts
|
|
1752
|
+
import { createApp } from './.gkm/server/app.js';
|
|
1647
1753
|
|
|
1648
|
-
|
|
1649
|
-
gkm deploy --stage production
|
|
1754
|
+
const app = createApp();
|
|
1650
1755
|
|
|
1651
|
-
|
|
1652
|
-
|
|
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
|
-
|
|
1656
|
-
|
|
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 {
|
|
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
|
-
#
|
|
1854
|
-
|
|
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
|
-
"
|
|
1996
|
+
"docs": "gkm openapi --output src/api.ts"
|
|
1877
1997
|
}
|
|
1878
1998
|
}
|
|
1879
1999
|
```
|
|
1880
2000
|
|
|
1881
2001
|
### CI/CD Pipeline
|
|
1882
2002
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
[
|
|
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
|
-
//
|
|
1947
|
-
type Provider = 'aws' | '
|
|
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
|
|
2136
|
+
provider: Provider;
|
|
1986
2137
|
}
|
|
1987
2138
|
|
|
1988
2139
|
// Dev options
|