@lukoweb/apitogo 0.1.67 → 0.1.68

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.
Files changed (55) hide show
  1. package/dist/cli/cli.js +529 -379
  2. package/docs/components/playground.mdx +6 -8
  3. package/docs/components/slot.mdx +2 -2
  4. package/docs/concepts/auth-provider-api-identities.md +8 -12
  5. package/docs/configuration/ai-assistants.md +3 -3
  6. package/docs/configuration/api-catalog.md +4 -4
  7. package/docs/configuration/api-reference.md +11 -11
  8. package/docs/configuration/authentication-auth0.md +8 -1
  9. package/docs/configuration/authentication-azure-ad.md +8 -1
  10. package/docs/configuration/authentication-clerk.md +8 -1
  11. package/docs/configuration/authentication-firebase.md +8 -1
  12. package/docs/configuration/authentication-pingfederate.md +8 -1
  13. package/docs/configuration/authentication-supabase.md +10 -3
  14. package/docs/configuration/authentication.md +96 -195
  15. package/docs/configuration/build-configuration.mdx +2 -2
  16. package/docs/configuration/docs.md +10 -10
  17. package/docs/configuration/footer.mdx +84 -180
  18. package/docs/configuration/llms.md +1 -1
  19. package/docs/configuration/make-config.mdx +12 -5
  20. package/docs/configuration/manifest.md +4 -14
  21. package/docs/configuration/navigation.mdx +2 -2
  22. package/docs/configuration/overview.md +95 -310
  23. package/docs/configuration/protected-routes.md +3 -3
  24. package/docs/configuration/search.md +4 -3
  25. package/docs/configuration/site.md +5 -5
  26. package/docs/configuration/slots.mdx +1 -1
  27. package/docs/custom-plugins.md +1 -1
  28. package/docs/customization/colors-theme.mdx +8 -8
  29. package/docs/customization/fonts.md +4 -4
  30. package/docs/deploy/apitogo.md +18 -12
  31. package/docs/deploy/cloudflare-pages.md +0 -1
  32. package/docs/deploy/direct-upload.md +0 -1
  33. package/docs/deploy/github-pages.md +1 -2
  34. package/docs/deploy/vercel.md +2 -3
  35. package/docs/deployment.md +11 -10
  36. package/docs/extending/events.md +1 -1
  37. package/docs/guides/custom-pages.md +4 -8
  38. package/docs/guides/environment-variables.md +41 -49
  39. package/docs/guides/managing-api-keys-and-identities.md +40 -115
  40. package/docs/guides/navigation-rules.mdx +1 -1
  41. package/docs/guides/processors.mdx +2 -2
  42. package/docs/guides/transforming-examples.md +1 -1
  43. package/docs/markdown/code-blocks.md +2 -2
  44. package/docs/markdown/mdx.md +1 -1
  45. package/docs/mcp/go-live.md +100 -0
  46. package/docs/mcp/overview.md +76 -0
  47. package/docs/mcp/setup.md +173 -0
  48. package/docs/mcp/shape.md +76 -0
  49. package/docs/mcp/tools.md +102 -0
  50. package/docs/plugins.md +20 -1
  51. package/docs/quickstart.md +49 -54
  52. package/docs/writing.mdx +1 -1
  53. package/package.json +1 -1
  54. package/src/vite/plugin-config.ts +3 -0
  55. package/docs/guides/navigation-migration.md +0 -87
@@ -1,255 +1,156 @@
1
1
  ---
2
- title: Overview
2
+ title: Authentication
3
3
  sidebar_icon: shield-check
4
4
  ---
5
5
 
6
- If you use a managed authentication service, such as Auth0, Clerk, or OpenID, you can implement this
7
- into your site and allow users to browse and interact with your documentation and API reference in a
8
- logged in state.
6
+ API products on APItoGo use **`dev-portal`** authentication: the static site delegates sign-in to the
7
+ provisioned portal API; OIDC client secrets stay on the backend.
9
8
 
