@lukoweb/apitogo 0.2.46 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +949 -2977
- package/docs/cli/overview.md +91 -91
- package/docs/cli/shape.md +126 -127
- package/docs/configuration/make-config.mdx +96 -124
- package/docs/configuration/manifest.md +129 -128
- package/docs/configuration/navigation.mdx +415 -421
- package/docs/configuration/plans.md +154 -153
- package/docs/guides/custom-pages.md +111 -110
- package/package.json +1 -1
- package/src/config/v2/services.ts +1 -1
|
@@ -1,153 +1,154 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Gateway plans
|
|
3
|
-
sidebar_icon: tags
|
|
4
|
-
description:
|
|
5
|
-
Configure end-user API plans in apitogo.config.json — pricing, rate limits, quotas, and publish
|
|
6
|
-
behavior.
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
**Gateway plans** (also called API plans) are what your **end users** subscribe to.
|
|
10
|
-
|
|
11
|
-
- **`/pricing`** — public catalog. Visitors choose a plan before signup. Signed-in users still see
|
|
12
|
-
this page; it must not redirect to `/account/plans`.
|
|
13
|
-
- **`/account/plans`** — authenticated billing. Sign-in required. Manage and change subscriptions.
|
|
14
|
-
|
|
15
|
-
They are separate from **platform hosting** (Free / Starter / Professional on APItoGo), which you
|
|
16
|
-
select with `npx apitogo deploy --platform-plan`.
|
|
17
|
-
|
|
18
|
-
Store the catalog under `modules.userPanel.plans.items` in `apitogo.config.json`.
|
|
19
|
-
|
|
20
|
-
## Shape with the CLI
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npx apitogo config
|
|
28
|
-
# choose plan → enter title, price, policies → done when finished
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- **`
|
|
69
|
-
- **`
|
|
70
|
-
- **`
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
- **
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
| **
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
- [
|
|
152
|
-
- [
|
|
153
|
-
- [
|
|
1
|
+
---
|
|
2
|
+
title: Gateway plans
|
|
3
|
+
sidebar_icon: tags
|
|
4
|
+
description:
|
|
5
|
+
Configure end-user API plans in apitogo.config.json — pricing, rate limits, quotas, and publish
|
|
6
|
+
behavior.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Gateway plans** (also called API plans) are what your **end users** subscribe to.
|
|
10
|
+
|
|
11
|
+
- **`/pricing`** — public catalog. Visitors choose a plan before signup. Signed-in users still see
|
|
12
|
+
this page; it must not redirect to `/account/plans`.
|
|
13
|
+
- **`/account/plans`** — authenticated billing. Sign-in required. Manage and change subscriptions.
|
|
14
|
+
|
|
15
|
+
They are separate from **platform hosting** (Free / Starter / Professional on APItoGo), which you
|
|
16
|
+
select with `npx apitogo deploy --platform-plan`.
|
|
17
|
+
|
|
18
|
+
Store the catalog under `modules.userPanel.plans.items` in `apitogo.config.json`.
|
|
19
|
+
|
|
20
|
+
## Shape with the CLI
|
|
21
|
+
|
|
22
|
+
In a config version 2 project, plans live in `apitogo/plans.json`. `npx apitogo config` adds them
|
|
23
|
+
interactively (title, price, rate limit, monthly quota) or with `--plan`. A plan with the same `sku`
|
|
24
|
+
is replaced.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx apitogo config
|
|
28
|
+
# choose plan → enter title, price, policies → done when finished
|
|
29
|
+
npx apitogo config --plan '{"sku":"free","displayName":"Free"}'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Canonical shape
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"modules": {
|
|
37
|
+
"userPanel": {
|
|
38
|
+
"plans": {
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"items": [
|
|
41
|
+
{
|
|
42
|
+
"sku": "free",
|
|
43
|
+
"displayName": "Free",
|
|
44
|
+
"priceAmount": 0,
|
|
45
|
+
"limits": {
|
|
46
|
+
"rateLimit": { "calls": 100, "renewalPeriodSeconds": 60 },
|
|
47
|
+
"quota": { "calls": 50000, "renewalPeriodDays": 30 }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"sku": "pro",
|
|
52
|
+
"displayName": "Pro",
|
|
53
|
+
"priceAmount": 29,
|
|
54
|
+
"priceCurrency": "usd",
|
|
55
|
+
"billingPeriod": "month",
|
|
56
|
+
"limits": {
|
|
57
|
+
"rateLimit": { "calls": 1000, "renewalPeriodSeconds": 60 },
|
|
58
|
+
"quota": { "calls": 500000, "renewalPeriodDays": 30 }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **`sku`** — stable identifier (used in checkout URLs and gateway sync).
|
|
69
|
+
- **`displayName`** — label on `/pricing`.
|
|
70
|
+
- **`priceAmount`** — `0` for free tiers; greater than zero for paid plans (USD by default).
|
|
71
|
+
- **`pricingModel`** — `fixed` (default) or `custom`. See
|
|
72
|
+
[Custom pricing](#custom-pricing-contact-sales).
|
|
73
|
+
- **`priceLabel`** — optional text shown instead of the price, such as `"Let's talk"` (max 64
|
|
74
|
+
characters).
|
|
75
|
+
- **`limits`** — rate limit and quota policies (see below). Encoded `limitsJson` strings are still
|
|
76
|
+
accepted on load.
|
|
77
|
+
|
|
78
|
+
Enable the catalog with `modules.userPanel.plans.enabled: true`. Legacy root `plans` is migrated on
|
|
79
|
+
load.
|
|
80
|
+
|
|
81
|
+
## limits schema
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"rateLimit": { "calls": 100, "renewalPeriodSeconds": 60 },
|
|
86
|
+
"quota": { "calls": 50000, "renewalPeriodDays": 30 }
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **rateLimit** — maximum calls per renewal window (per minute when `renewalPeriodSeconds` is 60).
|
|
91
|
+
- **quota** — longer-window cap (per 30 days when `renewalPeriodDays` is 30).
|
|
92
|
+
|
|
93
|
+
New plans include **all** discovered OpenAPI operations unless you set `includedActionKeys`. After
|
|
94
|
+
OpenAPI is deployed, you can scope a plan to specific operations with `includedActionKeys` (for
|
|
95
|
+
example `get:/orders/{id}`). Edit those fields in `apitogo.config.json` — see
|
|
96
|
+
[Manifest](./manifest.md).
|
|
97
|
+
|
|
98
|
+
## Custom pricing (contact sales)
|
|
99
|
+
|
|
100
|
+
Set `pricingModel: "custom"` for plans with negotiated prices, such as an Enterprise tier. Leave
|
|
101
|
+
`priceAmount` at `0` or omit it.
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"sku": "enterprise",
|
|
106
|
+
"displayName": "Enterprise",
|
|
107
|
+
"pricingModel": "custom",
|
|
108
|
+
"priceLabel": "Let's talk"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
On `/pricing`, custom plans show `priceLabel` (or **Custom**) and a **Contact sales** button. The
|
|
113
|
+
button opens a public `/contact-sales` form instead of Stripe checkout or registration. Visitors
|
|
114
|
+
don't need an account.
|
|
115
|
+
|
|
116
|
+
Each submission is emailed to the project's **sales contact email**, or to the project owner's email
|
|
117
|
+
when none is set. Custom plans can't be subscribed to through checkout. Custom plans are available
|
|
118
|
+
on every platform plan, including Free.
|
|
119
|
+
|
|
120
|
+
## Publish
|
|
121
|
+
|
|
122
|
+
Gateway plans are applied when you run:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npx apitogo deploy
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`npx apitogo deploy` syncs plans from the manifest to the platform gateway. Paid plans require
|
|
129
|
+
Stripe secrets in `.env` before publish — see [Go live with CLI](../cli/go-live.md).
|
|
130
|
+
|
|
131
|
+
## Platform hosting vs gateway plans
|
|
132
|
+
|
|
133
|
+
| Kind | What it is | How |
|
|
134
|
+
| ----------------------- | ---------------------------------------------- | ------------------------------------ |
|
|
135
|
+
| **Platform hosting** | APItoGo bill for hosting your portal + API hub | `npx apitogo deploy --platform-plan` |
|
|
136
|
+
| **Gateway / API plans** | What your customers pay for API access | `modules.userPanel.plans.items` |
|
|
137
|
+
|
|
138
|
+
### Free platform limitations
|
|
139
|
+
|
|
140
|
+
The **Free** platform plan cannot:
|
|
141
|
+
|
|
142
|
+
- Publish **paid** gateway plans (`priceAmount > 0`)
|
|
143
|
+
- Attach a **custom domain** to the dev portal
|
|
144
|
+
|
|
145
|
+
Use **Starter** or **Professional** for paid API tiers, Stripe checkout, and custom domains. If your
|
|
146
|
+
manifest has paid plans and you try `npx apitogo deploy --platform-plan free`, deploy is blocked
|
|
147
|
+
until you upgrade or zero/remove those paid plans.
|
|
148
|
+
|
|
149
|
+
## Related
|
|
150
|
+
|
|
151
|
+
- [Manifest](./manifest.md)
|
|
152
|
+
- [Make config (CLI)](./make-config.mdx)
|
|
153
|
+
- [Authentication](./authentication.md)
|
|
154
|
+
- [Go live with CLI](../cli/go-live.md)
|
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Custom pages
|
|
3
|
-
sidebar_icon: layers-3
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
If you want to include pages in your documentation that have greater flexibility than MDX pages, it
|
|
7
|
-
is possible to include custom pages of your own.
|
|
8
|
-
|
|
9
|
-
These pages are typically built using standard React markup and can borrow from a set of prebuilt
|
|
10
|
-
components that APIToGo already has such as buttons, links and headers.
|
|
11
|
-
|
|
12
|
-
Start by creating the page you want to add.
|
|
13
|
-
|
|
14
|
-
## CLI scaffold
|
|
15
|
-
|
|
16
|
-
`npx apitogo config` can create a starter page
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Custom pages
|
|
3
|
+
sidebar_icon: layers-3
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
If you want to include pages in your documentation that have greater flexibility than MDX pages, it
|
|
7
|
+
is possible to include custom pages of your own.
|
|
8
|
+
|
|
9
|
+
These pages are typically built using standard React markup and can borrow from a set of prebuilt
|
|
10
|
+
components that APIToGo already has such as buttons, links and headers.
|
|
11
|
+
|
|
12
|
+
Start by creating the page you want to add.
|
|
13
|
+
|
|
14
|
+
## CLI scaffold
|
|
15
|
+
|
|
16
|
+
`npx apitogo config` can create a starter Markdown page at `apitogo/portal/pages/<slug>.mdx`. Choose
|
|
17
|
+
`page` in the wizard loop, or pass `--page-slug` and `--page-title`. The sidebar is built from the
|
|
18
|
+
pages folder, so no navigation entry is needed.
|
|
19
|
+
|
|
20
|
+
Predefined UI components (Callout, Card, Button, Heading, and more) are documented under
|
|
21
|
+
[/docs/components](/docs/components).
|
|
22
|
+
|
|
23
|
+
## Setup a custom page
|
|
24
|
+
|
|
25
|
+
Each custom page is a page component of its own and lives in a `src` directory at the root of your
|
|
26
|
+
project. Let's create the `<MyCustomPage />` component as an example.
|
|
27
|
+
|
|
28
|
+
From the root of your project run this command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
touch src/MyCustomPage.tsx
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can now open `/src/MyCustomPage.tsx` in the editor of your choice. It will be empty.
|
|
35
|
+
|
|
36
|
+
Copy and paste this code to implement the page:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Button, Head, Link } from "@lukoweb/apitogo/components";
|
|
40
|
+
|
|
41
|
+
export const MyCustomPage = () => {
|
|
42
|
+
return (
|
|
43
|
+
<section className="">
|
|
44
|
+
<Head>
|
|
45
|
+
<title>My Custom Page</title>
|
|
46
|
+
</Head>
|
|
47
|
+
<div>
|
|
48
|
+
<p>Welcome to MyCustomPage</p>
|
|
49
|
+
</div>
|
|
50
|
+
</section>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
In the [APIToGo Configuration](../configuration/overview.md) you will need to do the following:
|
|
58
|
+
|
|
59
|
+
### Config that embeds JSX
|
|
60
|
+
|
|
61
|
+
If you embed React components in config (for example custom pages), use a JSX-capable config module
|
|
62
|
+
and import your page component from there.
|
|
63
|
+
|
|
64
|
+
### Import Your Module
|
|
65
|
+
|
|
66
|
+
Import the `<MyCustomPage />` component that you created.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { MyCustomPage } from "./src/MyCustomPage";
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Add a navigation entry
|
|
73
|
+
|
|
74
|
+
Add a `custom-page` item to the `navigation` configuration. Each page you want to add to the site
|
|
75
|
+
must be its own object.
|
|
76
|
+
|
|
77
|
+
The `path` key can be set to whatever you like. This will appear as part of the URL in the address
|
|
78
|
+
bar of the browser.
|
|
79
|
+
|
|
80
|
+
The `element` key references the name of the custom page component that you want to load.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
{
|
|
84
|
+
// ...
|
|
85
|
+
navigation: [
|
|
86
|
+
{
|
|
87
|
+
type: "custom-page",
|
|
88
|
+
path: "/a-custom-page",
|
|
89
|
+
element: <MyCustomPage />,
|
|
90
|
+
},
|
|
91
|
+
]
|
|
92
|
+
// ...
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This configuration will allow APIToGo to load the contents of the `<MyCustomPage />` component when
|
|
97
|
+
a user clicks on a link that points to `/a-custom-page`.
|
|
98
|
+
|
|
99
|
+
## Troubleshooting
|
|
100
|
+
|
|
101
|
+
### Updating Your `tsconfig.json`
|
|
102
|
+
|
|
103
|
+
Your `include` property in `tsconfig.json` should automatically be updated to reflect the new custom
|
|
104
|
+
pages, but in case it isn't, it should look like this:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
...
|
|
109
|
+
"include": ["src", "src/MyCustomPage.tsx"]
|
|
110
|
+
}
|
|
111
|
+
```
|
package/package.json
CHANGED
|
@@ -981,7 +981,7 @@ export async function planRemoveService(
|
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
/** Replaces the config file atomically: a failure leaves the old file in place. */
|
|
984
|
-
async function writeConfig(
|
|
984
|
+
export async function writeConfig(
|
|
985
985
|
configPath: string,
|
|
986
986
|
config: ConfigV2,
|
|
987
987
|
): Promise<void> {
|