61 lines
3.3 KiB
Markdown
61 lines
3.3 KiB
Markdown
# Standard subscription plans
|
|
|
|
The default entitlement seed publishes three public standard plans from `@toolctrl/entitlements`: Starter, Pro, and Business. These stubs are safe to commit because they intentionally do not contain Stripe product IDs, Stripe price IDs, customer IDs, tenant IDs, subscription IDs, API keys, or database credentials.
|
|
|
|
## Seed behavior
|
|
|
|
`seedStandardEntitlements` in `@toolctrl/db/entitlements-seed.server` maps each standard plan to the existing Prisma subscription tables:
|
|
|
|
- `SubscriptionProduct.stripeId` is deterministic and local-only: `toolctrl_entitlement_plan_<plan-id>`.
|
|
- Existing products are matched by deterministic `stripeId` or plan title, then updated; missing products are created.
|
|
- Features for each seeded product are replaced on every run, making the helper idempotent for the current plan stub contents.
|
|
- Diagnostics expose only seed phase, plan counts, feature counts, created/updated product counts, deleted/created feature counts, optional plan IDs, and redacted error name/message.
|
|
|
|
The seed does not require live Stripe configuration. Operators can later attach real Stripe products/prices outside these static stubs if their deployment needs Stripe-backed checkout.
|
|
|
|
## Limit type values
|
|
|
|
| Numeric value | Meaning |
|
|
| --- | --- |
|
|
| `0` | Not included |
|
|
| `1` | Included |
|
|
| `2` | Monthly quota |
|
|
| `3` | Maximum concurrent/static limit |
|
|
| `4` | Unlimited |
|
|
|
|
Monthly features are seeded with `accumulate: true`; all other limit types are seeded with `accumulate: false`.
|
|
|
|
## Plan order and features
|
|
|
|
| Order | Plan ID | Public name | Description |
|
|
| --- | --- | --- | --- |
|
|
| 10 | `starter` | Starter | Core access for evaluating the product with small team limits. |
|
|
| 20 | `pro` | Pro | Expanded limits for production teams that need API access. |
|
|
| 30 | `business` | Business | High-volume standard plan with unlimited seats and generation privacy. |
|
|
|
|
Each plan seeds the same feature-key order:
|
|
|
|
| Order | Feature key | Starter | Pro | Business |
|
|
| --- | --- | --- | --- | --- |
|
|
| 10 | `users` | Max `3` users | Max `10` users | Unlimited users |
|
|
| 20 | `api` | Not included | Included | Included |
|
|
| 30 | `rate-limit-per-minute` | Max `60` requests/minute | Max `600` requests/minute | Max `3000` requests/minute |
|
|
| 40 | `rate-limit-per-second` | Max `2` requests/second | Max `10` requests/second | Max `50` requests/second |
|
|
| 50 | `priority-support` | Not included | Included | Included |
|
|
| 60 | `credits` | Monthly `500` credits | Monthly `5000` credits | Monthly `50000` credits |
|
|
| 70 | `private-generations` | Not included | Included | Included |
|
|
|
|
## Feature registry
|
|
|
|
The seed validates every plan feature against the entitlement feature registry before creating the feature row. Unknown feature keys fail the seed and emit a redacted failure diagnostic.
|
|
|
|
| Feature key | Category | Supported limit styles |
|
|
| --- | --- | --- |
|
|
| `users` | Access | Not included, monthly quota, maximum, unlimited |
|
|
| `api` | Access | Not included, included, unlimited |
|
|
| `rate-limit-per-minute` | Usage | Not included, maximum, unlimited |
|
|
| `rate-limit-per-second` | Usage | Not included, maximum, unlimited |
|
|
| `priority-support` | Support | Not included, included, unlimited |
|
|
| `credits` | Usage | Not included, monthly quota, maximum, unlimited |
|
|
| `private-generations` | Generation | Not included, included, unlimited |
|