{"_id":"emdash-lms","name":"emdash-lms","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"emdash-lms","version":"0.1.0","description":"EmDash LMS — Subscriptions & Memberships plugin for EmDash CMS","author":{"name":"Tô Triều","email":"hello@totrieu.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/tohaitrieu/emdash-lms.git"},"homepage":"https://github.com/tohaitrieu/emdash-lms#readme","bugs":{"url":"https://github.com/tohaitrieu/emdash-lms/issues"},"keywords":["emdash","cms","lms","learning-management","membership","subscriptions","courses","astro","headless-cms","education","e-learning"],"type":"module","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./admin":{"types":"./dist/admin.d.mts","import":"./dist/admin.mjs"},"./seed.json":"./seed/seed.json","./seed/membership.json":"./seed/membership.json","./seed/courses.json":"./seed/courses.json"},"scripts":{"build":"tsdown src/index.ts src/admin.tsx --format esm --dts","dev":"tsdown src/index.ts src/admin.tsx --format esm --dts --watch","prepublishOnly":"pnpm build"},"dependencies":{},"optionalDependencies":{"stripe":"^17.0.0"},"devDependencies":{"@phosphor-icons/react":"^2.1.7","@tanstack/react-query":"^5.62.0","@types/react":"^18.3.18","react":"^18.3.1","tsdown":"^0.20.3","typescript":"^5.7.2"},"peerDependencies":{"emdash":">=0.1.0","react":"^18 || ^19"},"_id":"emdash-lms@0.1.0","_nodeVersion":"22.15.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-FyaJc5vlPFfDBcc2v3KMUKl7LS+kx6LD4KYkw43eH6E5XJFbqEj6318AT9Hhvqcr0y8vd8mO9euatw3jRwNmHQ==","shasum":"6fab3b58af552813701a7555e86b910c03d25535","tarball":"https://registry.npmjs.org/emdash-lms/-/emdash-lms-0.1.0.tgz","fileCount":16,"unpackedSize":950070,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICdhj5ffWTGHgkYUbDbtlEJvSXThxfBKIfjd+Zgoa1YEAiEAtVZHYmprBkC6OVHEdyQ7RyFV4OfY8epSqUKwyRqIYeQ="}]},"_npmUser":{"name":"tohaitrieu","email":"contact@tohaitrieu.net"},"directories":{},"maintainers":[{"name":"tohaitrieu","email":"contact@tohaitrieu.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-lms_0.1.0_1775389198441_0.2577015297152945"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-05T11:39:58.362Z","0.1.0":"2026-04-05T11:39:58.714Z","modified":"2026-04-05T11:39:58.920Z"},"maintainers":[{"name":"tohaitrieu","email":"contact@tohaitrieu.net"}],"description":"EmDash LMS — Subscriptions & Memberships plugin for EmDash CMS","homepage":"https://github.com/tohaitrieu/emdash-lms#readme","keywords":["emdash","cms","lms","learning-management","membership","subscriptions","courses","astro","headless-cms","education","e-learning"],"repository":{"type":"git","url":"git+https://github.com/tohaitrieu/emdash-lms.git"},"author":{"name":"Tô Triều","email":"hello@totrieu.com"},"bugs":{"url":"https://github.com/tohaitrieu/emdash-lms/issues"},"license":"MIT","readme":"# EmDash LMS\n\n[![npm version](https://img.shields.io/npm/v/emdash-lms.svg)](https://www.npmjs.com/package/emdash-lms)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA unified Learning Management System plugin for [EmDash CMS](https://emdashcms.com). Build membership sites, online courses, or complete e-learning platforms.\n\n## Features\n\n- **3 Modes**: Membership-only, LMS-only, or Full (combined)\n- **Membership Plans**: Subscription tiers with billing periods and access limits\n- **Course Management**: Courses with lessons, progress tracking, and certificates\n- **Access Control**: Membership-gated or individually purchasable courses\n- **Simple Checkout**: Built-in payment processing with multiple providers\n- **Payment Providers**: Stripe, Sepay (Vietnam), with extensible adapter pattern\n\n## Installation\n\n```bash\npnpm add emdash-lms\n```\n\n## Usage\n\n```typescript\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport emdash from \"emdash/astro\";\nimport { lmsPlugin } from \"emdash-lms\";\n\nexport default defineConfig({\n  integrations: [\n    emdash({\n      plugins: [\n        lmsPlugin({\n          mode: \"full\", // \"membership\" | \"lms\" | \"full\"\n          currency: { base: \"USD\" },\n          checkout: {\n            enabled: true,\n            providers: [\"stripe\", \"sepay\"],\n          },\n        }),\n      ],\n    }),\n  ],\n});\n```\n\n## Configuration\n\n### Plugin Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `mode` | `\"membership\" \\| \"lms\" \\| \"full\"` | `\"full\"` | Plugin mode |\n| `membership.enabled` | `boolean` | Based on mode | Enable membership features |\n| `courses.enabled` | `boolean` | Based on mode | Enable course features |\n| `courses.individualPurchase` | `boolean` | `true` | Allow buying courses individually |\n| `checkout.enabled` | `boolean` | `true` | Enable built-in checkout |\n| `checkout.providers` | `string[]` | `[]` | Payment providers to enable |\n| `currency.base` | `string` | `\"USD\"` | Base currency code (ISO 4217) |\n\n### Seed Data\n\nCopy the appropriate seed file to bootstrap your LMS:\n\n```bash\n# Full mode (membership + courses)\ncp node_modules/emdash-lms/seed/seed.json .emdash/seed.json\n\n# Membership only\ncp node_modules/emdash-lms/seed/membership.json .emdash/seed.json\n\n# Courses only\ncp node_modules/emdash-lms/seed/courses.json .emdash/seed.json\n```\n\n## Admin Pages\n\n| Page | Path | Description |\n|------|------|-------------|\n| Plans | `/plans` | Manage membership plans and pricing |\n| Members | `/members` | View active memberships |\n| Courses | `/courses` | Manage courses (via EmDash collections) |\n| Students | `/students` | Track enrollments and progress |\n| Orders | `/orders` | View purchase history |\n| Settings | `/settings` | Configure LMS and payment providers |\n\n## API Routes\n\nAll routes are prefixed with `/_emdash/api/plugins/lms/`\n\n| Route | Description |\n|-------|-------------|\n| `plans` | CRUD operations for membership plans |\n| `members` | Manage user memberships |\n| `orders` | Order management |\n| `checkout` | Create and verify checkout sessions |\n| `access` | Check user access to courses/lessons |\n| `webhook/:providerId` | Payment provider webhooks |\n\n## Access Control\n\nThe plugin determines course access based on:\n\n1. **Free courses** - Always accessible\n2. **Membership courses** - Requires active membership with appropriate plan\n3. **Purchase courses** - Requires individual purchase\n4. **Preview lessons** - Always accessible regardless of access level\n\n```typescript\nimport { checkCourseAccess } from \"emdash-lms\";\n\nconst result = checkCourseAccess(course, userAccess, plans);\n// { allowed: true, reason: \"membership\" }\n// { allowed: false, deniedReason: \"no_membership\" }\n```\n\n## Payment Providers\n\n### Stripe\n\n```typescript\nlmsPlugin({\n  checkout: {\n    providers: [\"stripe\"],\n  },\n});\n```\n\nRequired settings in admin:\n- `test_secret_key` / `live_secret_key`\n- `webhook_secret`\n- `success_url` / `cancel_url`\n\n### Sepay (Vietnam)\n\n```typescript\nlmsPlugin({\n  checkout: {\n    providers: [\"sepay\"],\n  },\n});\n```\n\nRequired settings:\n- `api_key`\n- `checkout_page_url`\n- `webhook_secret` (optional)\n\n### Custom Provider\n\n```typescript\nimport { registerProvider } from \"emdash-lms\";\n\nregisterProvider({\n  id: \"my-provider\",\n  name: \"My Payment Provider\",\n  async createCheckout(order, config) {\n    // Return { id, url, expires_at }\n  },\n  async handleWebhook(payload, headers, config) {\n    // Return { event, orderId?, status? }\n  },\n  async verifyPayment(paymentId, config) {\n    // Return { paid, status }\n  },\n});\n```\n\n## Development\n\n```bash\n# Install dependencies\npnpm install\n\n# Build\npnpm build\n\n# Watch mode\npnpm dev\n```\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n## Related\n\n- [EmDash CMS](https://emdashcms.com) - The headless CMS this plugin extends\n- [emdash](https://www.npmjs.com/package/emdash) - Core EmDash package\n\n## License\n\nMIT © [Tô Triều](https://totrieu.com)\n","readmeFilename":"README.md","_rev":"1-16dfd123ee08393c710d7a2cfc50da37"}