@lukoweb/apitogo 0.1.51 → 0.1.53

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.
@@ -0,0 +1,25 @@
1
+ export declare const APITOGO_CONFIG_FILENAME = "apitogo.config.json";
2
+ export type ApitogoJsonConfig = Record<string, unknown>;
3
+ export type AuthenticationSecrets = {
4
+ oidc?: {
5
+ authority?: string;
6
+ clientId?: string;
7
+ clientSecret?: string;
8
+ };
9
+ stripe?: {
10
+ secretKey?: string;
11
+ webhookSecret?: string;
12
+ };
13
+ };
14
+ export declare function applyEnvOverrides(config: ApitogoJsonConfig, env?: NodeJS.ProcessEnv): ApitogoJsonConfig;
15
+ type PlanCatalogItem = Record<string, unknown> & {
16
+ sku?: string;
17
+ };
18
+ export declare function readPlanCatalogItems(config: ApitogoJsonConfig): PlanCatalogItem[];
19
+ export declare function normalizeApitogoConfig(config: ApitogoJsonConfig): ApitogoJsonConfig;
20
+ export declare function isBillingEnabled(config: ApitogoJsonConfig): boolean;
21
+ export declare function deriveManifestFields(config: ApitogoJsonConfig): ApitogoJsonConfig;
22
+ export declare function extractManifest(config: ApitogoJsonConfig | null | undefined): ApitogoJsonConfig | null;
23
+ export declare function extractSiteConfig(config: ApitogoJsonConfig | null | undefined): ApitogoJsonConfig;
24
+ export declare function resolveProjectDisplayName(config: ApitogoJsonConfig): string;
25
+ export {};
@@ -1,7 +1,2 @@
1
- export declare const APITOGO_CONFIG_FILENAME = "apitogo.config.json";
2
- export type ApitogoJsonConfig = Record<string, unknown>;
3
- export declare function applyEnvOverrides(config: ApitogoJsonConfig, env?: NodeJS.ProcessEnv): ApitogoJsonConfig;
4
- export declare function loadApitogoConfig(rootDir?: string): ApitogoJsonConfig;
5
- export declare function extractManifest(config: ApitogoJsonConfig | null | undefined): ApitogoJsonConfig | null;
6
- export declare function extractSiteConfig(config: ApitogoJsonConfig | null | undefined): ApitogoJsonConfig;
7
- export declare function apitogoConfigPath(rootDir: string): string;
1
+ export * from "./apitogo-config-core.js";
2
+ export { apitogoConfigPath, loadApitogoConfig, readAuthenticationSecrets, } from "./apitogo-config-loader.node.js";
@@ -0,0 +1,4 @@
1
+ import { type ApitogoJsonConfig, type AuthenticationSecrets } from "./apitogo-config-core.js";
2
+ export declare function loadApitogoConfig(rootDir?: string): ApitogoJsonConfig;
3
+ export declare function readAuthenticationSecrets(env?: NodeJS.ProcessEnv): AuthenticationSecrets;
4
+ export declare function apitogoConfigPath(rootDir: string): string;
@@ -1,7 +1,8 @@
1
+ import type { ApitogoPlugin } from "../lib/core/plugins.js";
2
+ import { type ApitogoJsonConfig } from "./apitogo-config-core.js";
1
3
  import type { ApitogoConfig } from "./config.js";
