{"id":22586435,"url":"https://github.com/mrwyndham/pocketbase-lemonsqueezy","last_synced_at":"2026-03-10T06:33:06.221Z","repository":{"id":261195083,"uuid":"883562028","full_name":"mrwyndham/pocketbase-lemonsqueezy","owner":"mrwyndham","description":"A small repo to help SaaS devs build a LemonSqueezy integration with Pocketbase","archived":false,"fork":false,"pushed_at":"2024-12-05T06:40:20.000Z","size":32,"stargazers_count":39,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-14T22:28:24.407Z","etag":null,"topics":["lemonsqueezy","pocketbase","saas"],"latest_commit_sha":null,"homepage":"https://fastpocket.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrwyndham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-11-05T07:23:53.000Z","updated_at":"2025-07-24T00:50:48.000Z","dependencies_parsed_at":"2025-02-15T15:42:29.841Z","dependency_job_id":"9cfd0721-4efc-47a0-9f04-1427b3423c65","html_url":"https://github.com/mrwyndham/pocketbase-lemonsqueezy","commit_stats":null,"previous_names":["mrwyndham/pocketbase-lemonsqueezy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrwyndham/pocketbase-lemonsqueezy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwyndham%2Fpocketbase-lemonsqueezy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwyndham%2Fpocketbase-lemonsqueezy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwyndham%2Fpocketbase-lemonsqueezy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwyndham%2Fpocketbase-lemonsqueezy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrwyndham","download_url":"https://codeload.github.com/mrwyndham/pocketbase-lemonsqueezy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwyndham%2Fpocketbase-lemonsqueezy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["lemonsqueezy","pocketbase","saas"],"created_at":"2024-12-08T08:00:41.809Z","updated_at":"2026-03-10T06:33:06.153Z","avatar_url":"https://github.com/mrwyndham.png","language":"JavaScript","funding_links":[],"categories":["Top PocketBase-specific Projects (\u003e100 stars)"],"sub_categories":[],"readme":"# PocketBase LemonSqueezy Integration\n\nThis is a PocketBase plugin that provides integration with the LemonSqueezy API for handling subscriptions, checkouts, and product synchronization. This is a front end agnostic hook that you can use 100% with any SaaS application. If there are any issues please feel free to reach out to me on X - @meinbiz\n\nAlso if you want to build a next.js front end for your next app. Consider fastpocket.dev it is the fastest way to build a fully fledged PocketBase app.\n\n## Features\n\n- Webhook handling for LemonSqueezy events (subscriptions created, cancelled, payments)\n- Customer portal integration\n- Checkout session creation\n- Automatic product/variant/subscription synchronization via cron job\n- Manual synchronization endpoint\n- Customer management and linking with PocketBase users\n\n## Prerequisites\n\nBefore using this code, ensure you have:\n\n1. A LemonSqueezy account with API access\n2. PocketBase installed and running\n3. The following collections schema imported (create `pb_schema.json`):\n   - customer\n   - subscription\n   - product\n   - variant\n\n**Note:** If you are using a version of PocketBase earlier than 23, you need to use the `-legacy` files for compatibility.\n\n## Setup\n\n### 1. PocketBase Configuration\n\nFirst, you'll need to set up PocketBase hooks. Follow these steps:\n\n1. Create a new JavaScript file (e.g., `pb_hooks/main.pb.js`)\n2. Copy the provided code into this file\n3. Restart your PocketBase server to load the hooks\n\nFor more details on setting up PocketBase hooks, refer to the [official PocketBase Hooks documentation](https://pocketbase.io/docs/js-overview/).\n\n### 2. LemonSqueezy Configuration\n\n1. Replace the webhook signing secret:\n   ```javascript\n   const secret = \"your_lemonsqueezy_signing_secret_here\";\n   ```\n\n2. Replace the API key in all relevant functions:\n   ```javascript\n   const apiKey = \"your_api_key_here\";\n   ```\n\n3. Update your store ID in the `/create-checkout-session` endpoint:\n   ```javascript\n   \"id\": \"your_store_id\" // Update this in the store relationship object\n   ```\n\n## Available Endpoints\n\n### Webhooks\n- `POST /lemonsqueezy` - Handles LemonSqueezy webhook events\n  - Processes subscription events (created, cancelled, payment success)\n  - Automatically updates local database records\n\n### Customer Management\n- `POST /create-checkout-session` - Creates a new checkout session\n  - Requires authenticated user\n  - Automatically creates/links LemonSqueezy customer\n  - Returns checkout URL\n\n- `POST /create-portal-link` - Generates customer portal link\n  - Requires authenticated user\n  - Returns URL to LemonSqueezy customer portal\n\n### Synchronization\n- `GET /manual-lemonsqueezy-synchronization` - Manually trigger sync\n  - Syncs products, variants, and subscriptions\n  - Updates local database records\n\n## Automatic Synchronization\n\nThe plugin includes a cron job that runs every 30 minutes to sync data:\nThe cron job automatically:\n\n- Fetches all subscriptions from LemonSqueezy\n- Updates existing subscription records in PocketBase\n- Creates new subscription records if they don't exist\n- Syncs product and variant data\n- Maintains data consistency between LemonSqueezy and PocketBase\n\n### Postman Collection\n\nTo facilitate testing and integration, a Postman collection is included in the project. You can find it at `./pocketbase-lemonsqueezy.postman_collection.json`. This collection contains pre-configured requests for all available endpoints, allowing you to quickly test the API functionality and understand the request/response flow.\n\n## Video Documentation\n\nIf you are struggling - I have setup a [video tutorial](https://www.youtube.com/watch?v=LRQS6PRzvVo) check it out\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrwyndham%2Fpocketbase-lemonsqueezy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrwyndham%2Fpocketbase-lemonsqueezy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrwyndham%2Fpocketbase-lemonsqueezy/lists"}