{"id":30584053,"url":"https://github.com/updatedotdev/js","last_synced_at":"2025-12-30T01:06:07.591Z","repository":{"id":280532397,"uuid":"942314087","full_name":"updatedotdev/js","owner":"updatedotdev","description":"Add payments to your app in five minutes.","archived":false,"fork":false,"pushed_at":"2025-04-25T14:27:54.000Z","size":81,"stargazers_count":114,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-02T00:53:41.064Z","etag":null,"topics":["billing","entitlements","nextjs","payments","react","saas","stripe","subscriptions","typescript","update"],"latest_commit_sha":null,"homepage":"https://update.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/updatedotdev.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}},"created_at":"2025-03-03T23:08:10.000Z","updated_at":"2025-07-30T19:13:57.000Z","dependencies_parsed_at":"2025-04-03T21:34:23.212Z","dependency_job_id":null,"html_url":"https://github.com/updatedotdev/js","commit_stats":null,"previous_names":["updatedotdev/js"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/updatedotdev/js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/updatedotdev%2Fjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/updatedotdev%2Fjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/updatedotdev%2Fjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/updatedotdev%2Fjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/updatedotdev","download_url":"https://codeload.github.com/updatedotdev/js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/updatedotdev%2Fjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272658779,"owners_count":24971604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"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":["billing","entitlements","nextjs","payments","react","saas","stripe","subscriptions","typescript","update"],"created_at":"2025-08-29T09:02:56.145Z","updated_at":"2025-12-30T01:06:07.564Z","avatar_url":"https://github.com/updatedotdev.png","language":"TypeScript","readme":"# Update JS Library\n\nUpdate is a library for seamless billing and entitlement management. It integrates with your existing tools, like Stripe and Supabase, so you can integrate without migrating away from your existing stack.\n\n## 🚀 Quickstart\n\nThe easiest way to get started with Update is to use the `create-update-app` command:\n\n```bash\nnpm create update@latest\n```\n\nThis tool will help you choose a framework and set up a fully working Update application in seconds. Just provide a name and your API keys.\n\nFor source code examples, check out our [examples repository](https://github.com/updatedotdev/examples).\n\n## ✨ Features\n\n- **Billing**: Seamless payments management\n- **Entitlements**: Simple access control for premium features\n- **Framework Support**: Built-in integration for Next.js and other SSR environments\n\n## 🔧 Installation\n\n```bash\nnpm install @updatedev/js\n```\n\n## 🔐 Auth Integrations\n\n- 🐘 [Supabase](https://supabase.com?utm_source=update\u0026utm_medium=referral\u0026utm_campaign=update-js-readme)\n- 🔥 [Firebase](https://firebase.google.com?utm_source=update\u0026utm_medium=referral\u0026utm_campaign=update-js-readme)\n- 🔐 [Clerk](https://clerk.com?utm_source=update\u0026utm_medium=referral\u0026utm_campaign=update-js-readme)\n- ⚙️ Custom\n\n## 🏁 Getting Started\n\nFirst, you need to create an account on [Update](https://update.dev) and obtain your publishable key. This key is essential for initializing the Update client in your application. Additionally, configure your preferred authentication provider to manage user sessions and access control.\n\n## ⚙️ Initializing\n\n### Basic Setup\n\n```typescript\nimport { createClient } from '@updatedev/js';\n\nexport async function createUpdateClient() {\n  return createClient(process.env.NEXT_PUBLIC_UPDATE_PUBLISHABLE_KEY!, {\n    getSessionToken: async () =\u003e {\n      // This must be replaced with your own logic to get your session token\n      // For example, with Supabase:\n      //\n      // import { createSupabaseClient } from '@/utils/supabase/client'\n      // ...\n      // const supabase = createSupabaseClient()\n      // const { data } = await supabase.auth.getSession()\n      // if (data.session == null) return\n      // return data.session.access_token\n\n      // For this example, we'll just return a static token\n      return 'your-session-token';\n    },\n    environment: process.env.NODE_ENV === 'production' ? 'live' : 'test',\n  });\n}\n```\n\n### Initialization options\n\n- `getSessionToken`: A function that returns a session token for the user. This is optional, but required for most functions that require authentication.\n- `environment`: The environment to use for the client. Valid values are `live` and `test`.\n\n### Environment Variables (.env.local)\n\n```\nNEXT_PUBLIC_UPDATE_PUBLISHABLE_KEY=\n```\n\n## 🏗️ Framework Integration\n\n### Next.js Integration\n\nUpdate works well with Next.js and other SSR environments. Create a `utils/update` directory with these files:\n\n#### Client (utils/update/client.ts)\n\n```typescript\nimport { createClient } from '@updatedev/js';\n\nexport async function createUpdateClient() {\n  return createClient(process.env.NEXT_PUBLIC_UPDATE_PUBLISHABLE_KEY!, {\n    getSessionToken: async () =\u003e {\n      // This must be replaced with your own logic to get your session token\n      // For example, with Supabase:\n      //\n      // import { createSupabaseClient } from '@/utils/supabase/client'\n      // ...\n      // const supabase = createSupabaseClient()\n      // const { data } = await supabase.auth.getSession()\n      // if (data.session == null) return\n      // return data.session.access_token\n\n      // For this example, we'll just return a static token\n      return 'your-session-token';\n    },\n    environment: process.env.NODE_ENV === 'production' ? 'live' : 'test',\n  });\n}\n```\n\n#### Server (utils/update/server.ts)\n\n```typescript\nimport { createClient } from '@updatedev/js';\n\nexport async function createUpdateClient() {\n  return createClient(process.env.NEXT_PUBLIC_UPDATE_PUBLISHABLE_KEY!, {\n    getSessionToken: async () =\u003e {\n      // This must be replaced with your own logic to get your session token\n      // For example, with Supabase:\n      //\n      // import { createSupabaseClient } from '@/utils/supabase/server'\n      // const supabase = await createSupabaseClient()\n      // const { data } = await supabase.auth.getSession()\n      // if (data.session == null) return\n      // return data.session.access_token\n\n      // For this example, we'll just return a static token\n      return 'your-session-token';\n    },\n    environment: process.env.NODE_ENV === 'production' ? 'live' : 'test',\n  });\n}\n```\n\n## 💳 Billing Features\n\n### Getting Products\n\n```typescript\nconst { data, error } = await client.billing.getProducts();\n```\n\n### Creating a Checkout Session\n\n```typescript\nconst { data, error } = await client.billing.createCheckoutSession(priceId, {\n  redirect_url: 'http://localhost:3000/subscription',\n});\n```\n\n### Managing Subscriptions\n\nGet user subscriptions:\n\n```typescript\nconst { data } = await client.billing.getSubscriptions();\n```\n\nCancel a subscription:\n\n```typescript\nawait client.billing.updateSubscription(id, {\n  cancel_at_period_end: true,\n});\n```\n\nReactivate a subscription:\n\n```typescript\nawait client.billing.updateSubscription(id, {\n  cancel_at_period_end: false,\n});\n```\n\n## 🛡️ Entitlements\n\n### List Entitlements\n\n```typescript\nconst { data, error } = await client.entitlements.list();\n```\n\n### Check Entitlement\n\n```typescript\nconst { data, error } = await client.entitlements.check('premium');\n```\n\n## 📚 Documentation\n\nFor complete documentation, visit [our documentation](https://update.dev/docs).\n\n## 💬 Support\n\nNeed help? Join our [Discord community](https://discord.gg/Guege5tXFK) for support and discussions.\n\n## 🤝 License\n\nMIT\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupdatedotdev%2Fjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupdatedotdev%2Fjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupdatedotdev%2Fjs/lists"}