2
- type BuildApitogoConfigOptions = {
3
- rootDir?: string;
4
- overrides?: Partial<ApitogoConfig>;
4
+ type BuildApitogoConfigOptions = Partial<ApitogoConfig> & ApitogoJsonConfig & {
5
+ plugins?: ApitogoPlugin[];
5
6
  };
6
- export declare function buildApitogoConfig({ rootDir, overrides, }?: BuildApitogoConfigOptions): ApitogoConfig;
7
+ export declare function buildApitogoConfig({ plugins, plans: _legacyPlans, ...jsonOverrides }?: BuildApitogoConfigOptions): ApitogoConfig;
7
8
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { RollupOutput, RollupWatcher } from "rollup";
2
2
  import { type ConfigEnv } from "vite";
3
+ import { type DevPortalPreviewPlan } from "./local-manifest.js";
3
4
  import type { ResolvedModulesConfig } from "./validators/ModulesSchema.js";
4
5
  import type { ZudokuConfig } from "./validators/ZudokuConfig.js";
5
6
  export type ConfigWithMeta = ZudokuConfig & {
@@ -11,6 +12,7 @@ export type ConfigWithMeta = ZudokuConfig & {
11
12
  dependencies: string[];
12
13
  pricingEnabled?: boolean;
13
14
  authenticationEnabled?: boolean;
15
+ previewPlans?: DevPortalPreviewPlan[];
14
16
  };
15
17
  __resolvedModules: ResolvedModulesConfig;
16
18
  };
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { APITOGO_CONFIG_FILENAME } from "./apitogo-config-loader.js";
3
- export declare const DEV_PORTAL_MANIFEST_FILENAME = "apitogo.local.json";
4
3
  export declare const APITOGO_MANIFEST_BASE_FILENAME = "apitogo.json";
5
4
  export declare const APITOGO_MANIFEST_ENV_FILES: {
6
5
  readonly development: "apitogo.local.json";
@@ -11,8 +10,7 @@ export type ApitogoManifestEnv = keyof typeof APITOGO_MANIFEST_ENV_FILES;
11
10
  export declare const ManifestPlanInputSchema: z.ZodObject<{
12
11
  sku: z.ZodString;
13
12
  displayName: z.ZodString;
14
- isFree: z.ZodBoolean;
15
- priceAmount: z.ZodOptional<z.ZodNumber>;
13
+ priceAmount: z.ZodDefault<z.ZodNumber>;
16
14
  priceCurrency: z.ZodOptional<z.ZodString>;
17
15
  billingPeriod: z.ZodOptional<z.ZodEnum<{
18
16
  month: "month";
@@ -23,6 +21,9 @@ export declare const ManifestPlanInputSchema: z.ZodObject<{
23
21
  limitsJson: z.ZodOptional<z.ZodString>;
24
22
  includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
23
  }, z.core.$strip>;
24
+ export declare function isPlanFree(plan: {
25
+ priceAmount?: number;
26
+ }): boolean;
26
27
  export declare const DevPortalLocalManifestSchema: z.ZodObject<{
27
28
  siteName: z.ZodOptional<z.ZodString>;
28
29
  branding: z.ZodOptional<z.ZodObject<{
@@ -34,12 +35,13 @@ export declare const DevPortalLocalManifestSchema: z.ZodObject<{
34
35
  }, z.core.$strip>>;
35
36
  authentication: z.ZodOptional<z.ZodObject<{
36
37
  enabled: z.ZodOptional<z.ZodBoolean>;
38
+ type: z.ZodOptional<z.ZodString>;
39
+ apiBaseUrl: z.ZodOptional<z.ZodString>;
37
40
  }, z.core.$strip>>;
38
41
  plans: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
42
  sku: z.ZodString;
40
43
  displayName: z.ZodString;
41
- isFree: z.ZodBoolean;
42
- priceAmount: z.ZodOptional<z.ZodNumber>;
44
+ priceAmount: z.ZodDefault<z.ZodNumber>;
43
45
  priceCurrency: z.ZodOptional<z.ZodString>;
44
46
  billingPeriod: z.ZodOptional<z.ZodEnum<{
45
47
  month: "month";
@@ -70,14 +72,12 @@ export declare const DevPortalLocalManifestSchema: z.ZodObject<{
70
72
  publicHealthActionKey: z.ZodOptional<z.ZodString>;
71
73
  }, z.core.$strip>>;
72
74
  projectId: z.ZodOptional<z.ZodString>;
73
- projectName: z.ZodOptional<z.ZodString>;
74
75
  }, z.core.$strip>;
75
76
  export type ManifestPlanInput = z.infer<typeof ManifestPlanInputSchema>;
76
77
  export type DevPortalLocalManifest = z.infer<typeof DevPortalLocalManifestSchema>;
77
78
  export type DevPortalPreviewPlan = {
78
79
  sku: string;
79
80
  displayName: string;
80
- isFree: boolean;
81
81
  priceAmount: number;
82
82
  priceCurrency: string;
83
83
  billingPeriod: string;
@@ -105,5 +105,5 @@ export declare function manifestPathsForEnv(rootDir: string, _env: ApitogoManife
105
105
  };
106
106
  export declare function parseLocalManifestJson(raw: string): DevPortalLocalManifest | null;
107
107
  export declare function readManifestFile(rootDir: string, filename: string): Promise<DevPortalLocalManifest | null>;
108
- export declare function readEffectiveManifest(rootDir: string, env: ApitogoManifestEnv): Promise<DevPortalLocalManifest | null>;
108
+ export declare function readEffectiveManifest(rootDir: string, _env: ApitogoManifestEnv): Promise<DevPortalLocalManifest | null>;
109
109
  export declare function readLocalManifest(rootDir: string): Promise<DevPortalLocalManifest | null>;
@@ -134,6 +134,15 @@ export declare const ApiKeysModuleSchema: z.ZodObject<{
134
134
  enabled: z.ZodOptional<z.ZodBoolean>;
135
135
  path: z.ZodDefault<z.ZodString>;
136
136
  }, z.core.$strip>;
137
+ declare const PlanCatalogItemSchema: z.ZodObject<{
138
+ sku: z.ZodString;
139
+ displayName: z.ZodString;
140
+ priceAmount: z.ZodDefault<z.ZodNumber>;
141
+ priceCurrency: z.ZodOptional<z.ZodString>;
142
+ billingPeriod: z.ZodOptional<z.ZodString>;
143
+ limitsJson: z.ZodOptional<z.ZodString>;
144
+ includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
+ }, z.core.$strip>;
137
146
  export declare const PlansModuleSchema: z.ZodObject<{
138
147
  enabled: z.ZodOptional<z.ZodBoolean>;
139
148
  path: z.ZodDefault<z.ZodString>;
@@ -148,6 +157,15 @@ export declare const PlansModuleSchema: z.ZodObject<{
148
157
  description: z.ZodOptional<z.ZodString>;
149
158
  }, z.core.$strip>>>;
150
159
  }, z.core.$strip>>;
160
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
161
+ sku: z.ZodString;
162
+ displayName: z.ZodString;
163
+ priceAmount: z.ZodDefault<z.ZodNumber>;
164
+ priceCurrency: z.ZodOptional<z.ZodString>;
165
+ billingPeriod: z.ZodOptional<z.ZodString>;
166
+ limitsJson: z.ZodOptional<z.ZodString>;
167
+ includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
+ }, z.core.$strip>>>;
151
169
  }, z.core.$strip>;
152
170
  export declare const DashboardModuleSchema: z.ZodObject<{
153
171
  enabled: z.ZodOptional<z.ZodBoolean>;
@@ -215,6 +233,15 @@ export declare const UserPanelModuleSchema: z.ZodObject<{
215
233
  description: z.ZodOptional<z.ZodString>;
216
234
  }, z.core.$strip>>>;
217
235
  }, z.core.$strip>>;
236
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
237
+ sku: z.ZodString;
238
+ displayName: z.ZodString;
239
+ priceAmount: z.ZodDefault<z.ZodNumber>;
240
+ priceCurrency: z.ZodOptional<z.ZodString>;
241
+ billingPeriod: z.ZodOptional<z.ZodString>;
242
+ limitsJson: z.ZodOptional<z.ZodString>;
243
+ includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
+ }, z.core.$strip>>>;
218
245
  }, z.core.$strip>>;
219
246
  }, z.core.$strip>;
220
247
  export declare const ModulesSchema: z.ZodOptional<z.ZodObject<{
@@ -320,6 +347,15 @@ export declare const ModulesSchema: z.ZodOptional<z.ZodObject<{
320
347
  description: z.ZodOptional<z.ZodString>;
321
348
  }, z.core.$strip>>>;
322
349
  }, z.core.$strip>>;
350
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ sku: z.ZodString;
352
+ displayName: z.ZodString;
353
+ priceAmount: z.ZodDefault<z.ZodNumber>;
354
+ priceCurrency: z.ZodOptional<z.ZodString>;
355
+ billingPeriod: z.ZodOptional<z.ZodString>;
356
+ limitsJson: z.ZodOptional<z.ZodString>;
357
+ includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
358
+ }, z.core.$strip>>>;
323
359
  }, z.core.$strip>>;
