@lukoweb/apitogo 0.2.54 → 0.2.57
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 +2196 -1352
- package/dist/declarations/cli/platform/client/platform-api.d.ts +29 -0
- package/dist/declarations/cli/platform/helpers/platform-plan-catalog.d.ts +6 -0
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -0
- package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
- package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -1
- package/dist/flat-config.d.ts +1 -0
- package/docs/cli/commands.md +50 -32
- package/docs/cli/go-live.md +66 -93
- package/docs/cli/overview.md +18 -17
- package/docs/cli/setup.md +130 -141
- package/docs/cli/shape.md +94 -11
- package/docs/cli/walkthrough.md +1 -1
- package/docs/components/slot.mdx +116 -119
- package/docs/configuration/api-reference.md +98 -397
- package/docs/configuration/authentication.md +118 -159
- package/docs/configuration/footer.mdx +89 -118
- package/docs/configuration/make-config.mdx +2 -2
- package/docs/configuration/overview.md +97 -166
- package/docs/configuration/plans.md +100 -110
- package/docs/configuration/portal.md +116 -0
- package/docs/customization/colors-theme.mdx +255 -278
- package/docs/customization/fonts.md +105 -110
- package/docs/customization/landing-page.md +189 -188
- package/docs/deploy/apitogo.md +13 -17
- package/docs/deployment.md +15 -9
- package/docs/guides/stripe-setup.mdx +123 -0
- package/docs/markdown/frontmatter.md +172 -173
- package/docs/mcp/go-live.md +100 -100
- package/docs/mcp/overview.md +76 -76
- package/docs/quickstart.md +88 -72
- package/docs/writing.mdx +68 -72
- package/package.json +1 -1
- package/src/config/v2/docs-navigation.ts +7 -2
- package/src/config/v2/index.ts +1 -0
- package/src/config/v2/resolve.ts +28 -0
- package/src/config/v2/rules.ts +32 -1
- package/src/config/v2/schema.ts +9 -0
- package/src/config/v2/services.ts +90 -15
- package/src/config/v2/starter-landing.ts +41 -0
- package/src/config/v2/wrapper.ts +141 -7
- package/src/config/validators/ZudokuConfig.ts +794 -792
- package/src/lib/authentication/providers/openid.tsx +6 -1
- package/src/lib/plugins/markdown/index.tsx +86 -82
- package/src/vite/dev-server.ts +9 -1
- package/src/vite/dev-ssr-config.ts +32 -0
- package/src/vite/plugin-config.ts +4 -2
- package/src/vite/plugin-docs.ts +213 -205
- package/docs/concepts/auth-provider-api-identities.md +0 -105
- package/docs/configuration/ai-assistants.md +0 -65
- package/docs/configuration/api-catalog.md +0 -109
- package/docs/configuration/authentication-auth0.md +0 -181
- package/docs/configuration/authentication-azure-ad.md +0 -245
- package/docs/configuration/authentication-clerk.md +0 -117
- package/docs/configuration/authentication-firebase.md +0 -69
- package/docs/configuration/authentication-pingfederate.md +0 -143
- package/docs/configuration/authentication-supabase.md +0 -233
- package/docs/configuration/build-configuration.mdx +0 -147
- package/docs/configuration/docs.md +0 -282
- package/docs/configuration/llms.md +0 -90
- package/docs/configuration/manifest.md +0 -129
- package/docs/configuration/navigation.mdx +0 -415
- package/docs/configuration/protected-routes.md +0 -150
- package/docs/configuration/search.md +0 -164
- package/docs/configuration/sentry.mdx +0 -44
- package/docs/configuration/site.md +0 -124
- package/docs/configuration/slots.mdx +0 -125
- package/docs/configuration/vite-config.md +0 -18
- package/docs/custom-plugins.md +0 -285
- package/docs/deploy/apache-nginx.md +0 -41
- package/docs/deploy/cloudflare-pages.md +0 -74
- package/docs/deploy/direct-upload.md +0 -17
- package/docs/deploy/github-pages.md +0 -49
- package/docs/deploy/vercel.md +0 -101
- package/docs/extending/events.md +0 -124
- package/docs/guides/environment-variables.md +0 -94
- package/docs/guides/managing-api-keys-and-identities.md +0 -89
- package/docs/guides/navigation-rules.mdx +0 -203
- package/docs/guides/processors.mdx +0 -234
- package/docs/guides/transforming-examples.md +0 -156
- package/docs/guides/using-multiple-apis.md +0 -87
- package/docs/plugins.md +0 -24
package/docs/cli/setup.md
CHANGED
|
@@ -1,141 +1,130 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Install the CLI
|
|
3
|
-
description:
|
|
4
|
-
Install and invoke the APItoGo CLI to scaffold, configure, preview, and publish developer portals.
|
|
5
|
-
sidebar_icon: terminal
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Use the **`apitogo`** CLI (`@lukoweb/apitogo`) to scaffold a local portal, shape
|
|
9
|
-
`apitogo.config.json`, preview with `npx apitogo run`, and publish with `npx apitogo deploy`.
|
|
10
|
-
Platform commands (`deploy`, `status`, `teardown`) use the same engine as MCP `publish_dev_portal`.
|
|
11
|
-
|
|
12
|
-
Examples in these docs use **`npx apitogo`** so they run the project-local CLI. A global install is
|
|
13
|
-
optional and not required.
|
|
14
|
-
|
|
15
|
-
## Prerequisites
|
|
16
|
-
|
|
17
|
-
- **Node.js 20+**
|
|
18
|
-
- Platform API credentials from [apitogo.com](https://apitogo.com) when you run `npx apitogo deploy`
|
|
19
|
-
(API key id + secret)
|
|
20
|
-
|
|
21
|
-
## Install
|
|
22
|
-
|
|
23
|
-
The CLI is the npm package **`@lukoweb/apitogo`**. It exposes the **`apitogo`** binary. Scaffold
|
|
24
|
-
commands add it to your project and `npm install` puts it on `node_modules/.bin`. Invoke it with
|
|
25
|
-
`npx apitogo`.
|
|
26
|
-
|
|
27
|
-
### New project (recommended)
|
|
28
|
-
|
|
29
|
-
`npx @lukoweb/apitogo@latest init` creates a config version 2 project in the current folder. It
|
|
30
|
-
shows what it will create and asks first (pass `--yes` to skip the question), writes
|
|
31
|
-
`apitogo.config.json`, uses an existing `docs/` folder in place, and, in a new folder, creates
|
|
32
|
-
`package.json` and installs `@lukoweb/apitogo`, `react` and `react-dom`:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
mkdir my-portal && cd my-portal
|
|
36
|
-
npx @lukoweb/apitogo@latest init --name "Books API"
|
|
37
|
-
npx apitogo run
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
In an existing project the tool never edits your `package.json`. It prints the install command to
|
|
41
|
-
run instead.
|
|
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
|
-
```bash
|
|
133
|
-
npx apitogo status
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Next
|
|
137
|
-
|
|
138
|
-
- [CLI overview](./overview.md)
|
|
139
|
-
- [Shape](./shape.md) — scaffold and local preview
|
|
140
|
-
- [Go live](./go-live.md) — `npx apitogo deploy`
|
|
141
|
-
- [Commands](./commands.md) — full catalog
|
|
1
|
+
---
|
|
2
|
+
title: Install the CLI
|
|
3
|
+
description:
|
|
4
|
+
Install and invoke the APItoGo CLI to scaffold, configure, preview, and publish developer portals.
|
|
5
|
+
sidebar_icon: terminal
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use the **`apitogo`** CLI (`@lukoweb/apitogo`) to scaffold a local portal, shape
|
|
9
|
+
`apitogo.config.json`, preview with `npx apitogo run`, and publish with `npx apitogo deploy`.
|
|
10
|
+
Platform commands (`deploy`, `status`, `teardown`) use the same engine as MCP `publish_dev_portal`.
|
|
11
|
+
|
|
12
|
+
Examples in these docs use **`npx apitogo`** so they run the project-local CLI. A global install is
|
|
13
|
+
optional and not required.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js 20+**
|
|
18
|
+
- Platform API credentials from [apitogo.com](https://apitogo.com) when you run `npx apitogo deploy`
|
|
19
|
+
(API key id + secret)
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
The CLI is the npm package **`@lukoweb/apitogo`**. It exposes the **`apitogo`** binary. Scaffold
|
|
24
|
+
commands add it to your project and `npm install` puts it on `node_modules/.bin`. Invoke it with
|
|
25
|
+
`npx apitogo`.
|
|
26
|
+
|
|
27
|
+
### New project (recommended)
|
|
28
|
+
|
|
29
|
+
`npx @lukoweb/apitogo@latest init` creates a config version 2 project in the current folder. It
|
|
30
|
+
shows what it will create and asks first (pass `--yes` to skip the question), writes
|
|
31
|
+
`apitogo.config.json`, uses an existing `docs/` folder in place, and, in a new folder, creates
|
|
32
|
+
`package.json` and installs `@lukoweb/apitogo`, `react` and `react-dom`:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mkdir my-portal && cd my-portal
|
|
36
|
+
npx @lukoweb/apitogo@latest init --name "Books API"
|
|
37
|
+
npx apitogo run
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
In an existing project the tool never edits your `package.json`. It prints the install command to
|
|
41
|
+
run instead.
|
|
42
|
+
|
|
43
|
+
Named folder or site name:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx @lukoweb/apitogo@latest init ./my-portal --name "Books API"
|
|
47
|
+
cd ./my-portal
|
|
48
|
+
npx apitogo run
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### Scaffold options
|
|
52
|
+
|
|
53
|
+
| Flag | Effect |
|
|
54
|
+
| ----------------- | --------------------------------------------- |
|
|
55
|
+
| `[dir]` | Target folder (default: the current folder) |
|
|
56
|
+
| `--name <string>` | Project name (default: the folder's name) |
|
|
57
|
+
| `--yes` | Do not ask for confirmation |
|
|
58
|
+
| `--dry-run` | Show what would be created, and write nothing |
|
|
59
|
+
| `--force` | Replace an existing `apitogo.config.json` |
|
|
60
|
+
| `--json` | Print a JSON result payload on stdout |
|
|
61
|
+
|
|
62
|
+
`npx @lukoweb/apitogo init` is local only — it does not call the platform. After `config`, run
|
|
63
|
+
`npx apitogo run` to preview, then `npx apitogo deploy` when ready to go live.
|
|
64
|
+
|
|
65
|
+
### How to run `apitogo`
|
|
66
|
+
|
|
67
|
+
| Situation | Command |
|
|
68
|
+
| --------------------------------------------------------- | --------------------------------------------------- |
|
|
69
|
+
| After `init` or `npm install` in the project | `npx apitogo <command>` (e.g. `npx apitogo config`) |
|
|
70
|
+
| One-off, no project yet | `npx @lukoweb/apitogo <command>` |
|
|
71
|
+
| After [optional global install](#optional-global-install) | `apitogo <command>` anywhere |
|
|
72
|
+
|
|
73
|
+
`npm run dev` / `npm run build` use the project-local CLI via `package.json` scripts — no global
|
|
74
|
+
install required.
|
|
75
|
+
|
|
76
|
+
### Optional global install
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install -g @lukoweb/apitogo
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then run `apitogo` from any directory:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
apitogo --help
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Upgrade later with `npm install -g @lukoweb/apitogo@latest`. Uninstall with
|
|
89
|
+
`npm uninstall -g @lukoweb/apitogo`. Prefer `npx apitogo` in projects so each site uses the version
|
|
90
|
+
in its `package.json`.
|
|
91
|
+
|
|
92
|
+
## Platform credentials
|
|
93
|
+
|
|
94
|
+
Export these before `npx apitogo deploy`, `npx apitogo status`, or `npx apitogo teardown`:
|
|
95
|
+
|
|
96
|
+
| Variable | Required | Purpose |
|
|
97
|
+
| -------------------- | -------- | ----------------- |
|
|
98
|
+
| `APITOGO_API_KEY_ID` | Yes | Platform API auth |
|
|
99
|
+
| `APITOGO_API_SECRET` | Yes | Platform API auth |
|
|
100
|
+
|
|
101
|
+
Optional:
|
|
102
|
+
|
|
103
|
+
| Variable | Purpose |
|
|
104
|
+
| ------------------ | ---------------------------------------------------------- |
|
|
105
|
+
| `APITOGO_API_URL` | Override platform API base URL |
|
|
106
|
+
| `APITOGO_CLI_PATH` | Local `@lukoweb/apitogo` / doc-tool checkout for MCP spawn |
|
|
107
|
+
|
|
108
|
+
Never commit secrets. Secrets such as the Stripe key are project secrets: deploy asks for them, and
|
|
109
|
+
`npx apitogo secrets set <NAME>` changes them. See [Go live](./go-live.md).
|
|
110
|
+
|
|
111
|
+
## Verify
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx apitogo --help
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
You should see `init`, `config`, `run`, `build`, `deploy`, `status`, and `teardown`.
|
|
118
|
+
|
|
119
|
+
With credentials set:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npx apitogo status
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Next
|
|
126
|
+
|
|
127
|
+
- [CLI overview](./overview.md)
|
|
128
|
+
- [Shape](./shape.md) — scaffold and local preview
|
|
129
|
+
- [Go live](./go-live.md) — `npx apitogo deploy`
|
|
130
|
+
- [Commands](./commands.md) — full catalog
|
package/docs/cli/shape.md
CHANGED
|
@@ -13,13 +13,12 @@ Requires the **`apitogo`** CLI (`@lukoweb/apitogo`). If you have not installed i
|
|
|
13
13
|
|
|
14
14
|
## Happy path
|
|
15
15
|
|
|
16
|
-
`npx @lukoweb/apitogo@latest init`
|
|
17
|
-
|
|
18
|
-
`npx`:
|
|
16
|
+
`npx @lukoweb/apitogo@latest init` creates a project in the current folder: it writes
|
|
17
|
+
`apitogo.config.json`, uses an existing `docs/` folder, and installs the CLI. Then shape it with
|
|
18
|
+
`npx apitogo config`:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npx @lukoweb/apitogo@latest init
|
|
22
|
-
cd dev-portal
|
|
23
22
|
npx apitogo config # backend, OpenAPI, pages, plans (apply each immediately)
|
|
24
23
|
npx apitogo run # http://localhost:3000
|
|
25
24
|
```
|
|
@@ -52,8 +51,9 @@ Fonts and colors are **not** prompted. See [Colors & theme](../customization/col
|
|
|
52
51
|
|
|
53
52
|
**Paid plans:** payments go through Stripe. Once a plan has a price, `npx apitogo deploy` asks for
|
|
54
53
|
your Stripe secret key (if the project has none yet) and stores it as a project secret. Free and
|
|
55
|
-
contact-us plans need no key.
|
|
56
|
-
|
|
54
|
+
contact-us plans need no key. [Set up Stripe for paid plans](../guides/stripe-setup.mdx) shows where
|
|
55
|
+
to find the key and how to add the webhook, with pictures. Paid plans also need **Starter** or
|
|
56
|
+
**Professional** platform hosting; **Free** cannot publish paid gateway plans or custom domains.
|
|
57
57
|
|
|
58
58
|
Full reference: [Make config (CLI)](../configuration/make-config.mdx) ·
|
|
59
59
|
[Gateway plans](../configuration/plans.md)
|
|
@@ -88,12 +88,95 @@ After `npx apitogo config`, edit the manifest and site files directly:
|
|
|
88
88
|
|
|
89
89
|
- **Services, backend, OpenAPI files** — `apitogo.config.json`
|
|
90
90
|
- **Plans** — `apitogo/plans.json`
|
|
91
|
-
- **Docs pages** — `
|
|
91
|
+
- **Docs pages** — the files `portal.docs.content` names, by default
|
|
92
|
+
`apitogo/portal/pages/**/*.{md,mdx,tsx}` (`.tsx` files are React pages)
|
|
92
93
|
- **Home page** — the file in `portal.landing` (for example
|
|
93
94
|
`apitogo/portal/landing/LandingPage.tsx`)
|
|
95
|
+
- **Footer** — the file in `portal.footer` (for example `apitogo/portal/footer/Footer.tsx`). It is
|
|
96
|
+
shown under every page except the console's (`/account`, `/login`, `/signup`). Remove
|
|
97
|
+
`portal.footer` to have none.
|
|
98
|
+
- **Colors** — `apitogo/portal/theme.json` (or the file in `portal.theme`). See
|
|
99
|
+
[Colors & theme](../customization/colors-theme.mdx).
|
|
100
|
+
- **Logo** — `portal.logo`, an image in `apitogo/portal/public/` or an `https://` address
|
|
101
|
+
|
|
102
|
+
```json title=apitogo.config.json
|
|
103
|
+
{
|
|
104
|
+
"portal": {
|
|
105
|
+
"landing": "apitogo/portal/landing/LandingPage.tsx",
|
|
106
|
+
"footer": "apitogo/portal/footer/Footer.tsx",
|
|
107
|
+
"logo": {
|
|
108
|
+
"light": "apitogo/portal/public/logo.svg",
|
|
109
|
+
"dark": "apitogo/portal/public/logo-dark.svg"
|
|
110
|
+
},
|
|
111
|
+
"docs": { "content": ["apitogo/portal/pages/**/*.{md,mdx}"] }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`"logo": "apitogo/portal/public/logo.svg"` uses one image for both color schemes. Without a logo the
|
|
117
|
+
header shows `portal.name`.
|
|
118
|
+
|
|
119
|
+
### Order of the docs pages
|
|
120
|
+
|
|
121
|
+
The sidebar lists a folder's `index` page first, then pages with an `order`, lowest first, then the
|
|
122
|
+
rest (introduction, getting started and overview before the others, then by name). Set the order in
|
|
123
|
+
the page itself:
|
|
124
|
+
|
|
125
|
+
```md title=apitogo/portal/pages/authentication.md
|
|
126
|
+
---
|
|
127
|
+
title: Authentication
|
|
128
|
+
order: 2
|
|
129
|
+
---
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
In a React page: `export const order = 2;`.
|
|
133
|
+
|
|
134
|
+
When the portal has a home page, `/` shows it, and an `index` page of the docs stays at `/index`.
|
|
135
|
+
|
|
136
|
+
### What the pricing cards show
|
|
137
|
+
|
|
138
|
+
Each card in `apitogo/plans.json` lists, in this order:
|
|
139
|
+
|
|
140
|
+
1. The plan's limits: the rate limit (`limits.rateLimit`) and the quota (`limits.quota`)
|
|
141
|
+
2. Its own lines, from `features`
|
|
142
|
+
3. The endpoints the plan includes: the ones in `includedActions`, or every operation of the gateway
|
|
143
|
+
when the plan names none
|
|
144
|
+
|
|
145
|
+
```json title=apitogo/plans.json
|
|
146
|
+
{
|
|
147
|
+
"version": 1,
|
|
148
|
+
"plans": [
|
|
149
|
+
{
|
|
150
|
+
"sku": "pro",
|
|
151
|
+
"displayName": "Pro",
|
|
152
|
+
"priceAmount": 19,
|
|
153
|
+
"priceCurrency": "usd",
|
|
154
|
+
"billingInterval": "month",
|
|
155
|
+
"limits": { "rateLimit": { "calls": 600, "periodSeconds": 60 } },
|
|
156
|
+
"features": ["Email support", "Usage history"],
|
|
157
|
+
"includedActions": ["get:/api/makes", "get:/api/makes/{makeId}"]
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`npx apitogo run` shows the same cards as the deployed portal.
|
|
164
|
+
|
|
165
|
+
## Add a portal from scratch
|
|
166
|
+
|
|
167
|
+
In a project that has no portal yet:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx apitogo add portal
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
It adds `portal` to `apitogo.config.json` and writes the files above: `introduction.mdx` (the
|
|
174
|
+
starter template adds a home page; `blank` writes an empty `pages/` folder), `theme.json` and the
|
|
175
|
+
footer. Docs you already have (a `docs/` folder, for example) are used instead of a first page; pass
|
|
176
|
+
`--docs <path>` to name them. Files that exist are never overwritten.
|
|
94
177
|
|
|
95
|
-
Never put
|
|
96
|
-
`
|
|
178
|
+
Never put secrets in `apitogo.config.json`: the config names a project secret (`secret:NAME`), and
|
|
179
|
+
`npx apitogo secrets set NAME` stores the value.
|
|
97
180
|
|
|
98
181
|
## Preview locally
|
|
99
182
|
|
|
@@ -113,11 +196,11 @@ Shape-phase edits hot-reload when the dev server is running.
|
|
|
113
196
|
|
|
114
197
|
## Existing docs + OpenAPI folder
|
|
115
198
|
|
|
116
|
-
|
|
199
|
+
In a folder that already has docs and an OpenAPI file, run `init` there: it uses the `docs/` folder
|
|
200
|
+
in place, and `npx apitogo config` (openapi) adds the OpenAPI file:
|
|
117
201
|
|
|
118
202
|
```bash
|
|
119
203
|
npx @lukoweb/apitogo@latest init
|
|
120
|
-
cd dev-portal
|
|
121
204
|
npx apitogo config
|
|
122
205
|
npx apitogo run
|
|
123
206
|
```
|
package/docs/cli/walkthrough.md
CHANGED
|
@@ -49,7 +49,7 @@ npx apitogo add plans --template free
|
|
|
49
49
|
`--create-spec` writes a small OpenAPI file with one `GET /health` operation, so the gateway has
|
|
50
50
|
something to expose. For a real API, point `gateway.specs` at your own OpenAPI file instead.
|
|
51
51
|
|
|
52
|
-
The Free template in `plans.json` allows
|
|
52
|
+
The Free template in `plans.json` allows 60 calls per minute and 1000 calls per 30 days. Change the
|
|
53
53
|
numbers in `plans.json` and deploy again to change the limits.
|
|
54
54
|
|
|
55
55
|
With plans in the project, customers call the gateway with their API key alone. Their login token is
|
package/docs/components/slot.mdx
CHANGED
|
@@ -1,119 +1,116 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Slot
|
|
3
|
-
sidebar_icon: between-horizontal-start
|
|
4
|
-
description:
|
|
5
|
-
Use the low-level Slot component for advanced slot management in custom pages and MDX content.
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The `Slot` component provides low-level access to APIToGo's slot system, allowing you to
|
|
9
|
-
programmatically manage content injection in custom pages and React components.
|
|
10
|
-
|
|
11
|
-
## Import
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
import { Slot } from "@lukoweb/apitogo/components";
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Components
|
|
18
|
-
|
|
19
|
-
The Slot system consists of two main components:
|
|
20
|
-
|
|
21
|
-
### Slot.Target
|
|
22
|
-
|
|
23
|
-
Renders content that has been injected into a specific slot.
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
<Slot.Target name="my-slot" fallback={<div>No content</div>} />
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Props:**
|
|
30
|
-
|
|
31
|
-
- `name` (required): The slot name to render content for
|
|
32
|
-
- `fallback` (optional): Content to show when no slot content is available
|
|
33
|
-
|
|
34
|
-
### Slot.Source
|
|
35
|
-
|
|
36
|
-
Injects content into a specific slot. This component renders nothing but registers content to be
|
|
37
|
-
displayed by `Slot.Target` components.
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
<Slot.Source name="my-slot" type="append">
|
|
41
|
-
<div>Content to inject</div>
|
|
42
|
-
</Slot.Source>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
**Props:**
|
|
46
|
-
|
|
47
|
-
- `name` (required): The slot name to inject content into
|
|
48
|
-
- `type` (optional): How to handle multiple content sources
|
|
49
|
-
- `"replace"` (default): Replace existing content
|
|
50
|
-
- `"prepend"`: Add before existing content
|
|
51
|
-
- `"append"`: Add after existing content
|
|
52
|
-
- `children`: The content to inject
|
|
53
|
-
|
|
54
|
-
## Usage Example
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
function MyCustomPage() {
|
|
58
|
-
return (
|
|
59
|
-
<div>
|
|
60
|
-
<h1>My Page</h1>
|
|
61
|
-
|
|
62
|
-
{/* Render slot content here */}
|
|
63
|
-
<Slot.Target name="custom-page-header" />
|
|
64
|
-
|
|
65
|
-
{/* Inject content into a slot */}
|
|
66
|
-
<Slot.Source name="custom-page-header">
|
|
67
|
-
<div className="bg-blue-100 p-4 rounded">Custom header content</div>
|
|
68
|
-
</Slot.Source>
|
|
69
|
-
|
|
70
|
-
<p>Page content here...</p>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Type Safety
|
|
77
|
-
|
|
78
|
-
The Slot component is fully type-safe. All predefined slot names are available with autocomplete:
|
|
79
|
-
|
|
80
|
-
```tsx
|
|
81
|
-
// These will show autocomplete for available slot names
|
|
82
|
-
<Slot.Target name="head-navigation-end" />
|
|
83
|
-
<Slot.Source name="footer-before">Content</Slot.Source>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Adding Custom Slot Names
|
|
87
|
-
|
|
88
|
-
To add your own slot names with full type safety, augment the `CustomSlotNames` type:
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
// types/slots.d.ts
|
|
92
|
-
declare module "@lukoweb/apitogo" {
|
|
93
|
-
type CustomSlotNames = "my-custom-header" | "sidebar-extra";
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Integration with Configuration
|
|
98
|
-
|
|
99
|
-
The Slot component works with configuration-based slots. Content defined in your
|
|
100
|
-
`apitogo.config.json` and content injected via `Slot.Source` components will be combined according
|
|
101
|
-
to the `type` parameter.
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
// In your site config
|
|
105
|
-
slots: {
|
|
106
|
-
"page-header": <div>Config header</div>
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// In your component
|
|
110
|
-
<Slot.Source name="page-header" type="append">
|
|
111
|
-
<Button>Go Home</Button>
|
|
112
|
-
</Slot.Source>
|
|
113
|
-
|
|
114
|
-
// Renders both: Config header, then Component button
|
|
115
|
-
<Slot.Target name="page-header" />
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
For basic configuration usage, see the [Slots Configuration](/docs/configuration/slots)
|
|
119
|
-
documentation.
|
|
1
|
+
---
|
|
2
|
+
title: Slot
|
|
3
|
+
sidebar_icon: between-horizontal-start
|
|
4
|
+
description:
|
|
5
|
+
Use the low-level Slot component for advanced slot management in custom pages and MDX content.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
The `Slot` component provides low-level access to APIToGo's slot system, allowing you to
|
|
9
|
+
programmatically manage content injection in custom pages and React components.
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Slot } from "@lukoweb/apitogo/components";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Components
|
|
18
|
+
|
|
19
|
+
The Slot system consists of two main components:
|
|
20
|
+
|
|
21
|
+
### Slot.Target
|
|
22
|
+
|
|
23
|
+
Renders content that has been injected into a specific slot.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Slot.Target name="my-slot" fallback={<div>No content</div>} />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Props:**
|
|
30
|
+
|
|
31
|
+
- `name` (required): The slot name to render content for
|
|
32
|
+
- `fallback` (optional): Content to show when no slot content is available
|
|
33
|
+
|
|
34
|
+
### Slot.Source
|
|
35
|
+
|
|
36
|
+
Injects content into a specific slot. This component renders nothing but registers content to be
|
|
37
|
+
displayed by `Slot.Target` components.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<Slot.Source name="my-slot" type="append">
|
|
41
|
+
<div>Content to inject</div>
|
|
42
|
+
</Slot.Source>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Props:**
|
|
46
|
+
|
|
47
|
+
- `name` (required): The slot name to inject content into
|
|
48
|
+
- `type` (optional): How to handle multiple content sources
|
|
49
|
+
- `"replace"` (default): Replace existing content
|
|
50
|
+
- `"prepend"`: Add before existing content
|
|
51
|
+
- `"append"`: Add after existing content
|
|
52
|
+
- `children`: The content to inject
|
|
53
|
+
|
|
54
|
+
## Usage Example
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
function MyCustomPage() {
|
|
58
|
+
return (
|
|
59
|
+
<div>
|
|
60
|
+
<h1>My Page</h1>
|
|
61
|
+
|
|
62
|
+
{/* Render slot content here */}
|
|
63
|
+
<Slot.Target name="custom-page-header" />
|
|
64
|
+
|
|
65
|
+
{/* Inject content into a slot */}
|
|
66
|
+
<Slot.Source name="custom-page-header">
|
|
67
|
+
<div className="bg-blue-100 p-4 rounded">Custom header content</div>
|
|
68
|
+
</Slot.Source>
|
|
69
|
+
|
|
70
|
+
<p>Page content here...</p>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Type Safety
|
|
77
|
+
|
|
78
|
+
The Slot component is fully type-safe. All predefined slot names are available with autocomplete:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
// These will show autocomplete for available slot names
|
|
82
|
+
<Slot.Target name="head-navigation-end" />
|
|
83
|
+
<Slot.Source name="footer-before">Content</Slot.Source>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Adding Custom Slot Names
|
|
87
|
+
|
|
88
|
+
To add your own slot names with full type safety, augment the `CustomSlotNames` type:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
// types/slots.d.ts
|
|
92
|
+
declare module "@lukoweb/apitogo" {
|
|
93
|
+
type CustomSlotNames = "my-custom-header" | "sidebar-extra";
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Integration with Configuration
|
|
98
|
+
|
|
99
|
+
The Slot component works with configuration-based slots. Content defined in your
|
|
100
|
+
`apitogo.config.json` and content injected via `Slot.Source` components will be combined according
|
|
101
|
+
to the `type` parameter.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
// In your site config
|
|
105
|
+
slots: {
|
|
106
|
+
"page-header": <div>Config header</div>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// In your component
|
|
110
|
+
<Slot.Source name="page-header" type="append">
|
|
111
|
+
<Button>Go Home</Button>
|
|
112
|
+
</Slot.Source>
|
|
113
|
+
|
|
114
|
+
// Renders both: Config header, then Component button
|
|
115
|
+
<Slot.Target name="page-header" />
|
|
116
|
+
```
|