@lukoweb/apitogo 0.1.51 → 0.1.54
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 +467 -197
- package/dist/declarations/config/apitogo-config-core.d.ts +35 -0
- package/dist/declarations/config/apitogo-config-loader.d.ts +2 -7
- package/dist/declarations/config/apitogo-config-loader.node.d.ts +4 -0
- package/dist/declarations/config/build-apitogo-config.d.ts +5 -4
- package/dist/declarations/config/loader.d.ts +2 -0
- package/dist/declarations/config/local-manifest.d.ts +22 -8
- package/dist/declarations/config/validators/ModulesSchema.d.ts +38 -0
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +43 -2
- package/dist/declarations/index.d.ts +1 -1
- package/dist/declarations/lib/authentication/providers/dev-portal-auth-pages.d.ts +15 -0
- package/dist/declarations/lib/authentication/providers/dev-portal-constants.d.ts +19 -1
- package/dist/declarations/lib/authentication/providers/dev-portal-utils.d.ts +5 -1
- package/dist/declarations/lib/authentication/providers/dev-portal.d.ts +5 -0
- package/dist/declarations/lib/core/plugins.d.ts +1 -0
- package/dist/flat-config.d.ts +53 -24
- package/docs/configuration/authentication.md +11 -9
- package/docs/configuration/manifest.md +75 -74
- package/package.json +1 -1
- package/src/config/apitogo-config-core.ts +601 -0
- package/src/config/apitogo-config-loader.node.ts +88 -0
- package/src/config/apitogo-config-loader.ts +6 -224
- package/src/config/build-apitogo-config.ts +26 -17
- package/src/config/loader.ts +23 -2
- package/src/config/local-manifest.ts +58 -59
- package/src/config/resolve-modules.ts +16 -13
- package/src/config/validators/ModulesSchema.ts +17 -0
- package/src/config/validators/ZudokuConfig.ts +25 -1
- package/src/index.ts +3 -2
- package/src/lib/authentication/providers/dev-portal-auth-pages.tsx +439 -0
- package/src/lib/authentication/providers/dev-portal-constants.ts +15 -1
- package/src/lib/authentication/providers/dev-portal-utils.ts +124 -4
- package/src/lib/authentication/providers/dev-portal.tsx +41 -6
- package/src/lib/core/plugins.ts +1 -0
- package/src/vite/dev-portal-env.ts +12 -4
- package/src/vite/plugin-config.ts +20 -3
- package/src/vite/plugin-local-manifest.ts +15 -0
|
@@ -1,59 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
title: Site configuration (apitogo.config.json)
|
|
3
|
-
sidebar_icon: file-json
|
|
4
|
-
---
|
|
1
|
+
# Site configuration (apitogo.config.json)
|
|
5
2
|
|
|
6
|
-
Dev portal sites use a single JSON
|
|
7
|
-
|
|
8
|
-
components) stay in `apitogo.config.tsx`.
|
|
3
|
+
Dev portal sites use a single JSON file for site settings, plans, authentication, and backend
|
|
4
|
+
metadata. Code-only pieces (plugins, custom components) stay in `apitogo.config.tsx`.
|
|
9
5
|
|
|
10
6
|
## Files
|
|
11
7
|
|
|
12
|
-
| File
|
|
13
|
-
|
|
|
14
|
-
| `apitogo.config.json` | Committed defaults: site, modules,
|
|
15
|
-
| `apitogo.config.tsx`
|
|
16
|
-
| `.env` / `.env.local`
|
|
8
|
+
| File | Purpose |
|
|
9
|
+
| --------------------- | ----------------------------------------------------------- |
|
|
10
|
+
| `apitogo.config.json` | Committed defaults: site, modules, authentication, backend |
|
|
11
|
+
| `apitogo.config.tsx` | Plugins and other non-JSON configuration |
|
|
12
|
+
| `.env` / `.env.local` | Public client vars + publish secrets via `APITOGO_CONFIG_*` |
|
|
17
13
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
Use `APITOGO_CONFIG_<path>` with double underscores for nested paths:
|
|
21
|
-
|
|
22
|
-
```sh
|
|
23
|
-
APITOGO_CONFIG_site__title=My Local Site
|
|
24
|
-
APITOGO_CONFIG_pricing__enabled=true
|
|
25
|
-
APITOGO_CONFIG_projectId=your-local-project-id
|
|
26
|
-
APITOGO_CONFIG_backend__sourceDirectory=../my-api
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Values are parsed as JSON when possible (`true`, `false`, numbers, objects).
|
|
30
|
-
|
|
31
|
-
For the live dev-portal API URL (client-visible):
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
VITE_APITOGO_DEV_PORTAL_API_URL=https://your-dev-portal-api.example.com
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Keep secrets (OIDC client secret, Stripe keys, etc.) in `.env.local` using the
|
|
38
|
-
same `APITOGO_CONFIG_*` pattern — never commit them.
|
|
39
|
-
|
|
40
|
-
## Example `apitogo.config.json`
|
|
14
|
+
## Canonical shape
|
|
41
15
|
|
|
42
16
|
```json
|
|
43
17
|
{
|
|
44
|
-
"siteName": "My API",
|
|
45
|
-
"branding": { "title": "My API" },
|
|
46
|
-
"pricing": { "enabled": true },
|
|
47
|
-
"authentication": { "enabled": true, "type": "dev-portal" },
|
|
48
|
-
"plans": [
|
|
49
|
-
{
|
|
50
|
-
"sku": "pro",
|
|
51
|
-
"displayName": "Pro",
|
|
52
|
-
"isFree": false,
|
|
53
|
-
"priceAmount": 9.99,
|
|
54
|
-
"billingPeriod": "month"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
18
|
"site": {
|
|
58
19
|
"title": "My API",
|
|
59
20
|
"logo": {
|
|
@@ -62,10 +23,72 @@ same `APITOGO_CONFIG_*` pattern — never commit them.
|
|
|
62
23
|
"width": "130px"
|
|
63
24
|
}
|
|
64
25
|
},
|
|
65
|
-
"
|
|
26
|
+
"authentication": {
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"type": "dev-portal",
|
|
29
|
+
"apiBaseUrl": "https://your-dev-portal-api.example.com",
|
|
30
|
+
"gateway": {
|
|
31
|
+
"authMode": "bringYourOwnOidc",
|
|
32
|
+
"oidcMetadataUrl": "https://login.example.com/.well-known/openid-configuration"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"modules": {
|
|
36
|
+
"docs": { "files": "/pages/**/*.{md,mdx}" },
|
|
37
|
+
"landing": { "enabled": true, "path": "/", "layout": "landing" },
|
|
38
|
+
"userPanel": {
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"dashboard": { "enabled": true },
|
|
41
|
+
"userManagement": { "enabled": true },
|
|
42
|
+
"plans": {
|
|
43
|
+
"enabled": true,
|
|
44
|
+
"items": [
|
|
45
|
+
{
|
|
46
|
+
"sku": "free",
|
|
47
|
+
"displayName": "Free",
|
|
48
|
+
"priceAmount": 0
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"apis": [{ "type": "file", "input": "./apis/openapi.yaml", "path": "api" }]
|
|
66
55
|
}
|
|
67
56
|
```
|
|
68
57
|
|
|
58
|
+
- **Site name / logo:** only `site.title` and `site.logo` (platform branding is derived at publish).
|
|
59
|
+
- **OpenAPI path:** `backend.openApiPath` is derived from `apis[0].input`.
|
|
60
|
+
- **Billing / account plans:** use `modules.userPanel.plans.enabled` and store the plan catalog in
|
|
61
|
+
`modules.userPanel.plans.items`. Legacy root `plans` is migrated on load. Legacy `pricing.enabled`
|
|
62
|
+
is migrated and stripped from site JSON; MCP/publish still receives derived `pricing.enabled`.
|
|
63
|
+
- **Docs / API keys:** configure under `modules.docs` and `modules.userPanel.apiKeys` only.
|
|
64
|
+
|
|
65
|
+
## Environment variables
|
|
66
|
+
|
|
67
|
+
Public client URL (mirrors `authentication.apiBaseUrl`):
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
VITE_APITOGO_AUTHENTICATION_API_BASE_URL=https://your-dev-portal-api.example.com
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Nested config overrides:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
APITOGO_CONFIG_site__title=My Local Site
|
|
77
|
+
APITOGO_CONFIG_pricing__enabled=true
|
|
78
|
+
APITOGO_CONFIG_projectId=your-local-project-id
|
|
79
|
+
APITOGO_CONFIG_authentication__apiBaseUrl=https://your-dev-portal-api.example.com
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Publish secrets (`.env.local`, never commit):
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
APITOGO_CONFIG_authentication__oidc__authority=https://login.example.com
|
|
86
|
+
APITOGO_CONFIG_authentication__oidc__clientId=your-client-id
|
|
87
|
+
APITOGO_CONFIG_authentication__oidc__clientSecret=your-client-secret
|
|
88
|
+
APITOGO_CONFIG_authentication__stripe__secretKey=sk_test_...
|
|
89
|
+
APITOGO_CONFIG_authentication__stripe__webhookSecret=whsec_...
|
|
90
|
+
```
|
|
91
|
+
|
|
69
92
|
## Thin `apitogo.config.tsx`
|
|
70
93
|
|
|
71
94
|
```tsx
|
|
@@ -77,29 +100,7 @@ export default buildApitogoConfig({
|
|
|
77
100
|
});
|
|
78
101
|
```
|
|
79
102
|
|
|
80
|
-
##
|
|
81
|
-
|
|
82
|
-
| Concern | Recommended location |
|
|
83
|
-
| --- | --- |
|
|
84
|
-
| Plans, rate limits, `includedActionKeys` | `apitogo.config.json` |
|
|
85
|
-
| Branding, site name, modules, navigation | `apitogo.config.json` |
|
|
86
|
-
| Machine-specific paths, `projectId` | `.env.local` via `APITOGO_CONFIG_*` |
|
|
87
|
-
| OIDC / Stripe for publish | `.env.local` via `APITOGO_CONFIG_*` |
|
|
88
|
-
| Plugins | `apitogo.config.tsx` |
|
|
89
|
-
|
|
90
|
-
## Hot reload
|
|
91
|
-
|
|
92
|
-
During `npm run dev`, changes to `apitogo.config.json` hot-reload on `/pricing`
|
|
93
|
-
without restarting the server. Restart the dev server after changing
|
|
94
|
-
`VITE_APITOGO_DEV_PORTAL_API_URL` in `.env`.
|
|
95
|
-
|
|
96
|
-
## Legacy manifests
|
|
97
|
-
|
|
98
|
-
Older projects may still have `apitogo.json` with optional
|
|
99
|
-
`apitogo.local.json` / `apitogo.prod.json` overrides. The tooling falls back to
|
|
100
|
-
those files when `apitogo.config.json` is missing.
|
|
101
|
-
|
|
102
|
-
## Related configuration
|
|
103
|
+
## Related
|
|
103
104
|
|
|
104
|
-
-
|
|
105
|
-
-
|
|
105
|
+
- [Authentication](./authentication.md)
|
|
106
|
+
- [Overview](./overview.md)
|