324
360
  }, z.core.$strip>>;
325
361
  }, z.core.$strip>>;
@@ -396,6 +432,7 @@ export type ResolvedPlansModule = {
396
432
  enabled: boolean;
397
433
  path: string;
398
434
  content: ResolvedPlansContent;
435
+ items?: z.infer<typeof PlanCatalogItemSchema>[];
399
436
  };
400
437
  export type ResolvedDashboardModule = {
401
438
  enabled: boolean;
@@ -415,3 +452,4 @@ export type ResolvedModulesConfig = {
415
452
  landing: ResolvedLandingModule;
416
453
  userPanel: ResolvedUserPanelModule;
417
454
  };
455
+ export {};
@@ -6926,6 +6926,15 @@ export declare const ZudokuConfig: z.ZodObject<{
6926
6926
  description: z.ZodOptional<z.ZodString>;
6927
6927
  }, z.core.$strip>>>;
6928
6928
  }, z.core.$strip>>;
6929
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
6930
+ sku: z.ZodString;
6931
+ displayName: z.ZodString;
6932
+ priceAmount: z.ZodDefault<z.ZodNumber>;
6933
+ priceCurrency: z.ZodOptional<z.ZodString>;
6934
+ billingPeriod: z.ZodOptional<z.ZodString>;
6935
+ limitsJson: z.ZodOptional<z.ZodString>;
6936
+ includedActionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
6937
+ }, z.core.$strip>>>;
6929
6938
  }, z.core.$strip>>;
