server/api as server endpoints. Use
that boundary so Vue components never receive the Praxa API key.
Prerequisites
Before you begin, prepare:- a trusted server runtime and application authentication boundary;
- a disposable personal workspace Praxa key with only the tutorial’s required scopes;
- synthetic input plus a persisted application request ID for replay tests;
- a fake upstream for unit tests and a non-production environment for canaries;
- an acceptance assertion that proves the Nitro route owns private runtime config and admits one replay-safe task.
1. Add private runtime config
nuxt.config.ts
NUXT_PRAXA_API_KEY in the deployment environment. Do not put it under
runtimeConfig.public.
2. Add the Nitro route
server/api/tasks.post.ts
requireApplicationUser() is your session authority. Derive the Praxa tenant
from the server-owned key; never accept a tenant, owner, scope, or key in the
request body.
3. Call the route from Vue
app/components/StartPraxaTask.vue
requestId while the same logical submission is unresolved. The
compact sample generates it in submit(); a production form should store it
with the draft before the first request and reuse it after a timeout.
4. Test the boundary
With@nuxt/test-utils or a Nitro test harness, prove:
- No application session returns
401before$fetchis called. - Invalid input returns
400before$fetchis called. - Missing private runtime config returns a safe
503. - A valid request uses the private key and ignores caller ownership fields.
- Same user and request ID produce the same idempotency key.
- Different users produce different keys.
- The response is
no-storeand contains no authorization value.
Troubleshooting
Best practices
- Pass
eventtouseRuntimeConfigin server routes. - Authenticate before reading or forwarding work.
- Bound request bodies and rate-limit per principal.
- Do not forward browser headers wholesale to Praxa.
- Reconcile admitted runs through a server-side read route.
- Scan the generated client bundle for credential-shaped values.
Nuxt server routes
Review current Nitro route and server-only code conventions in the official
Nuxt documentation.
Optimize for production
- Reuse one configured HTTP or SDK client per process and bound concurrent upstream work.
- Prefer durable admission plus asynchronous readback over holding application requests open.
- Cache only non-sensitive, tenant-scoped reads within their documented freshness window.
- Measure p50/p95 latency, admission-to-terminal time, retries, conflicts, and connection reuse before tuning.
Cleanup and next steps
- Revoke the disposable Praxa key and require a later request to fail.
- Remove synthetic application records and any temporary environment files.
- Cancel or archive unresolved test runs according to the application policy.
- Retain only redacted request, run, and verification identifiers needed for the test record.