{"id":51143794,"url":"https://github.com/usebarekey/sdk","last_synced_at":"2026-06-26T01:02:26.358Z","repository":{"id":342879665,"uuid":"1173525832","full_name":"usebarekey/sdk","owner":"usebarekey","description":"Typescript SDK for Barekey","archived":false,"fork":false,"pushed_at":"2026-03-23T21:01:26.000Z","size":239,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-25T19:36:36.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmx.dev/package/@barekey/sdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usebarekey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-05T13:15:54.000Z","updated_at":"2026-03-23T21:01:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/usebarekey/sdk","commit_stats":null,"previous_names":["usebarekey/sdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usebarekey/sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usebarekey%2Fsdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usebarekey%2Fsdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usebarekey%2Fsdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usebarekey%2Fsdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usebarekey","download_url":"https://codeload.github.com/usebarekey/sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usebarekey%2Fsdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34798183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-26T01:02:22.897Z","updated_at":"2026-06-26T01:02:26.328Z","avatar_url":"https://github.com/usebarekey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @barekey/sdk\n\nTypeScript SDK for Barekey.\n\n## Install\n\n```bash\nnpm install @barekey/sdk\n```\n\n## Entrypoints\n\n- `@barekey/sdk`: root export for `BarekeyClient`, `PublicBarekeyClient`, and shared types\n- `@barekey/sdk/server`: optional explicit server subpath\n- `@barekey/sdk/public`: optional explicit public-variable subpath\n\n## Server quickstart\n\nCreate `barekey.json`:\n\n```json\n{\n  \"$schema\": \"./node_modules/@barekey/sdk/dist/barekey.schema.json\",\n  \"organization\": \"acme\",\n  \"project\": \"web\",\n  \"environment\": \"development\",\n  \"config\": {\n    \"mode\": \"centralized\",\n    \"typegen\": \"semantic\",\n    \"disallow_ambigious_keys\": true\n  }\n}\n```\n\nLog in locally:\n\n```bash\nbarekey login\n```\n\nUse the SDK:\n\n```ts\nimport { BarekeyClient } from \"@barekey/sdk\";\n\nconst barekey = new BarekeyClient();\n\nconst databaseUrl = await barekey.get(\"DATABASE_URL\");\nconst details = await barekey.get(\"DATABASE_URL\").inspect();\n```\n\n## Auth resolution\n\nIn centralized mode the server client uses:\n\n1. `BAREKEY_ACCESS_TOKEN`\n2. a stored CLI session from `barekey login`\n\nOptional:\n\n- `BAREKEY_API_URL` overrides the API base URL\n\n## `barekey.json`\n\nSupported keys:\n\n- `$schema`\n- `organization` or `org`\n- `project`\n- `environment` or `stage`\n- `config.mode`: `\"centralized\"` or `\"standalone\"`\n- `config.typegen`: `\"semantic\"` or `\"minimal\"`\n- `config.disallow_ambigious_keys`: `boolean` (defaults to `true`)\n\n## Typegen\n\nGenerate SDK types into the installed package:\n\n```bash\nbarekey typegen\n```\n\nWatch mode:\n\n```bash\nbarekey typegen --watch\n```\n\n`semantic` typegen keeps Barekey metadata in the generated `Env\u003c...\u003e` wrapper, including `Kind`, `Visibility`, and `Rollout`. `minimal` only emits the resolved value type.\n\n## Public client\n\n```ts\nimport { PublicBarekeyClient } from \"@barekey/sdk\";\n\nconst publicBarekey = new PublicBarekeyClient({\n  organization: \"acme\",\n  project: \"web\",\n  environment: \"production\",\n});\n\nconst title = await publicBarekey.get(\"PUBLIC_TITLE\");\n```\n\n## Requirements schemas\n\nPass a Standard Schema v1 validator directly:\n\n```ts\nimport { z } from \"zod\";\nimport { BarekeyClient } from \"@barekey/sdk\";\n\nconst barekey = new BarekeyClient({\n  requirements: z.object({\n    DATABASE_URL: z.string().url(),\n    DEBUG_MODE: z.boolean(),\n  }),\n});\n```\n\n## Development\n\n```bash\nbun install\nbun run build\nbun run typecheck\nbun test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusebarekey%2Fsdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusebarekey%2Fsdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusebarekey%2Fsdk/lists"}