6930
6939
  }, z.core.$strip>>;
6931
6940
  }, z.core.$strip>>>;
@@ -18,4 +18,4 @@ export { cn } from "./lib/ui/util.js";
18
18
  export { joinUrl } from "./lib/util/joinUrl.js";
19
19
  export { type ProblemJson, throwIfProblemJson, } from "./lib/util/problemJson.js";
20
20
  export { buildApitogoConfig } from "./config/build-apitogo-config.js";
21
- export { APITOGO_CONFIG_FILENAME, applyEnvOverrides, extractManifest, extractSiteConfig, loadApitogoConfig, } from "./config/apitogo-config-loader.js";
21
+ export { APITOGO_CONFIG_FILENAME, applyEnvOverrides, extractManifest, extractSiteConfig, normalizeApitogoConfig, resolveProjectDisplayName, } from "./config/apitogo-config-core.js";
@@ -7,6 +7,7 @@ import type { ZudokuConfig } from "../../config/validators/ZudokuConfig.js";
7
7
  import type { AuthenticationPlugin } from "../authentication/authentication.js";
8
8
  import type { MdxComponentsType } from "../util/MdxComponents.js";
9
9
  import type { ApiIdentity, ApitogoEvents, ZudokuContext } from "./ZudokuContext.js";
10
+ export { createPlugin } from "../../config/create-plugin.js";
10
11
  export { runPluginTransformConfig } from "./transform-config.js";