10
- ## Configuration
9
+ For docs-only sites that embed a SPA identity provider directly in the browser, see
10
+ [SPA providers (advanced)](#spa-providers-advanced).
11
11
 
12
- To implement the authentication option for your site, add the `authentication` property to the
13
- [APIToGo Configuration](./overview.md) file. The configuration is slightly different depending on
14
- the authentication provider you use.
12
+ ## Dev portal (recommended)
15
13
 
16
- ## Authentication Providers
14
+ Set authentication in `apitogo.config.json`:
17
15
 
18
- APIToGo supports Clerk, Auth0, Supabase, Azure B2C, any OpenID provider that supports the OpenID
19
- Connect protocol, and **dev-portal** (backend-delegated OIDC for APItoGo provisioned developer
20
- portals).
21
-
22
- Not seeing your authentication provider?
23
- [Let us know](https://github.com/lukoweb/apitogo-doc-tool/issues)
24
-
25
- ### Dev portal (APItoGo)
26
-
27
- For sites provisioned through APItoGo MCP, use backend-delegated authentication. The static site
28
- redirects sign-in to the provisioned dev-portal API; OIDC client credentials stay on the backend
29
- only.
30
-
31
- ```typescript
16
+ ```json
32
17
  {
33
- // ...
34
- authentication: {
35
- type: "dev-portal",
36
- },
37
- // ...
18
+ "authentication": {
19
+ "enabled": true,
20
+ "type": "dev-portal",
21
+ "redirectToAfterSignIn": "/account/dashboard",
22
+ "redirectToAfterSignUp": "/account/dashboard"
23
+ }
38
24
  }
39
25
  ```
40
26
 
41
- Set the backend API URL via environment variable (MCP writes this at scaffold/publish):
27
+ Backend API URL (MCP writes this at scaffold/publish):
42
28
 
43
29
  ```bash
44
30
  VITE_APITOGO_AUTHENTICATION_API_BASE_URL=https://your-dev-portal-api.example.com
45
31
  ```
46
32
 
47
- You can also set `authentication.apiBaseUrl` in `apitogo.config.json` or
48
- `APITOGO_CONFIG_AUTHENTICATION__API_BASE_URL` in `.env`.
33
+ Or `authentication.apiBaseUrl` in JSON / `APITOGO_CONFIG_AUTHENTICATION__API_BASE_URL` in `.env`.
49
34
 
50
- **Local demo mode:** In development (`npm run dev`), `demoMode` is enabled by default when the user
51
- panel is on. You do not need `VITE_APITOGO_AUTHENTICATION_API_BASE_URL`, OIDC, or a running
52
- dev-portal backend to explore protected account pages locally. Sign in at `/login` with:
35
+ ### Local demo mode
36
+
37
+ In development (`npm run dev`), `demoMode` is on by default when the user panel is enabled. You do
38
+ not need a backend URL or OIDC to explore account pages. Sign in at `/login` with:
53
39
 
54
40
  ```text
55
41
  demo@apitogo.local / password
56
42
  ```
57
43
 
58
- Disable with `APITOGO_CONFIG_DEMO_MODE=false` in `.env` or `"demoMode": false` in
59
- `apitogo.config.json`. Demo mode is never active in production builds.
60
-
61
- **Local preview (demo off):** When the backend URL is a placeholder or unreachable and demo mode is
62
- disabled, the account area shows a message that sign-in unlocks after publish. Docs and API
63
- reference remain public. Plans on `/pricing` load from `apitogo.config.json` (overridable via `.env`
64
- — see [Manifest](./manifest.md), including `includedActionKeys` per plan). Plan edits hot-reload
65
- without restarting the dev server.
44
+ Disable with `APITOGO_CONFIG_DEMO_MODE=false` or `"demoMode": false` in JSON. Demo mode is never
45
+ active in production builds.
66
46
 
67
- ### Dev portal configuration files
47
+ When demo is off and the backend URL is a placeholder, the account area explains that sign-in
48
+ unlocks after publish. Docs and API reference stay public. Plans on `/pricing` come from
49
+ `apitogo.config.json` (see [Manifest](./manifest.md)).
68
50
 
69
- | Concern | File |
70
- | -------------------------------------------------------- | -------------------------------------------------------------------------- |
71
- | Site, plans, modules, branding, backend/gateway metadata | `apitogo.config.json` (+ `.env` overrides — see [Manifest](./manifest.md)) |
72
- | Plugins and custom code | `apitogo.config.tsx` |
73
- | OIDC and Stripe for publish | `.env` via `APITOGO_CONFIG_AUTHENTICATION__*` |
51
+ ### Config files
74
52
 
75
- **Production:** Register one OIDC app with redirect URI `https://{backend}/signin-oidc` (see MCP
76
- `manualSteps.oidcRedirectUri`). The frontend uses cookie sessions via `credentials: "include"` on
77
- `/api/v1/auth/me`.
53
+ | Concern | File |
54
+ | -------------------------------------------- | ------------------------------------------------------------- |
55
+ | Site, plans, modules, branding, backend | `apitogo.config.json` (+ `.env` — [Manifest](./manifest.md)) |
56
+ | OIDC and Stripe for publish | `.env` via `APITOGO_CONFIG_AUTHENTICATION__*` |
78
57
 
79
- ### Auth0
58
+ ### Production OIDC
80
59
 
81
- For Auth0, you will need the `clientId` associated with the domain you are using.
60
+ Register one OIDC app with redirect URI `https://{backend}/signin-oidc` (MCP returns
61
+ `manualSteps.oidcRedirectUri` after publish). The frontend uses cookie sessions via
62
+ `credentials: "include"` on `/api/v1/auth/me`.
82
63
 
83
- You can find this in the Auth0 dashboard under
84
- [Application Settings](https://auth0.com/docs/get-started/applications/application-settings).
64
+ Publish secrets (site `.env`, never commit):
85
65
 
86
- ```typescript
87
- {
88
- // ...
89
- authentication: {
90
- type: "auth0",
91
- domain: "yourdomain.us.auth0.com",
92
- clientId: "<your-auth0-clientId>",
93
- scopes: ["openid", "profile", "email", "custom_scope"],
94
- },
95
- // ...
96
- }
66
+ ```sh
67
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__AUTHORITY=https://login.example.com
68
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_ID=your-client-id
69
+ APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_SECRET=your-client-secret
70
+ APITOGO_CONFIG_AUTHENTICATION__STRIPE__SECRET_KEY=sk_test_...
71
+ APITOGO_CONFIG_AUTHENTICATION__STRIPE__WEBHOOK_SECRET=whsec_...
97
72
  ```
98
73
 
99
- To setup Auth0, create a Single Page Application (SPA) application in the Auth0 dashboard. Set the
100
- following options:
74
+ Stripe is required only when you have **paid** gateway plans. Full flow: [MCP go-live](../mcp/go-live.md).
101
75
 
102
- - Callback URL to `https://your-site.com/oauth/callback`.
103
- - For development environments only, we recommend configuring your app to allow the a wildcard
104
- callback like `https://*.zuplo.app/oauth/callback` to allow for testing each environment.
105
- - For local development, set the callback url to `http://localhost:3000/oauth/callback`.
106
- - Add your site hostname (your-site.com) to the list of allowed CORS origins.
76
+ Auth mode for end users (`native` | `oidc` | `nativeAndOidc`) is shaped via MCP /
77
+ `update_dev_portal_manifest`.
107
78
 
108
- ### Clerk
79
+ ## Protected routes
109
80
 
110
- For Clerk you will need the publishable key for your application. You can find this in the Clerk
111
- dashboard on the [API Keys](https://dashboard.clerk.com/last-active?path=api-keys) page.
81
+ After authentication is configured, protect routes with patterns or callbacks:
112
82
 
113
- ```typescript
83
+ ```json
114
84
  {
115
- // ...
116
- authentication: {
117
- type: "clerk",
118
- clerkPubKey: "<your-clerk-publishable-key>",
119
- // Optional. See: https://clerk.com/docs/backend-requests/jwt-templates
120
- jwtTemplateName: "dev-portal",
121
- },
122
- // ...
85
+ "protectedRoutes": ["/admin/*", "/settings", "/api/*"]
123
86
  }
124
87
  ```
125
88
 
126
- ### OpenID
89
+ Or in TSX for custom authorization — see [Protected routes](./protected-routes.md).
127
90
 
128
- For authentication services that support OpenID, you will need to supply an `clientId` and `issuer`.
91
+ ## SPA providers (advanced)
129
92
 
130
- ```typescript
131
- {
132
- // ...
133
- authentication: {
134
- type: "openid",
135
- clientId: "<your-client-id>",
136
- issuer: "<the-issuer-url>",
137
- scopes: ["openid", "profile", "email", "custom_scope"] // Optional custom scopes
138
- },
139
- // ...
140
- }
141
- ```
93
+ :::caution{title="Portal products use dev-portal"}
142
94
 
143
- When configuring your OpenID provider, you will need to set the following:
95
+ SPA providers (Auth0, Clerk, OpenID, Supabase, Azure B2C, Firebase, PingFederate) run the OAuth
96
+ callback in the browser (`/oauth/callback`). Prefer **`dev-portal`** for APItoGo-hosted API products.
97
+ Use SPA providers only for standalone docs sites that talk to the IdP directly.
144
98
 
145
- - Callback or Redirect URI to `https://your-site.com/oauth/callback`.
146
- - If your provider supports wildcard callback urls, we recommend configuring your development
147
- identity provider to allow a wildcard callback like `https://*.zuplo.site/oauth/callback` to allow
148
- for testing each environment.
149
- - For local development set the callback url to `http://localhost:3000/oauth/callback`.
150
- - Add your site hostname (your-site.com) to the list of allowed CORS origins.
99
+ :::
151
100
 
152
- By default, the scopes "openid", "profile", and "email" are requested. You can customize these by
153
- providing your own array of scopes.
101
+ Configure `authentication` in JSON or TSX. Provider-specific pages:
154
102
 
155
- ### Supabase
103
+ - [Auth0](./authentication-auth0.md)
104
+ - [Clerk](./authentication-clerk.md)
105
+ - [Azure AD / B2C](./authentication-azure-ad.md)
106
+ - [PingFederate](./authentication-pingfederate.md)
107
+ - [Supabase](./authentication-supabase.md)
108
+ - [Firebase](./authentication-firebase.md)
156
109
 
157
- To use Supabase as your authentication provider, supply your project's URL, API key, and the OAuth
158
- provider to use.
110
+ Typical SPA callback setup:
159
111
 
160
- ```typescript title="apitogo.config.ts"
161
- {
162
- // ...
163
- authentication: {
164
- type: "supabase",
165
- provider: "github",
166
- supabaseUrl: "https://your-project.supabase.co",
167
- supabaseKey: "<your-supabase-key>",
168
- redirectToAfterSignUp: "/",
169
- redirectToAfterSignIn: "/",
170
- redirectToAfterSignOut: "/",
171
- },
172
- // ...
173
- }
174
- ```
112
+ - Production: `https://your-site.com/oauth/callback`
113
+ - Local: `http://localhost:3000/oauth/callback`
114
+ - Add your site hostname to allowed CORS origins in the IdP
175
115
 
176
- The `provider` option can be any of Supabase Auth's supported providers, such as `apple`, `azure`,
177
- `bitbucket`, `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `kakao`, `keycloak`,
178
- `linkedin`, `linkedin_oidc`, `notion`, `slack`, `slack_oidc`, `spotify`, `twitch`, `twitter`,
179
- `workos`, `zoom`, or `fly`.
116
+ ### Auth0 (SPA example)
180
117
 
181
- ### Azure B2C
182
-
183
- For Azure B2C authentication, you will need to provide your Azure B2C tenant name, client ID, and
184
- policy name.
185
-
186
- ```typescript title="apitogo.config.ts"
187
- {
188
- // ...
189
- authentication: {
190
- type: "azureb2c",
191
- clientId: "<your-azure-b2c-client-id>",
192
- tenantName: "<your-tenant-name>",
193
- policyName: "<your-policy-name>",
194
- issuer: "<your-issuer-url>",
195
- scopes: ["openid", "profile", "email", "custom_scope"]
196
- },
197
- // ...
118
+ ```ts
119
+ authentication: {
120
+ type: "auth0",
121
+ domain: "yourdomain.us.auth0.com",
122
+ clientId: "<your-auth0-clientId>",
123
+ scopes: ["openid", "profile", "email"],
198
124
  }
199
125
  ```
200
126
 
201
- When configuring your Azure B2C application, you will need to set the following:
202
-
203
- - Redirect URI to `https://your-site.com/oauth/callback`
204
- - For local development, set the redirect URI to `http://localhost:3000/oauth/callback`
205
- - Add your site hostname (your-site.com) to the list of allowed CORS origins
206
- - Configure the appropriate user flows (policies) in your Azure B2C tenant
127
+ ### Clerk (SPA example)
207
128
 
208
- By default, the scopes "openid", "profile", and "email" are requested. You can customize these by
209
- providing your own array of scopes.
210
-
211
- ## User Data
212
-
213
- After the user authenticates, the user profile is loaded via the provider's
214
- [User Info endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo). The following
215
- fields are used to display the user profile:
129
+ ```ts
130
+ authentication: {
131
+ type: "clerk",
132
+ clerkPubKey: "<your-clerk-publishable-key>",
133
+ jwtTemplateName: "dev-portal", // optional
134
+ }
135
+ ```
216
136
 
217
- - `name` - The user's full name
218
- - `email` - The user's email address
219
- - `picture` - The user's profile picture URL
220
- - `email_verified` - Whether the user's email address has been verified
137
+ ### OpenID (SPA example)
221
138
 
222
- If the provider does not return a field, it will be left blank.
139
+ ```ts
140
+ authentication: {
141
+ type: "openid",
142
+ clientId: "<your-client-id>",
143
+ issuer: "<the-issuer-url>",
144
+ scopes: ["openid", "profile", "email"],
145
+ }
146
+ ```
223
147
 
224
- ## Protected Routes
148
+ ### Supabase / Azure B2C
225
149
 
226
- Once authentication is configured, you can protect specific routes in your documentation to require
227
- users to be authenticated or meet custom authorization requirements. Routes can be protected with a
228
- simple array of patterns, or with custom callback functions that support reason codes for
229
- distinguishing between unauthorized and forbidden access.
150
+ See the provider pages for full options. Default scopes are `openid`, `profile`, and `email` unless
151
+ you override them.
230
152
 
231
- ```typescript title="apitogo.config.ts"
232
- {
233
- // ...
234
- // Simple array format: requires authentication
235
- protectedRoutes: [
236
- "/admin/*",
237
- "/settings",
238
- "/api/*",
239
- ],
240
-
241
- // Or object format: custom authorization with reason codes
242
- protectedRoutes: {
243
- "/admin/*": ({ auth, reasonCode }) =>
244
- !auth.isAuthenticated
245
- ? reasonCode.UNAUTHORIZED
246
- : auth.profile?.email?.endsWith("@example.com")
247
- ? true
248
- : reasonCode.FORBIDDEN,
249
- },
250
- // ...
251
- }
252
- ```
153
+ ## User profile fields
253
154
 
254
- See the [Protected Routes](./protected-routes.md) documentation for detailed information on
255
- configuring route protection, reason codes, and navigation behavior.
155
+ After SPA login, the profile comes from the provider UserInfo endpoint: `name`, `email`, `picture`,
156
+ `email_verified`. Missing fields are left blank. Dev-portal sessions use the portal API instead.
@@ -10,7 +10,7 @@ API schemas before they are used in the documentation.
10
10
 
11
11
  :::tip{title="Security Note"}
12
12
 
13
- Unlike `apitogo.config.ts` which runs in both client and server environments, `apitogo.build.ts`
13
+ Unlike your site config which runs in both client and server environments, `apitogo.build.ts`
14
14
  runs exclusively in Node.js during build time. This means:
15
15
 
16
16
  - Sensitive operations (like API calls, file system access) can safely be performed
@@ -26,7 +26,7 @@ Create a file named `apitogo.build.ts` in the root of your project:
26
26
 
27
27
  ```bash
28
28
  your-project/
29
- ├── apitogo.config.ts
29
+ ├── apitogo.config.json
30
30
  ├── apitogo.build.ts # <-- Add this file
31
31
  └── ...
32
32
  ```
@@ -42,7 +42,7 @@ its original file-based path.
42
42
 
43
43
  ### Navigation Configuration
44
44
 
45
- ```tsx {5-6,13-14} title="apitogo.config.tsx" showLineNumbers
45
+ ```tsx {5-6,13-14} title="config" showLineNumbers
46
46
  export default {
47
47
  navigation: [
48
48
  {
@@ -75,7 +75,7 @@ In this example:
75
75
 
76
76
  Configure docs routing and behavior through the `docs` section in your config:
77
77
 
78
- ```tsx title="apitogo.config.tsx"
78
+ ```tsx title="config"
79
79
  export default {
80
80
  docs: {
81
81
  files: ["/pages/**/*.{md,mdx}"],
@@ -100,7 +100,7 @@ export default {
100
100
  Glob patterns that specify which files to include as documentation pages. You can provide a single
101
101
  pattern or an array of patterns.
102
102
 
103
- ```tsx title="apitogo.config.tsx"
103
+ ```tsx title="config"
104
104
  // Single pattern
105
105
  docs: {
106
106
  files: "/content/**/*.md";
@@ -124,7 +124,7 @@ using frontmatter.
124
124
 
125
125
  Whether to show the table of contents (TOC) by default.
126
126
 
127
- ```tsx title="apitogo.config.tsx"
127
+ ```tsx title="config"
128
128
  docs: {
129
129
  defaultOptions: {
130
130
  toc: false; // Hide TOC by default
@@ -139,7 +139,7 @@ docs: {
139
139
 
140
140
  Whether to disable the previous/next page navigation by default.
141
141
 
142
- ```tsx title="apitogo.config.tsx"
142
+ ```tsx title="config"
143
143
  docs: {
144
144
  defaultOptions: {
145
145
  disablePager: true; // Disable pager by default
@@ -154,7 +154,7 @@ docs: {
154
154
 
155
155
  Whether to show the last modified date by default.
156
156
 
157
- ```tsx title="apitogo.config.tsx"
157
+ ```tsx title="config"
158
158
  docs: {
159
159
  defaultOptions: {
160
160
  showLastModified: true; // Show last modified date
@@ -169,7 +169,7 @@ docs: {
169
169
 
170
170
  Configuration for the "Edit this page" link.
171
171
 
172
- ```tsx title="apitogo.config.tsx"
172
+ ```tsx title="config"
173
173
  docs: {
174
174
  defaultOptions: {
175
175
  suggestEdit: {
@@ -191,7 +191,7 @@ in a `docs/pages/` directory, the URL might be
191
191
  Whether to show a copy button in the page header that allows users to copy the page markdown. This
192
192
  feature requires `publishMarkdown` to be enabled (see below).
193
193
 
194
- ```tsx title="apitogo.config.tsx"
194
+ ```tsx title="config"
195
195
  docs: {
196
196
  defaultOptions: {
197
197
  copyPage: true; // Enable copy button for all pages
@@ -218,7 +218,7 @@ The copy button provides:
218
218
  When enabled, generates `.md` files for each documentation page during build. Pages can then be
219
219
  accessed at their URL path with the `.md` extension appended (e.g., `/docs/quickstart.md`).
220
220
 
221
- ```tsx title="apitogo.config.tsx"
221
+ ```tsx title="config"
222
222
  docs: {
223
223
  publishMarkdown: true,
224
224
  }
@@ -238,7 +238,7 @@ The generated markdown files:
238
238
  Configuration for generating LLM-friendly documentation files. See the
239
239
  [llms.txt configuration](/docs/configuration/llms) page for complete documentation.
240
240
 
241
- ```tsx title="apitogo.config.tsx"
241
+ ```tsx title="config"
242
242
  docs: {
243
243
  llms: {
244
244
  llmsTxt: true, // Generate llms.txt summary file