zuplo 7.9.14 → 7.9.15
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/docs/ai-gateway/bedrock-runtime.mdx +1 -1
- package/docs/ai-gateway/custom-policies.mdx +1 -1
- package/docs/ai-gateway/fallback.mdx +1 -1
- package/docs/ai-gateway/integrations/ai-sdk.mdx +5 -5
- package/docs/ai-gateway/integrations/claude-code.mdx +6 -8
- package/docs/ai-gateway/integrations/codex.mdx +6 -5
- package/docs/ai-gateway/integrations/goose.mdx +3 -3
- package/docs/ai-gateway/integrations/langchain.mdx +1 -1
- package/docs/ai-gateway/integrations/openai.mdx +3 -3
- package/docs/ai-gateway/managing-providers.mdx +1 -1
- package/docs/ai-gateway/openrouter.mdx +14 -13
- package/docs/ai-gateway/overview.mdx +4 -2
- package/docs/ai-gateway/providers.mdx +2 -2
- package/docs/ai-gateway/source-control.mdx +61 -2
- package/docs/ai-gateway/universal-api.mdx +1 -1
- package/docs/ai-gateway/user-apps.mdx +5 -2
- package/docs/articles/accounts/audit-logs.mdx +3 -9
- package/docs/articles/environment-variables.mdx +56 -231
- package/docs/articles/graphql-support.mdx +59 -18
- package/docs/articles/local-development-env-variables.mdx +37 -8
- package/docs/articles/logging.mdx +21 -0
- package/docs/articles/opentelemetry.mdx +1 -1
- package/docs/cli/source-upgrade.mdx +39 -0
- package/docs/cli/source-upgrade.partial.mdx +11 -0
- package/docs/concepts/ai-gateway.mdx +1 -1
- package/docs/dev-portal/zudoku/guides/environment-variables.md +75 -0
- package/docs/dev-portal/zudoku-partials/guides/environment-variables.partial.md +74 -0
- package/docs/handlers/mcp-server.mdx +72 -0
- package/docs/mcp-server/overview.mdx +7 -0
- package/docs/mcp-server/tools.mdx +72 -0
- package/docs/policies/_index.md +1 -1
- package/docs/policies/ai-gateway-auth-inbound/doc.md +2 -2
- package/docs/policies/ai-gateway-configuration-executor-inbound/doc.md +3 -3
- package/docs/policies/ai-gateway-prompt-injection/doc.md +1 -2
- package/docs/policies/ai-gateway-prompt-injection/schema.json +2 -2
- package/docs/policies/ai-gateway-smart-router-inbound/doc.md +112 -29
- package/docs/policies/ai-gateway-smart-router-inbound/schema.json +109 -12
- package/docs/policies/internal-only-inbound/doc.md +206 -0
- package/docs/policies/internal-only-inbound/intro.md +10 -0
- package/docs/policies/internal-only-inbound/schema.json +75 -0
- package/docs/programmable-api/environment.mdx +220 -48
- package/docs/programmable-api/hooks.mdx +24 -0
- package/docs/programmable-api/mcp-sdk.mdx +22 -0
- package/package.json +5 -5
- package/docs/policies/ai-gateway-internal-only-inbound/doc.md +0 -102
- package/docs/policies/ai-gateway-internal-only-inbound/intro.md +0 -11
- package/docs/policies/ai-gateway-internal-only-inbound/schema.json +0 -50
|
@@ -4,23 +4,44 @@ sidebar_label: Environment Variables
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Environment variables are key-value pairs that are stored outside of source
|
|
7
|
-
code.
|
|
8
|
-
|
|
7
|
+
code. Set a different value for each environment to change behavior or
|
|
8
|
+
configuration without changing code.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
order for the updated value to take effect.
|
|
10
|
+
Variables are only applied to environments on new deployments. If you change an
|
|
11
|
+
environment variable, redeploy the environment for the updated value to take
|
|
12
|
+
effect.
|
|
14
13
|
|
|
15
|
-
Environment variables can be configuration or secrets.
|
|
16
|
-
|
|
17
|
-
write-only
|
|
14
|
+
Environment variables can be configuration or secrets. All values are stored
|
|
15
|
+
encrypted at rest, but only configuration values can be read back. Secrets are
|
|
16
|
+
write-only: you can't retrieve a secret's value after you set it.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
## Gateway and Developer Portal Variables
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
A Zuplo project has two places that read environment variables: your API gateway
|
|
21
|
+
and your [Developer Portal](../dev-portal/overview.mdx). Both use the variables
|
|
22
|
+
you set in the [editor](#environment-variable-editor), but each one gets a
|
|
23
|
+
different set of variables at a different time.
|
|
24
|
+
|
|
25
|
+
| | API gateway | Developer Portal |
|
|
26
|
+
| -------------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
27
|
+
| Variables available | All variables, including secrets | Only configuration variables whose names start with `ZUPLO_PUBLIC_` or `ZUDOKU_PUBLIC_` |
|
|
28
|
+
| When they're read | At runtime | When the portal is built |
|
|
29
|
+
| Who can see values | Only your gateway code | Anyone who visits the portal, because values are embedded in the published site |
|
|
30
|
+
| How to read them | `environment.VAR_NAME` in code, `$env(VAR_NAME)` in config files | `process.env.VAR_NAME` in `zudoku.config.tsx`, `import.meta.env.VAR_NAME` in components |
|
|
31
|
+
| Variables Zuplo sets | `ZUPLO_ENVIRONMENT_STAGE`, `ZUPLO_ENVIRONMENT_NAME`, and others | `ZUPLO_ENVIRONMENT_TYPE`, `ZUPLO_SERVER_URL`, and `ZUPLO_BUILD_ID` |
|
|
32
|
+
| Reference | [Gateway environment variables](../programmable-api/environment.mdx) | [Dev Portal environment variables](../dev-portal/zudoku/guides/environment-variables.md) |
|
|
33
|
+
|
|
34
|
+
Your gateway can also read `ZUPLO_PUBLIC_` and `ZUDOKU_PUBLIC_` variables. Never
|
|
35
|
+
put a secret in a variable with one of these prefixes. Zuplo doesn't send secret
|
|
36
|
+
variables to the Developer Portal build, even if their names have a public
|
|
37
|
+
prefix.
|
|
38
|
+
|
|
39
|
+
:::caution{title="Same name, different values"}
|
|
40
|
+
|
|
41
|
+
`ZUPLO_ENVIRONMENT_TYPE` means different things in the gateway and in the
|
|
42
|
+
Developer Portal build. To check whether the code is running in production, use
|
|
43
|
+
`ZUPLO_ENVIRONMENT_STAGE` in your gateway (`production`) and
|
|
44
|
+
`ZUPLO_ENVIRONMENT_TYPE` in your Developer Portal (`PRODUCTION`).
|
|
24
45
|
|
|
25
46
|
:::
|
|
26
47
|
|
|
@@ -38,7 +59,8 @@ To create a new variable, click **Add variable**.
|
|
|
38
59
|
</ModalScreenshot>
|
|
39
60
|
|
|
40
61
|
Enter the name and value of your environment variable and select if you would
|
|
41
|
-
like the value to be a secret or a regular value.
|
|
62
|
+
like the value to be a secret or a regular value. Values take effect on the next
|
|
63
|
+
deployment of each environment.
|
|
42
64
|
|
|
43
65
|
## Environments
|
|
44
66
|
|
|
@@ -68,224 +90,27 @@ variable named `MY_VAR` can't be set on say the **Production** environments.
|
|
|
68
90
|
|
|
69
91
|
## Reserved Environment Variables
|
|
70
92
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
If you need a variable that's exposed to the
|
|
75
|
-
[Developer Portal](../dev-portal/overview.mdx) build, prefix it with
|
|
76
|
-
`ZUPLO_PUBLIC_` (or `ZUDOKU_PUBLIC_`). Public-prefixed variables are bundled
|
|
77
|
-
into the portal's static output and **must not contain secrets**, as they're
|
|
78
|
-
visible to anyone who loads the page.
|
|
79
|
-
|
|
80
|
-
## Using Environment Variables
|
|
81
|
-
|
|
82
|
-
Environment variables can be used in several places in your Zuplo project. Each
|
|
83
|
-
location has its own syntax:
|
|
84
|
-
|
|
85
|
-
| Location | Syntax | Resolved |
|
|
86
|
-
| ----------------------------------------------------- | ---------------------- | --------------------- |
|
|
87
|
-
| Custom code (handlers, policies, hooks) | `environment.VAR_NAME` | Runtime |
|
|
88
|
-
| Configuration files (`policies.json`, OpenAPI routes) | `$env(VAR_NAME)` | Build time |
|
|
89
|
-
| URL Rewrite, URL Forward, and WebSocket handlers | `${env.VAR_NAME}` | Runtime (per request) |
|
|
90
|
-
| Developer Portal config (`zudoku.config.ts`) | `process.env.VAR_NAME` | Portal build time |
|
|
91
|
-
|
|
92
|
-
### In Code
|
|
93
|
-
|
|
94
|
-
Variables are accessed through the `environment` object from `@zuplo/runtime`.
|
|
95
|
-
See the
|
|
96
|
-
[Environment Variables API Reference](../programmable-api/environment.mdx) for
|
|
97
|
-
detailed usage examples and patterns.
|
|
98
|
-
|
|
99
|
-
```ts
|
|
100
|
-
import { environment } from "@zuplo/runtime";
|
|
101
|
-
|
|
102
|
-
const apiKey = environment.API_KEY; // string | undefined
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### In Configuration Files
|
|
106
|
-
|
|
107
|
-
Inside policy options, route handler options, and CORS policy options,
|
|
108
|
-
environment variables can be referenced with the `$env(VAR_NAME)` pattern.
|
|
109
|
-
Substitutions happen at build time — the build replaces each `$env()` expression
|
|
110
|
-
with a reference to the runtime `environment` object before the project is
|
|
111
|
-
deployed.
|
|
112
|
-
|
|
113
|
-
#### Where `$env()` is allowed
|
|
114
|
-
|
|
115
|
-
- `config/policies.json` — any property under `policies[].handler.options`,
|
|
116
|
-
including nested objects and array elements
|
|
117
|
-
- `config/policies.json` — any direct property of a `corsPolicies[]` entry, such
|
|
118
|
-
as `allowedOrigins`, `allowedHeaders`, `allowedMethods`, `exposeHeaders`, and
|
|
119
|
-
`maxAge`
|
|
120
|
-
- `config/routes.oas.json` (and other OpenAPI route files) — any property under
|
|
121
|
-
a route's `x-zuplo-route.handler.options`, including nested objects and array
|
|
122
|
-
elements
|
|
123
|
-
|
|
124
|
-
`$env()` is **not** allowed in other locations such as policy `name`,
|
|
125
|
-
`policyType`, `module`, route paths, or top-level OpenAPI fields. Using it
|
|
126
|
-
elsewhere produces a build error:
|
|
127
|
-
|
|
128
|
-
```text
|
|
129
|
-
An $env() statement is not expected at this location.
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
#### Standalone substitution
|
|
133
|
-
|
|
134
|
-
When the value is _only_ an `$env()` expression, the variable's value is
|
|
135
|
-
inserted directly. The runtime type matches the type of the environment variable
|
|
136
|
-
(always a string when set, `undefined` when not).
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
{
|
|
140
|
-
"name": "my-custom-code-inbound-policy",
|
|
141
|
-
"policyType": "custom-code-inbound",
|
|
142
|
-
"handler": {
|
|
143
|
-
"export": "default",
|
|
144
|
-
"module": "$import(./modules/YOUR_MODULE)",
|
|
145
|
-
"options": {
|
|
146
|
-
"apiKey": "$env(BACKEND_API_KEY)",
|
|
147
|
-
"config2": true
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
#### String interpolation
|
|
154
|
-
|
|
155
|
-
You can mix `$env()` with literal text to compose a value. The build wraps the
|
|
156
|
-
result in a JavaScript template literal that's evaluated at runtime, so each
|
|
157
|
-
request gets the current value of the variable.
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"options": {
|
|
162
|
-
"endpoint": "https://$env(API_HOST)/v1",
|
|
163
|
-
"userAgent": "MyGateway/$env(APP_VERSION) ($env(ENVIRONMENT_NAME))"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
:::note
|
|
169
|
-
|
|
170
|
-
If the variable isn't set, the interpolated portion resolves to an empty string.
|
|
171
|
-
For example, with `API_HOST` unset, `"https://$env(API_HOST)/v1"` becomes
|
|
172
|
-
`"https:///v1"`. Use a standalone `$env()` (no surrounding text) if you need to
|
|
173
|
-
detect an unset variable in your handler or policy code.
|
|
93
|
+
Names that start with `ZUPLO_`, `__ZUPLO`, or `ZUDOKU_` are reserved for Zuplo,
|
|
94
|
+
with these exceptions:
|
|
174
95
|
|
|
175
|
-
|
|
96
|
+
- `ZUPLO_PUBLIC_` and `ZUDOKU_PUBLIC_` are allowed. Use them for values your
|
|
97
|
+
Developer Portal needs.
|
|
98
|
+
- A few Zuplo settings, such as `ZUPLO_LOG_LEVEL`, are allowed.
|
|
176
99
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
`$env()` works inside string array elements, including mixed arrays where some
|
|
180
|
-
elements are static and others are interpolated:
|
|
181
|
-
|
|
182
|
-
```json
|
|
183
|
-
{
|
|
184
|
-
"options": {
|
|
185
|
-
"allowedKeys": ["$env(PRIMARY_KEY)", "$env(SECONDARY_KEY)"],
|
|
186
|
-
"tags": ["public", "$env(REGION)", "tier-$env(SERVICE_TIER)"]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
#### In nested objects
|
|
192
|
-
|
|
193
|
-
`$env()` works at any depth within a handler or policy `options` object:
|
|
194
|
-
|
|
195
|
-
```json
|
|
196
|
-
{
|
|
197
|
-
"options": {
|
|
198
|
-
"database": {
|
|
199
|
-
"host": "$env(DB_HOST)",
|
|
200
|
-
"credentials": {
|
|
201
|
-
"username": "$env(DB_USER)",
|
|
202
|
-
"password": "$env(DB_PASSWORD)"
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
#### Variable name rules
|
|
210
|
-
|
|
211
|
-
The name inside `$env(...)` is matched literally up to the first closing
|
|
212
|
-
parenthesis. Use only letters, digits, and underscores in the name — matching
|
|
213
|
-
what the [Zuplo Portal](#environment-variable-editor) accepts when you create
|
|
214
|
-
the variable.
|
|
215
|
-
|
|
216
|
-
### Rewrite, Forwarding, and WebSocket Handlers
|
|
217
|
-
|
|
218
|
-
The URL Rewrite handler's `rewritePattern`, the URL Forward handler's `baseUrl`,
|
|
219
|
-
and the WebSocket handler's `rewritePattern` use a different syntax. These
|
|
220
|
-
options are evaluated as JavaScript template literals at request time, so you
|
|
221
|
-
reference variables with `${env.VAR_NAME}`:
|
|
222
|
-
|
|
223
|
-
```json
|
|
224
|
-
{
|
|
225
|
-
"handler": {
|
|
226
|
-
"export": "urlForwardHandler",
|
|
227
|
-
"module": "$import(@zuplo/runtime)",
|
|
228
|
-
"options": {
|
|
229
|
-
"baseUrl": "https://${env.BACKEND_HOST}"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
Because `rewritePattern` and `baseUrl` run as code, they also have access to the
|
|
236
|
-
request, URL parts, route params, and query string. See the
|
|
237
|
-
[URL Rewrite Handler](../handlers/url-rewrite.mdx) docs for the full list of
|
|
238
|
-
available variables.
|
|
239
|
-
|
|
240
|
-
:::caution
|
|
241
|
-
|
|
242
|
-
Using `$env(VAR_NAME)` inside `rewritePattern` or `baseUrl` is the most common
|
|
243
|
-
mistake. The build will warn you when it detects this, but the value will be
|
|
244
|
-
passed through to the handler as a literal string and the rewrite will fail at
|
|
245
|
-
runtime. Always use `${env.VAR_NAME}` in these two options.
|
|
100
|
+
Use only letters, digits, and underscores in variable names.
|
|
246
101
|
|
|
247
|
-
|
|
102
|
+
## Local Development
|
|
103
|
+
|
|
104
|
+
Local development doesn't use the variables you set in the Zuplo Portal. Your
|
|
105
|
+
local gateway reads variables from a `.env` file in your project, and your local
|
|
106
|
+
Developer Portal reads them from a `.env` file in its own folder. See
|
|
107
|
+
[Configuring Environment Variables Locally](./local-development-env-variables.mdx).
|
|
108
|
+
|
|
109
|
+
## Next Steps
|
|
248
110
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const config: ZudokuConfig = {
|
|
256
|
-
authentication: {
|
|
257
|
-
type: "auth0",
|
|
258
|
-
domain: process.env.ZUPLO_PUBLIC_AUTH0_DOMAIN,
|
|
259
|
-
clientId: process.env.ZUPLO_PUBLIC_AUTH0_CLIENT_ID,
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export default config;
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
Only variables prefixed with `ZUPLO_PUBLIC_` (or `ZUDOKU_PUBLIC_`) are available
|
|
267
|
-
in the portal build, and their values are embedded into the client-side bundle.
|
|
268
|
-
Don't use this prefix for any value that should remain private.
|
|
269
|
-
|
|
270
|
-
## System Environment Variables
|
|
271
|
-
|
|
272
|
-
The following variables are automatically set by the system and are available to
|
|
273
|
-
use in your code:
|
|
274
|
-
|
|
275
|
-
- `ZUPLO_ENVIRONMENT_TYPE` - The current environment type the API is running.
|
|
276
|
-
Values are `edge`, `local`.
|
|
277
|
-
- `ZUPLO_ENVIRONMENT_STAGE` - The stage of the environment. Values are
|
|
278
|
-
`production`, `preview`, `working-copy`, and `local`.
|
|
279
|
-
- `ZUPLO_ENVIRONMENT_NAME` - The name of the environment. This is a globally
|
|
280
|
-
unique name for the environment. This is the same name that's used in the URL
|
|
281
|
-
of the environment. For example, `my-project-main-1235.zuplo.app`. Setting a
|
|
282
|
-
custom domain on the environment won't change this value.
|
|
283
|
-
- `ZUPLO_ACCOUNT_NAME` - The name of the Zuplo account where the environment is
|
|
284
|
-
deployed.
|
|
285
|
-
- `ZUPLO_PROJECT_NAME` - The name of the project where the environment is
|
|
286
|
-
deployed.
|
|
287
|
-
- `ZUPLO_BUILD_ID` - The build ID of the environment. This is a unique ID for
|
|
288
|
-
each build of the environment. This is a UUID.
|
|
289
|
-
- `ZUPLO_COMPATIBILITY_DATE` - The
|
|
290
|
-
[compatibility date](../programmable-api/compatibility-dates.mdx) of runtime
|
|
291
|
-
environment.
|
|
111
|
+
- [Gateway environment variables](../programmable-api/environment.mdx): read
|
|
112
|
+
variables in code, policies, route handlers, and URL rewrites, and the
|
|
113
|
+
variables Zuplo sets for your gateway.
|
|
114
|
+
- [Dev Portal environment variables](../dev-portal/zudoku/guides/environment-variables.md):
|
|
115
|
+
read variables in `zudoku.config.tsx` and components, and the variables Zuplo
|
|
116
|
+
sets when it builds your portal.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
sidebar_label:
|
|
2
|
+
title: Using Zuplo with GraphQL APIs
|
|
3
|
+
sidebar_label: GraphQL overview
|
|
4
4
|
description:
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Zuplo fully supports GraphQL APIs. Proxy your GraphQL server through the
|
|
6
|
+
gateway to add auth, rate limiting, caching, and GraphQL-specific policies.
|
|
7
7
|
tags:
|
|
8
8
|
- backends
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
Zuplo
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
**Yes, Zuplo supports GraphQL.** Zuplo is a proxy-based API gateway, and a
|
|
12
|
+
GraphQL API is just an HTTP endpoint — typically a single `POST /graphql` route.
|
|
13
|
+
Proxy your existing GraphQL server through Zuplo, then layer on authentication,
|
|
14
|
+
rate limiting, caching, analytics, and documentation using the same policies you
|
|
15
|
+
use for REST, plus policies built specifically for the GraphQL request shape.
|
|
16
16
|
|
|
17
|
-
This page summarizes
|
|
18
|
-
policy reference.
|
|
17
|
+
This page summarizes everything Zuplo offers for GraphQL APIs and links to each
|
|
18
|
+
guide and policy reference.
|
|
19
19
|
|
|
20
20
|
:::tip{title="New here?"}
|
|
21
21
|
|
|
@@ -28,8 +28,9 @@ the gateway, then come back to layer on the capabilities below.
|
|
|
28
28
|
|
|
29
29
|
Proxy any GraphQL server through a `POST /graphql` route using the
|
|
30
30
|
[URL Rewrite handler](../handlers/url-rewrite.mdx). The Route Designer ships a
|
|
31
|
-
**GraphQL Endpoint** template, and the `x-graphql` route extension
|
|
32
|
-
|
|
31
|
+
**GraphQL Endpoint** template, and the `x-graphql` route extension (a boolean
|
|
32
|
+
flag in `routes.oas.json` — set `"x-graphql": true` on the route operation)
|
|
33
|
+
marks a route as GraphQL so the gateway and Dev Portal treat it accordingly.
|
|
33
34
|
|
|
34
35
|
- [Set up an endpoint](./graphql.mdx) — add or mark a GraphQL route
|
|
35
36
|
|
|
@@ -48,6 +49,20 @@ schema through introspection. Zuplo closes these gaps at the edge.
|
|
|
48
49
|
- [Secure your GraphQL API](./graphql-security.mdx) — complexity limits and
|
|
49
50
|
introspection controls
|
|
50
51
|
|
|
52
|
+
## Authenticate and rate-limit
|
|
53
|
+
|
|
54
|
+
Because a GraphQL route is a standard Zuplo route, every general-purpose policy
|
|
55
|
+
works on it — including authentication and rate limiting. Attach an API key auth
|
|
56
|
+
policy or any other auth policy as an inbound policy on the `POST /graphql`
|
|
57
|
+
route, then add a rate limiting policy to protect your upstream from traffic
|
|
58
|
+
spikes. No GraphQL-specific configuration is required; these policies operate on
|
|
59
|
+
the HTTP request before the GraphQL-specific policies run.
|
|
60
|
+
|
|
61
|
+
- [API key authentication](./api-key-authentication.mdx) — authenticate
|
|
62
|
+
consumers with API keys
|
|
63
|
+
- [Rate limiting](../rate-limiting/getting-started.mdx) — throttle requests per
|
|
64
|
+
consumer, IP, or globally
|
|
65
|
+
|
|
51
66
|
## Accelerate with caching
|
|
52
67
|
|
|
53
68
|
A normal CDN keys on the URL, so it can't cache GraphQL queries sent as request
|
|
@@ -60,15 +75,18 @@ form, and serves semantically identical queries from one edge cache entry.
|
|
|
60
75
|
## Observe traffic
|
|
61
76
|
|
|
62
77
|
Report GraphQL operations and their errors to analytics, even when the upstream
|
|
63
|
-
returns errors inside a `200` response
|
|
64
|
-
|
|
78
|
+
returns errors inside a `200` response (GraphQL servers signal per-field errors
|
|
79
|
+
in the response body rather than with HTTP status codes). The GraphQL analytics
|
|
80
|
+
dashboard surfaces operation volume, latency, and error classes once traffic
|
|
81
|
+
flows.
|
|
65
82
|
|
|
66
83
|
- [GraphQL analytics](../analytics/tabs/graphql.md) — monitor operations,
|
|
67
84
|
latency, and errors
|
|
68
85
|
|
|
69
86
|
## Document in the Dev Portal
|
|
70
87
|
|
|
71
|
-
The `@zudoku/plugin-graphql`
|
|
88
|
+
The `@zudoku/plugin-graphql` Dev Portal plugin (an npm package included with
|
|
89
|
+
[Zudoku](https://zudoku.dev)) renders a browsable type reference and an
|
|
72
90
|
interactive playground in your Dev Portal, generated from your schema or a live
|
|
73
91
|
endpoint. Register one instance per API.
|
|
74
92
|
|
|
@@ -77,12 +95,35 @@ endpoint. Register one instance per API.
|
|
|
77
95
|
|
|
78
96
|
## Expose GraphQL to AI agents
|
|
79
97
|
|
|
80
|
-
Turn GraphQL queries into MCP tools
|
|
81
|
-
|
|
98
|
+
Turn GraphQL queries into MCP tools — MCP (Model Context Protocol) is a standard
|
|
99
|
+
that lets AI agents discover and call API operations — so AI agents can call
|
|
100
|
+
your GraphQL API with the same policies and auth applied.
|
|
82
101
|
|
|
83
102
|
- [MCP Server GraphQL endpoints](../mcp-server/graphql.mdx) — expose queries as
|
|
84
103
|
MCP tools
|
|
85
104
|
|
|
105
|
+
## Zuplo and GraphQL federation
|
|
106
|
+
|
|
107
|
+
Zuplo is a proxy-based API gateway, not a native GraphQL federation gateway. It
|
|
108
|
+
does not perform schema composition, query planning, or subgraph orchestration —
|
|
109
|
+
those are the job of a dedicated federation layer such as Apollo Router or a
|
|
110
|
+
similar tool.
|
|
111
|
+
|
|
112
|
+
When you use a federated architecture, Zuplo sits **in front of** your
|
|
113
|
+
federation gateway as the public-facing entry point. Traffic flows through Zuplo
|
|
114
|
+
first for authentication, rate limiting, and analytics, then Zuplo forwards the
|
|
115
|
+
request to Apollo Router (or your federation tool of choice), which resolves the
|
|
116
|
+
query across your subgraphs. This layered pattern gives you edge-level security
|
|
117
|
+
and observability without interfering with the federation layer's query
|
|
118
|
+
planning.
|
|
119
|
+
|
|
120
|
+
```text title="Request flow with federation"
|
|
121
|
+
Client → Zuplo (auth, rate limit, analytics) → Apollo Router → Subgraphs
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If your GraphQL API is a single server (no federation), Zuplo connects to it
|
|
125
|
+
directly and no federation layer is needed.
|
|
126
|
+
|
|
86
127
|
## Policies at a glance
|
|
87
128
|
|
|
88
129
|
Every GraphQL-aware policy Zuplo ships, with its direction and purpose:
|
|
@@ -3,21 +3,50 @@ title: "Configuring Environment Variables Locally"
|
|
|
3
3
|
sidebar_label: Environment variables
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
For security reasons,
|
|
7
|
-
|
|
8
|
-
your local Zuplo Gateway will load environment variables from a .env file.
|
|
6
|
+
For security reasons, local development doesn't have access to the environment
|
|
7
|
+
variables that you set in the Zuplo Portal. Instead, set them in `.env` files.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Your gateway and your Developer Portal read different files, just as they read
|
|
10
|
+
different variables when deployed. See
|
|
11
|
+
[Gateway and Developer Portal Variables](./environment-variables.mdx#gateway-and-developer-portal-variables).
|
|
12
12
|
|
|
13
13
|
:::warning
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
`.env` files can contain sensitive information, so don't commit them to source
|
|
16
|
+
control. Add `.env` to your `.gitignore` file.
|
|
17
17
|
|
|
18
18
|
:::
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## Gateway Variables
|
|
21
|
+
|
|
22
|
+
Your local gateway loads environment variables from a `.env` file in the root of
|
|
23
|
+
your project:
|
|
24
|
+
|
|
25
|
+
```txt title=".env"
|
|
21
26
|
KEY1=VALUE1
|
|
22
27
|
KEY2=VALUE2
|
|
23
28
|
```
|
|
29
|
+
|
|
30
|
+
Read them the same way as in a deployed gateway. See
|
|
31
|
+
[Gateway environment variables](../programmable-api/environment.mdx).
|
|
32
|
+
|
|
33
|
+
When you run `zuplo dev`, `ZUPLO_ENVIRONMENT_STAGE` is `local`.
|
|
34
|
+
|
|
35
|
+
`zuplo link` writes a `.env.zuplo` file with details about the linked account,
|
|
36
|
+
project, and environment. `zuplo dev` loads it along with `.env`. Don't edit
|
|
37
|
+
`.env.zuplo`; `zuplo link` replaces it each time it runs. Put your own variables
|
|
38
|
+
in `.env`.
|
|
39
|
+
|
|
40
|
+
## Developer Portal Variables
|
|
41
|
+
|
|
42
|
+
Your local Developer Portal reads variables from a `.env` file in the portal's
|
|
43
|
+
own folder (usually `docs/`), not from the gateway's `.env` file. As in a
|
|
44
|
+
deployed portal, only variables that start with `ZUPLO_PUBLIC_` or
|
|
45
|
+
`ZUDOKU_PUBLIC_` are available:
|
|
46
|
+
|
|
47
|
+
```txt title="docs/.env"
|
|
48
|
+
ZUPLO_PUBLIC_AUTH0_DOMAIN=my-tenant.us.auth0.com
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
See
|
|
52
|
+
[Dev Portal environment variables](../dev-portal/zudoku/guides/environment-variables.md).
|
|
@@ -11,6 +11,27 @@ To configure your logging, you need to create a `zuplo.runtime.ts` file in the
|
|
|
11
11
|
`modules`. The examples below show the content of the file with each of the
|
|
12
12
|
different logging plugins.
|
|
13
13
|
|
|
14
|
+
## Viewing logs in the portal
|
|
15
|
+
|
|
16
|
+
Every Zuplo project has a built-in log viewer in the Zuplo Portal that shows
|
|
17
|
+
request logs and messages logged with `context.log`. Open your
|
|
18
|
+
[project](https://portal.zuplo.com/+/account/project/), go to **Observability →
|
|
19
|
+
Logs**, and use the **Environment** filter to choose the environment to view.
|
|
20
|
+
How far back you can search depends on your plan. See
|
|
21
|
+
[Data retention](../analytics/access-and-entitlements.md#data-retention).
|
|
22
|
+
|
|
23
|
+
The viewer supports time-range presets, drag-to-zoom on the histogram, free-text
|
|
24
|
+
search, and filters for severity, status, method, and route. Live mode streams
|
|
25
|
+
new entries as they arrive and pauses automatically, for example when you select
|
|
26
|
+
a request to inspect it.
|
|
27
|
+
|
|
28
|
+
Logs are also available at the account scope, so you can debug across every
|
|
29
|
+
project in an account in one place. Open
|
|
30
|
+
[**Observability → Logs**](https://portal.zuplo.com/+/account/observability/logs)
|
|
31
|
+
at the account level, then use the **Project** filter in the sidebar to narrow
|
|
32
|
+
the view to a single project. The account view includes logs only from projects
|
|
33
|
+
where your [role](./accounts/roles-and-permissions.mdx) lets you view logs.
|
|
34
|
+
|
|
14
35
|
## Log Integrations
|
|
15
36
|
|
|
16
37
|
Zuplo offers out-of-the box integrations with many common logging vendors. For
|
|
@@ -276,7 +276,7 @@ Set `ratio` to a constant to use one value everywhere. Zuplo populates
|
|
|
276
276
|
`ZUPLO_ENVIRONMENT_STAGE`, which reads `working-copy` in your working copy and
|
|
277
277
|
`production`, `preview`, or `local` elsewhere, so local development
|
|
278
278
|
(`zuplo dev`) samples at 10% along with deployed environments. See
|
|
279
|
-
[system environment variables](
|
|
279
|
+
[system environment variables](../programmable-api/environment.mdx#system-environment-variables)
|
|
280
280
|
for the full list.
|
|
281
281
|
|
|
282
282
|
By default, traces whose root span ends in an error are exported whatever the
|
|
@@ -7,6 +7,19 @@ sidebar_label: source upgrade
|
|
|
7
7
|
command="source upgrade"
|
|
8
8
|
description="Updates your project structure to the latest conventions"
|
|
9
9
|
options={[
|
|
10
|
+
{
|
|
11
|
+
"name": "type",
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Upgrade project scaffolding (api) or preview AI Gateway template additions",
|
|
14
|
+
"default": "api",
|
|
15
|
+
"required": false,
|
|
16
|
+
"deprecated": false,
|
|
17
|
+
"hidden": false,
|
|
18
|
+
"choices": [
|
|
19
|
+
"api",
|
|
20
|
+
"ai-gateway"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
10
23
|
{
|
|
11
24
|
"name": "dir",
|
|
12
25
|
"type": "string",
|
|
@@ -16,6 +29,15 @@ sidebar_label: source upgrade
|
|
|
16
29
|
"deprecated": false,
|
|
17
30
|
"hidden": true,
|
|
18
31
|
"normalize": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "apply",
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Apply verified AI Gateway additions after preview and confirmation",
|
|
37
|
+
"default": false,
|
|
38
|
+
"required": false,
|
|
39
|
+
"deprecated": false,
|
|
40
|
+
"hidden": false
|
|
19
41
|
}
|
|
20
42
|
]}
|
|
21
43
|
examples={[
|
|
@@ -26,6 +48,14 @@ sidebar_label: source upgrade
|
|
|
26
48
|
[
|
|
27
49
|
"$0 source upgrade --dir ./my-zuplo-project",
|
|
28
50
|
"Specify the project directory path"
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
"$0 source upgrade --type ai-gateway",
|
|
54
|
+
"Preview versioned AI Gateway additions without changing files"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"$0 source upgrade --type ai-gateway --apply",
|
|
58
|
+
"Validate, preview, and confirm AI Gateway additions"
|
|
29
59
|
]
|
|
30
60
|
]}
|
|
31
61
|
usage="$0 source upgrade [options]"
|
|
@@ -33,6 +63,11 @@ sidebar_label: source upgrade
|
|
|
33
63
|
|
|
34
64
|
## Upgrade a source-controlled AI Gateway
|
|
35
65
|
|
|
66
|
+
An AI Gateway connected to source control doesn't receive new routes and
|
|
67
|
+
policies from the template automatically. See
|
|
68
|
+
[Keep the gateway up to date](../ai-gateway/source-control.mdx#keep-the-gateway-up-to-date)
|
|
69
|
+
for when to run this command and how to deploy the result.
|
|
70
|
+
|
|
36
71
|
Preview missing AI Gateway v2 endpoints and policies from the template bundled
|
|
37
72
|
with your CLI:
|
|
38
73
|
|
|
@@ -75,3 +110,7 @@ The following global options are available for all commands:
|
|
|
75
110
|
|
|
76
111
|
- [`--help`](./global-options.mdx#help)
|
|
77
112
|
- [`--api-key`](./global-options.mdx#api-key)
|
|
113
|
+
|
|
114
|
+
## Additional resources
|
|
115
|
+
|
|
116
|
+
- [AI Gateway Source Control](../ai-gateway/source-control.mdx)
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
additional-resources:
|
|
3
|
+
- name: AI Gateway Source Control
|
|
4
|
+
href: ../ai-gateway/source-control.mdx
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
## Upgrade a source-controlled AI Gateway
|
|
2
8
|
|
|
9
|
+
An AI Gateway connected to source control doesn't receive new routes and
|
|
10
|
+
policies from the template automatically. See
|
|
11
|
+
[Keep the gateway up to date](../ai-gateway/source-control.mdx#keep-the-gateway-up-to-date)
|
|
12
|
+
for when to run this command and how to deploy the result.
|
|
13
|
+
|
|
3
14
|
Preview missing AI Gateway v2 endpoints and policies from the template bundled
|
|
4
15
|
with your CLI:
|
|
5
16
|
|
|
@@ -53,7 +53,7 @@ Every app exposes an OpenAI-compatible
|
|
|
53
53
|
[Universal API](../ai-gateway/universal-api.mdx). Point any SDK that supports a
|
|
54
54
|
custom base URL at the app's gateway URL, send the app's API key as a bearer
|
|
55
55
|
token, and reference models as `providerName/model` (for example
|
|
56
|
-
`openai/gpt-
|
|
56
|
+
`openai/gpt-6-luna`). One app can use models from several providers through the
|
|
57
57
|
same endpoint, so switching providers is a configuration change rather than a
|
|
58
58
|
code change.
|
|
59
59
|
|