11
12
  export type ApitogoPlugin = CommonPlugin | ProfileMenuPlugin | NavigationPlugin | ApiIdentityPlugin | SearchProviderPlugin | EventConsumerPlugin | AuthenticationPlugin | TransformConfigPlugin;
12
13
  export type { AuthenticationPlugin, RouteObject };
@@ -61,31 +61,43 @@ export type _Schema9 = (("Inter" | "Roboto" | "Open Sans" | "Poppins" | "Montser
61
61
  * Whether this module is active in the application.
62
62
  */
63
63
  export type _Schema15 = boolean
64
- export type _Schema35 = ({
64
+ /**
65
+ * Gateway plan catalog for /pricing preview and publish (canonical storage).
66
+ */
67
+ export type _Schema35 = {
68
+ sku: string
69
+ displayName: string
70
+ priceAmount?: number
71
+ priceCurrency?: string
72
+ billingPeriod?: string
73
+ limitsJson?: string
74
+ includedActionKeys?: string[]
75
+ }[]
76
+ export type _Schema36 = ({
65
77
  type: "url"
66
- input: (string | _Schema36[])
67
- server?: _Schema37
68
- path?: _Schema38
69
- categories?: _Schema39
70
- options?: _Schema41
78
+ input: (string | _Schema37[])
79
+ server?: _Schema38
80
+ path?: _Schema39
81
+ categories?: _Schema40
82
+ options?: _Schema42
71
83
  } | {
72
84
  type: "file"
73
- input: (string | (string | _Schema36)[])
74
- server?: _Schema37
75
- path?: _Schema38
76
- categories?: _Schema39
77
- options?: _Schema41
85
+ input: (string | (string | _Schema37)[])
86
+ server?: _Schema38
87
+ path?: _Schema39
88
+ categories?: _Schema40
89
+ options?: _Schema42
78
90
  } | {
79
91
  type: "raw"
80
92
  input: string
81
- server?: _Schema37
82
- path?: _Schema38
83
- categories?: _Schema39
84
- options?: _Schema41
93
+ server?: _Schema38
94
+ path?: _Schema39
95
+ categories?: _Schema40
96
+ options?: _Schema42
85
97
  })
86
- export type _Schema37 = string
87
98
  export type _Schema38 = string
88
- export type _Schema39 = {
99
+ export type _Schema39 = string
100
+ export type _Schema40 = {
89
101
  label: string
90
102
  tags: string[]
91
103
  }[]
@@ -369,8 +381,8 @@ export interface FlatZudokuConfig {
369
381
  landing?: _Schema16
370
382
  userPanel?: _Schema23
371
383
  }
372
- apis?: (_Schema35 | _Schema35[])
373
- catalogs?: (_Schema42 | _Schema42[])
384
+ apis?: (_Schema36 | _Schema36[])
385
+ catalogs?: (_Schema43 | _Schema43[])
374
386
  apiKeys?: {
375
387
  enabled: boolean
376
388
  getConsumers?: unknown
@@ -398,7 +410,7 @@ export interface FlatZudokuConfig {
398
410
  }
399
411
  enableStatusPages?: boolean
400
412
  defaults?: {
401
- apis: _Schema41
413
+ apis: _Schema42
402
414
  examplesLanguage?: string
403
415
  }
404
416
  __pluginDirs?: string[]
@@ -589,6 +601,7 @@ export interface _Schema23 {
589
601
  [k: string]: unknown
590
602
  }
591
603
  content?: _Schema34
604
+ items?: _Schema35
592
605
  }
593
606
  }
594
607
  /**
@@ -619,12 +632,12 @@ export interface _Schema34 {
619
632
  description?: string
620
633
  }[]
621
634
  }
622
- export interface _Schema36 {
635
+ export interface _Schema37 {
623
636
  path: string
624
637
  input: string
625
638
  label?: string
626
639
  }
627
- export interface _Schema41 {
640
+ export interface _Schema42 {
628
641
  examplesLanguage?: string
629
642
  supportedLanguages?: {
630
643
  value: string
@@ -641,7 +654,7 @@ export interface _Schema41 {
641
654
  transformExamples?: unknown
642
655
  generateCodeSnippet?: unknown
643
656
  }
644
- export interface _Schema42 {
657
+ export interface _Schema43 {
645
658
  path: string
646
659
  label: string
647
660
  items?: string[]
@@ -41,22 +41,24 @@ only.
41
41
  Set the backend API URL via environment variable (MCP writes this at scaffold/publish):
42
42
 
43
43
  ```bash
44
- VITE_APITOGO_DEV_PORTAL_API_URL=https://your-dev-portal-api.example.com
44
+ VITE_APITOGO_AUTHENTICATION_API_BASE_URL=https://your-dev-portal-api.example.com
45
45
  ```
46
46
 
47
+ You can also set `authentication.apiBaseUrl` in `apitogo.config.json` or
48
+ `APITOGO_CONFIG_authentication__apiBaseUrl` in `.env`.
49
+
47
50
  **Local preview:** When the backend URL is a placeholder or unreachable, the account area shows a
48
51
  message that sign-in unlocks after publish. Docs and API reference remain public. Plans on
49
- `/pricing` load from `apitogo.config.json` (overridable via `.env` — see
50
- [Manifest](./manifest.md), including `includedActionKeys` per plan). Plan edits hot-reload without
51
- restarting the dev server.
52
+ `/pricing` load from `apitogo.config.json` (overridable via `.env` — see [Manifest](./manifest.md),
53
+ including `includedActionKeys` per plan). Plan edits hot-reload without restarting the dev server.
52
54
 
53
55
  ### Dev portal configuration files
54
56
 
55
- | Concern | File |
56
- | ----------------------------------------------------------------- | ---------------------------------------------------------------- |
57
- | Site, plans, modules, branding, backend/gateway metadata | `apitogo.config.json` (+ `.env` overrides — see [Manifest](./manifest.md)) |
58
- | Plugins and custom code | `apitogo.config.tsx` |
59
- | OIDC and Stripe for publish | `.env.local` via `APITOGO_CONFIG_*` (or legacy `apitogo.local.secrets.json`) |
57
+ | Concern | File |
58
+ | -------------------------------------------------------- | -------------------------------------------------------------------------- |
59
+ | Site, plans, modules, branding, backend/gateway metadata | `apitogo.config.json` (+ `.env` overrides — see [Manifest](./manifest.md)) |
60
+ | Plugins and custom code | `apitogo.config.tsx` |
61
+ | OIDC and Stripe for publish | `.env.local` via `APITOGO_CONFIG_authentication__*` |
60
62
 
61
63
  **Production:** Register one OIDC app with redirect URI `https://{backend}/signin-oidc` (see MCP
62
64
  `manualSteps.oidcRedirectUri`). The frontend uses cookie sessions via `credentials: "include"` on
@@ -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 configuration file for site settings, plans,
7
- branding, backend paths, and gateway metadata. Code-only pieces (plugins, custom
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 | Purpose |
13
- | --- | --- |
14
- | `apitogo.config.json` | Committed defaults: site, modules, plans, branding, backend, gateway |
15
- | `apitogo.config.tsx` | Plugins and other non-JSON configuration |
16
- | `.env` / `.env.local` / `.env.production` | Per-environment overrides via `APITOGO_CONFIG_*` and `VITE_*` vars |
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
- ## Environment overrides
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
- "docs": { "files": "/pages/**/*.{md,mdx}" }
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
- ## What to put where
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
- - Site navigation, docs, and plugins: [`apitogo.config.tsx`](./overview.md)
105
- - Authentication for dev-portal sites: [Authentication](./authentication.md)
105
+ - [Authentication](./authentication.md)
106
+ - [Overview](./overview.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",