{"_id":"@10play/tendb","_rev":"5-5887fea588897430e6ed36e99b01617c","name":"@10play/tendb","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@10play/tendb","version":"0.1.0","license":"MIT","_id":"@10play/tendb@0.1.0","maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"homepage":"https://10play.github.io/tendb/","bugs":{"url":"https://github.com/10play/tendb/issues"},"bin":{"tendb":"dist/index.js"},"dist":{"shasum":"c2908fda36617fe723cab01d7a95fbfdbe24dfbf","tarball":"https://registry.npmjs.org/@10play/tendb/-/tendb-0.1.0.tgz","fileCount":29,"integrity":"sha512-wbQ1kZ0ip7mZLWkpAT2dh7PgLyEPvN66IGHwahyyytbxnKy+s+97qZUnNBzyg2319uvrTZDopGCQsQZCWYfW4w==","signatures":[{"sig":"MEUCIHL1Fmoj2QeoQcYycb2qm/yaWy7AHRoRCICEfp9c/UDVAiEAjEmSVRivCphdqevRaMIfAO8iZNGCasDOgbb+XXWJ0aA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1148054},"type":"module","types":"./dist/sdk.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/sdk.d.ts","import":"./dist/sdk.js"},"./package.json":"./package.json"},"gitHead":"406e4b8f91a0c52261875e2d9148c26eaa25f3e0","scripts":{"dev":"tsup --watch","test":"vitest run","build":"pnpm build:cli && pnpm build:console","build:cli":"tsup","typecheck":"tsc --noEmit","build:console":"vite build console","prepublishOnly":"pnpm build && pnpm test"},"_npmUser":{"name":"17amir17","email":"amir@10play.dev"},"repository":{"url":"git+https://github.com/10play/tendb.git","type":"git","directory":"packages/tendb/cli"},"_npmVersion":"10.9.4","description":"Neon-style Postgres branching: CLI + local console for DBLab (Database Lab Engine), reachable over AWS SSM","directories":{},"_nodeVersion":"22.22.0","dependencies":{"pg":"^8.16.0","zod":"^3.24.0","commander":"^13.1.0","picocolors":"^1.1.1","@clack/prompts":"^0.11.0","@aws-sdk/client-ssm":"^3.700.0","@aws-sdk/credential-providers":"^3.700.0","@aws-sdk/client-secrets-manager":"^3.700.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4","devDependencies":{"tsup":"^8.3.0","vite":"^6.0.0","react":"^19.0.0","vitest":"^3.0.0","@types/pg":"^8.11.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/node":"^22.10.0","tailwindcss":"^4.0.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@tailwindcss/vite":"^4.0.0","@codemirror/lang-sql":"^6.8.0","@vitejs/plugin-react":"^4.3.0","@tanstack/react-query":"^5.60.0","@uiw/react-codemirror":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/tendb_0.1.0_1787062702278_0.4814386087490876","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@10play/tendb","version":"0.1.1","keywords":["postgres","postgresql","database-branching","neon","neon-alternative","self-hosted","dblab","database-lab-engine","preview-environments","preview-databases","copy-on-write","ci","terraform","aws"],"license":"MIT","_id":"@10play/tendb@0.1.1","maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"homepage":"https://10play.github.io/tendb/","bugs":{"url":"https://github.com/10play/tendb/issues"},"bin":{"tendb":"dist/index.js"},"dist":{"shasum":"c9e2dd3642d20a1cb28f9ac6853d0f7ff4930dd2","tarball":"https://registry.npmjs.org/@10play/tendb/-/tendb-0.1.1.tgz","fileCount":29,"integrity":"sha512-O73Ksk0fZUgUzmcSpNXooPJaoVFpridepxlMRYgTgWyDqKgAVJxz6mJCvuB17v5vdlqemY3bMBPQAaNfhcxuwg==","signatures":[{"sig":"MEYCIQC1xMnmmL8VIbjOnh2Fix3Zto/IomBDOxbZ5ZF3fen/6QIhAJtibMLh8gVN3uuCFgfnx+MQZobZxl7IWFXorOfdc5jD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@10play%2ftendb@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1154571},"type":"module","types":"./dist/sdk.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/sdk.d.ts","import":"./dist/sdk.js"},"./package.json":"./package.json"},"gitHead":"34ec09db8c6e489c1094d56365ab6fdee6feede7","scripts":{"dev":"tsup --watch","test":"vitest run","build":"pnpm build:cli && pnpm build:console","build:cli":"tsup","typecheck":"tsc --noEmit","build:console":"vite build console","prepublishOnly":"pnpm build && pnpm test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2425fea-5c6b-4d67-aec6-6dccd8ccaacb"}},"repository":{"url":"git+https://github.com/10play/tendb.git","type":"git","directory":"packages/tendb/cli"},"_npmVersion":"12.0.2","description":"Self-hosted Neon alternative — database branching for Postgres on infrastructure you own. CLI + web console for DBLab Engine on AWS, GCP, Azure, or local Docker.","directories":{},"_nodeVersion":"22.23.2","dependencies":{"pg":"^8.16.0","zod":"^3.24.0","commander":"^13.1.0","picocolors":"^1.1.1","@clack/prompts":"^0.11.0","@aws-sdk/client-ssm":"^3.700.0","@aws-sdk/credential-providers":"^3.700.0","@aws-sdk/client-secrets-manager":"^3.700.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4","devDependencies":{"tsup":"^8.3.0","vite":"^6.0.0","react":"^19.0.0","vitest":"^3.0.0","@types/pg":"^8.11.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/node":"^22.10.0","tailwindcss":"^4.0.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@tailwindcss/vite":"^4.0.0","@codemirror/lang-sql":"^6.8.0","@vitejs/plugin-react":"^4.3.0","@tanstack/react-query":"^5.60.0","@uiw/react-codemirror":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/tendb_0.1.1_1787138795238_0.8626543404291831","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@10play/tendb","version":"0.1.2","keywords":["postgres","postgresql","database-branching","neon","neon-alternative","self-hosted","dblab","database-lab-engine","preview-environments","preview-databases","copy-on-write","ci","terraform","aws"],"license":"MIT","_id":"@10play/tendb@0.1.2","maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"homepage":"https://10play.github.io/tendb/","bugs":{"url":"https://github.com/10play/tendb/issues"},"bin":{"tendb":"dist/index.js"},"dist":{"shasum":"da761a8eec54080e80b95bc0f0351b7f237935e6","tarball":"https://registry.npmjs.org/@10play/tendb/-/tendb-0.1.2.tgz","fileCount":29,"integrity":"sha512-XVl756ejv2T3ceDxZdBR7c14mP02gAyUqLjA6Fv8sRynuXEN6Byerg2/wlIlKVG40rhJ0pcbyrNRDYmRAK6Rwg==","signatures":[{"sig":"MEUCIQCbwJN664enPvxT61tdONwfIgZvG1s8rMge2kgK1Zka2wIgKqtb4vM/MaTpdIZZpPlpvw4fP2s/94C2MlzyDWuY9Yw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@10play%2ftendb@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1159202},"type":"module","types":"./dist/sdk.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/sdk.d.ts","import":"./dist/sdk.js"},"./package.json":"./package.json"},"gitHead":"9e4a20d112ef2917d9a37bf6019a4bb24980b995","scripts":{"dev":"tsup --watch","test":"vitest run","build":"pnpm build:cli && pnpm build:console","build:cli":"tsup","typecheck":"tsc --noEmit","build:console":"vite build console","prepublishOnly":"pnpm build && pnpm test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2425fea-5c6b-4d67-aec6-6dccd8ccaacb"}},"repository":{"url":"git+https://github.com/10play/tendb.git","type":"git","directory":"packages/tendb/cli"},"_npmVersion":"12.0.2","description":"Self-hosted Neon alternative — database branching for Postgres on infrastructure you own. CLI + web console for DBLab Engine on AWS, GCP, Azure, or local Docker.","directories":{},"_nodeVersion":"22.23.2","dependencies":{"pg":"^8.16.0","zod":"^3.24.0","commander":"^13.1.0","picocolors":"^1.1.1","@clack/prompts":"^0.11.0","@aws-sdk/client-ssm":"^3.700.0","@aws-sdk/credential-providers":"^3.700.0","@aws-sdk/client-secrets-manager":"^3.700.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4","devDependencies":{"tsup":"^8.3.0","vite":"^6.0.0","react":"^19.0.0","vitest":"^3.0.0","@types/pg":"^8.11.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/node":"^22.10.0","tailwindcss":"^4.0.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@tailwindcss/vite":"^4.0.0","@codemirror/lang-sql":"^6.8.0","@vitejs/plugin-react":"^4.3.0","@tanstack/react-query":"^5.60.0","@uiw/react-codemirror":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/tendb_0.1.2_1787142188433_0.3071097169749042","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@10play/tendb","version":"0.1.3","keywords":["postgres","postgresql","database-branching","neon","neon-alternative","self-hosted","dblab","database-lab-engine","preview-environments","preview-databases","copy-on-write","ci","terraform","aws"],"license":"MIT","_id":"@10play/tendb@0.1.3","maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"homepage":"https://10play.github.io/tendb/","bugs":{"url":"https://github.com/10play/tendb/issues"},"bin":{"tendb":"dist/index.js"},"dist":{"shasum":"4235baddc0aa1c4abe780fbd6e8454dc38d42b08","tarball":"https://registry.npmjs.org/@10play/tendb/-/tendb-0.1.3.tgz","fileCount":29,"integrity":"sha512-otXDyI6AGDUvYOty2k1FCyJbyj+i8qIByQFRghaVU0D4et8Oveo2n5AhS0U1/xBvMtWuLNBcZDgD2oQKWI+iQQ==","signatures":[{"sig":"MEYCIQDhm970VeF7HL2yJ7NKJRge4iKM6WpVplTYYklCzfn9cwIhANaozpI9UDNdGXULta2jDQqVtiv47ZkGnydFAIQy3gE+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@10play%2ftendb@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1163584},"type":"module","types":"./dist/sdk.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/sdk.d.ts","import":"./dist/sdk.js"},"./package.json":"./package.json"},"gitHead":"1650edf89705ea99a25269b1245a608d8d2d598f","scripts":{"dev":"tsup --watch","test":"vitest run","build":"pnpm build:cli && pnpm build:console","build:cli":"tsup","typecheck":"tsc --noEmit","build:console":"vite build console","prepublishOnly":"pnpm build && pnpm test"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2425fea-5c6b-4d67-aec6-6dccd8ccaacb"}},"repository":{"url":"git+https://github.com/10play/tendb.git","type":"git","directory":"packages/tendb/cli"},"_npmVersion":"12.0.2","description":"Self-hosted Neon alternative — database branching for Postgres on infrastructure you own. CLI + web console for DBLab Engine on AWS, GCP, Azure, or local Docker.","directories":{},"_nodeVersion":"22.23.2","dependencies":{"pg":"^8.16.0","zod":"^3.24.0","commander":"^13.1.0","picocolors":"^1.1.1","@clack/prompts":"^0.11.0","@aws-sdk/client-ssm":"^3.700.0","@aws-sdk/credential-providers":"^3.700.0","@aws-sdk/client-secrets-manager":"^3.700.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4","devDependencies":{"tsup":"^8.3.0","vite":"^6.0.0","react":"^19.0.0","vitest":"^3.0.0","@types/pg":"^8.11.0","react-dom":"^19.0.0","typescript":"^5.7.0","@types/node":"^22.10.0","tailwindcss":"^4.0.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@tailwindcss/vite":"^4.0.0","@codemirror/lang-sql":"^6.8.0","@vitejs/plugin-react":"^4.3.0","@tanstack/react-query":"^5.60.0","@uiw/react-codemirror":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/tendb_0.1.3_1787212845132_0.7088277231963058","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@10play/tendb","version":"0.1.4","description":"Self-hosted Neon alternative — database branching for Postgres on infrastructure you own. CLI + web console for DBLab Engine on AWS, GCP, Azure, or local Docker.","keywords":["postgres","postgresql","database-branching","neon","neon-alternative","self-hosted","dblab","database-lab-engine","preview-environments","preview-databases","copy-on-write","ci","terraform","aws"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/10play/tendb.git","directory":"packages/tendb/cli"},"homepage":"https://10play.github.io/tendb/","bugs":{"url":"https://github.com/10play/tendb/issues"},"type":"module","packageManager":"pnpm@9.15.4","bin":{"tendb":"dist/index.js"},"exports":{".":{"types":"./dist/sdk.d.ts","import":"./dist/sdk.js"},"./package.json":"./package.json"},"types":"./dist/sdk.d.ts","engines":{"node":">=20"},"scripts":{"build":"pnpm build:cli && pnpm build:console","build:cli":"tsup","build:console":"vite build console","dev":"tsup --watch","test":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"pnpm build && pnpm test"},"dependencies":{"@aws-sdk/client-secrets-manager":"^3.700.0","@aws-sdk/client-ssm":"^3.700.0","@aws-sdk/credential-providers":"^3.700.0","@clack/prompts":"^0.11.0","commander":"^13.1.0","pg":"^8.16.0","picocolors":"^1.1.1","zod":"^3.24.0"},"devDependencies":{"@codemirror/lang-sql":"^6.8.0","@tailwindcss/vite":"^4.0.0","@tanstack/react-query":"^5.60.0","@types/node":"^22.10.0","@types/pg":"^8.11.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@uiw/react-codemirror":"^4.23.0","@vitejs/plugin-react":"^4.3.0","react":"^19.0.0","react-dom":"^19.0.0","tailwindcss":"^4.0.0","tsup":"^8.3.0","typescript":"^5.7.0","vite":"^6.0.0","vitest":"^3.0.0"},"publishConfig":{"access":"public"},"gitHead":"67ef445094ce320b778a382891be5ede8a79d3e3","_id":"@10play/tendb@0.1.4","_nodeVersion":"22.23.2","_npmVersion":"12.0.2","dist":{"integrity":"sha512-GBDFI6IoJpymMzNPfhhwWg8nrWZmWY+i9ock5rMUEra2BXMaR/bZCA6Cv5MjTycTqGMs2w3XNLRD8vwbHjsvGw==","shasum":"7ee1e05da9ceb8589f31e506cfee098c2916838e","tarball":"https://registry.npmjs.org/@10play/tendb/-/tendb-0.1.4.tgz","fileCount":29,"unpackedSize":1164367,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@10play%2ftendb@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDB+paNHZxyfalDnpJujeTGRhzvxqiu64AvJJJoJAI0PQIhALqN+Ni8E4m/FkIh4W87w8lo0L6c/9UOWp22RTiAiFUF"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b2425fea-5c6b-4d67-aec6-6dccd8ccaacb"}},"directories":{},"maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tendb_0.1.4_1787214143512_0.42626508244521366"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-18T14:18:22.007Z","modified":"2026-08-20T08:22:24.076Z","0.1.0":"2026-08-18T14:18:22.438Z","0.1.1":"2026-08-19T11:26:35.393Z","0.1.2":"2026-08-19T12:23:08.613Z","0.1.3":"2026-08-20T08:00:45.292Z","0.1.4":"2026-08-20T08:22:23.660Z"},"bugs":{"url":"https://github.com/10play/tendb/issues"},"license":"MIT","homepage":"https://10play.github.io/tendb/","keywords":["postgres","postgresql","database-branching","neon","neon-alternative","self-hosted","dblab","database-lab-engine","preview-environments","preview-databases","copy-on-write","ci","terraform","aws"],"repository":{"type":"git","url":"git+https://github.com/10play/tendb.git","directory":"packages/tendb/cli"},"description":"Self-hosted Neon alternative — database branching for Postgres on infrastructure you own. CLI + web console for DBLab Engine on AWS, GCP, Azure, or local Docker.","maintainers":[{"name":"17amir17","email":"amir@10play.dev"},{"name":"guy353","email":"guy353@gmail.com"}],"readme":"<div align=\"center\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/10play/tendb/main/apps/docs/src/assets/brand/tendb-lockup-dark.png\">\n    <img src=\"https://raw.githubusercontent.com/10play/tendb/main/apps/docs/src/assets/brand/tendb-lockup-light.png\" alt=\"tendb\" width=\"170\">\n  </picture>\n</div>\n\n# @10play/tendb\n\nNeon-style Postgres branching on infrastructure you own. Copy-on-write\nbranches of your real database — AWS, GCP, Azure, or your laptop's Docker —\nready in seconds, powered by [DBLab Engine](https://postgres.ai) (Postgres.ai).\n\n[Documentation](https://10play.github.io/tendb/) · [Quickstart](https://10play.github.io/tendb/getting-started/quickstart/) · [Example app](https://github.com/10play/tendb/tree/main/apps/example)\n\n<picture>\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/10play/tendb/main/apps/docs/src/assets/console/dashboard-dark.png\">\n  <img src=\"https://raw.githubusercontent.com/10play/tendb/main/apps/docs/src/assets/console/dashboard-light.png\" alt=\"The tendb console: branches, storage, sync state, and platform settings on one dashboard\" width=\"820\">\n</picture>\n\n*The bundled console (`tendb console`) — branches, SQL editor, snapshots, and\nalerts on localhost. Nothing sensitive ever reaches the browser.*\n\n## Get the infra up (from zero)\n\nPrereqs: Node ≥ 20, Terraform ≥ 1.11, and (for the `local` platform) Docker.\n`local` needs no cloud account — on macOS the preflight builds a small colima\nVM (Homebrew required; Docker Desktop's kernel has no ZFS); Linux runs it\nnatively.\n\n```sh\nnpm install -g @10play/tendb\n\ntendb init --platform local   # scaffold terraform + tendb.json into your project\ntendb up                      # preflight + terraform apply + wire tendb.json\ntendb branches create my-feature\n```\n\n`init` prompts for a platform (`aws` · `gcp` · `azure` · `local`) and its few\nrequired inputs, then writes a `tendb/` Terraform directory you own (module\nsources pinned to a tendb release) and a `tendb.json`. `tendb up` wraps\n`terraform init && apply` and folds the stack's discovery outputs back into\n`tendb.json`; `tendb down` destroys the stack. On `local`, `up` also\nprovisions the ZFS Docker host and a seeded demo source to branch from.\n\n## Daily commands\n\n| Command | What it does |\n|---|---|\n| `tendb branches create <name>` | idempotent create-or-reuse; prints the connection URI |\n| `tendb psql <name> [-- args]` | auto tunnel + psql |\n| `tendb status` | engine health, sync state, disk, clone capacity |\n| `tendb console` | the dashboard shown above, on localhost |\n| `tendb migrate <branch> -- <cmd>` | run `cmd` with `DATABASE_URL` on the branch |\n| `tendb ci ensure <id>` | a preview database per pull request (contract below) |\n\nA bare number is PR shorthand everywhere: `tendb ci ensure 42` → branch `pr-42`.\nThe [full command reference](https://10play.github.io/tendb/reference/cli/)\ncovers the rest — `tunnel`, `connection-string`, `snapshots`, `schema`,\n`checkup`, `ui`, `down` — plus every flag and exit code.\n\nGlobal flags: `--env`, `--platform`, `--region`, `--profile`, `--ssm-prefix`,\n`--instance-id`, `--api-url`, `--config`, `-o/--output table|json`, `--quiet`.\n\n## The CI contract (`tendb ci …`)\n\nDrop-in for the legacy `dblab-branch.sh` / `neon-branch.sh`:\n\n- the connection URI is the **last line on stdout**; all progress goes to stderr\n- `ci delete` exits **0** when the branch is already gone or the platform is\n  down (SSM `instance-id` param missing)\n- mask the URI in CI logs: `URI=$(tendb ci ensure \"$PR\" | tail -1)` then\n  `echo \"::add-mask::$URI\"`\n\n### Exit codes\n\n| code | meaning |\n|---|---|\n| 0 | success (incl. delete-of-absent) |\n| 1 | generic/API error |\n| 2 | usage error |\n| 3 | branch/clone not found |\n| 4 | timeout or clone FATAL |\n| 5 | missing local dependency (session-manager-plugin, terraform, psql) |\n| 10 | platform down |\n| 42 | clone capacity exhausted (port pool full) |\n\n## SDK\n\nThe same internals, importable — `import { createClient } from \"@10play/tendb\"`.\nConfig resolution matches the CLI (flags-shaped options > `TENDB_*` env >\n`tendb.json` > defaults); the session opens lazily and `close()` tears\ntunnels down.\n\n```ts\nimport { createClient, webhookSink } from \"@10play/tendb\";\n\nconst client = createClient(); // tendb.json discovery, or pass { ssmPrefix, region, ... }\n\n// Branch lifecycle\nconst branch = await client.branches.create(\"my-feature\", { from: \"main\" });\nawait client.branches.reset(\"my-feature\");\nawait client.branches.delete(\"my-feature\");\n\n// Migration rehearsal on production-shaped data (scratch branch, auto-cleanup)\nconst result = await client.migrate({ command: [\"npx\", \"prisma\", \"migrate\", \"deploy\"] });\nif (!result.ok) process.exit(result.exitCode);\n\n// Ephemeral branch for tests\nawait client.withBranch(\"it-tests\", async ({ url }) => {\n  // url is dial-ready (SSM branches get a tunnel automatically)\n});\n\n// Monitoring: one-shot findings, or a poller with pluggable sinks\nconst { ok, findings } = await client.checkup();\nconst watcher = client.watch({\n  intervalMs: 60_000,\n  ...webhookSink(\"https://hooks.example.com/tendb\"), // or your own onAlert/onRecover\n});\n// later: watcher.stop(); await client.close();\n```\n\n`checkup()`/`watch()` evaluate typed findings — `engine-unreachable`,\n`data-stale`, `disk-usage`, `clone-capacity`, `replication-lag`,\n`subscription-disabled`, … — with overridable thresholds. `watch()` emits\ntransitions only (alert on appear/escalate, recover on clear), so wiring\nSlack/PagerDuty later is a matter of swapping the callback.\n\n## Configuration\n\nPrecedence: flags > `TENDB_*` env vars > `tendb.json` (found upward from\ncwd) > defaults.\n\n```jsonc\n// tendb.json\n{\n  \"ssmPrefix\": \"/tendb\",        // where the terraform module put its params\n  \"region\": \"eu-north-1\",\n  \"profile\": null,                 // AWS profile (SDK default chain otherwise)\n  \"instanceId\": null,              // set to skip SSM discovery\n  \"apiUrl\": null,                  // DIRECT MODE: http://…:2345 — no AWS at all\n  \"token\": null,                   // direct-mode token (prefer TENDB_TOKEN)\n  \"database\": null,                // default: SSM <prefix>/dbname (host-published)\n  \"snapshotTimeoutSeconds\": 900,\n  \"cloneTimeoutSeconds\": 120,\n  \"environments\": {                // select with --env / TENDB_ENV\n    \"staging\": { \"ssmPrefix\": \"/staging\" }\n  }\n}\n```\n\nEnv vars: `TENDB_ENV`, `TENDB_SSM_PREFIX`, `TENDB_REGION`,\n`TENDB_PROFILE`, `TENDB_INSTANCE_ID`, `TENDB_API_URL`,\n`TENDB_TOKEN`, `TENDB_DATABASE`, `TENDB_CONFIG`.\n\n## The console\n\n`tendb console` opens the platform's native tunnel (SSM on AWS, IAP on GCP,\nBastion on Azure, loopback locally), serves the bundled SPA + a local API on\n`127.0.0.1:<port>` (default 4400), and opens the browser. Screens: branches\n(create/delete/reset + connection details), SQL editor (queries run server-side\nthrough per-clone tunnels), snapshots & sync. The verification token and your\ncloud credentials never reach the browser.\n\n## Development\n\n```bash\npnpm install\npnpm test            # vitest: unit + built-binary contract tests vs a mock engine\npnpm build           # tsup (CLI → dist/index.js) + vite (console → dist/console/)\n```\n\nWorking on the CLI or console itself? See the\n[repository](https://github.com/10play/tendb) for the dev loop and transport\ninternals.\n","readmeFilename":"README.md"}