You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: server-side usage, drop publishable-key promise, add Human Design and Forecast
Rewrite getting-started and integration docs around server-side usage with a secret key, since browser-safe publishable keys are not shipped yet. Start with one component now mirrors the SDK quick start: one typed call, render the result. Remove every publishable-key instruction from the README, AGENTS, and examples; widgets auto-mount is labelled coming soon. The server-rendered section loads the bundle once.
Add Human Design and Forecast to the most-used-components guide in canonical order, and rework the vanilla, vue, and WordPress examples to fetch server side and inline the response so no key ships to the browser.
Every chart endpoint accepts `timezone` as either a decimal-hour offset (`5.5` for IST, `-5` for EST) or an IANA name (`'Asia/Kolkata'`, `'America/New_York'`). The decimal form is what `/location/search` returns; the IANA form is correct over DST boundaries. Pick one and stay consistent in a single integration. Mixing them does not break the API but makes the bug surface area larger.
122
122
123
-
### 4. Secret key in the browser
123
+
### 4. API key in the browser
124
124
125
-
There are two key classes. **Secret keys are unprefixed** and grant full access; they belong server-side only (Node, Bun, Hono, Next.js route handlers, Workers, Edge functions). **Publishable keys** are prefixed `pk_live_*` or `pk_test_*` and are safe in the browser; they are locked to an origin allowlist at the API gateway. For widgets, embeds, vanilla HTML, and `data-publishable-key` use the publishable key. For the typed SDK on a server, use the secret key.
125
+
Keys are server side only. Call `createRoxy(process.env.ROXY_API_KEY!)` on your server(Node, Bun, Hono, Next.js route handlers, Workers, Edge functions), then send the response, not the key, to the component. Never ship the key in a client bundle. Browser-safe keys for direct client-side embedding are on the roadmap, not yet available.
126
126
127
127
```ts
128
-
// Server (Next.js route handler, Workers, Bun): secret key
### 5. Missing `'use client'` in Next.js App Router
@@ -194,49 +191,49 @@ import type { NatalChartResponse } from '@roxyapi/sdk';
194
191
195
192
### Pattern 1: vanilla HTML, no build step
196
193
194
+
Fetch on your server with the secret key, then inline the response into the component as a child `<script type="application/json" class="roxy-data">`. The component reads it on load. No key in the browser.
Setting the JavaScript `data` property always wins over the inlined JSON, so the same element also drives dynamic pages.
210
+
211
+
### Pattern 2: React, interactive
212
+
213
+
`<RoxyLocationSearch>` runs in the browser. On select, call your own route, which holds the secret key, and set the returned data on the chart. The key never reaches the client.
@@ -248,51 +245,33 @@ export function BirthChartView() {
248
245
}
249
246
```
250
247
248
+
For a static chart with no picker, fetch in a Server Component and pass `data` to a client component (Pattern 6).
249
+
251
250
### Pattern 3: schema-driven form
252
251
253
-
`<roxy-endpoint-form>` reads the OpenAPI spec and renders the inputs for any endpoint. Listen for the `roxy-submit` event with the validated payload.
252
+
`<roxy-endpoint-form>` reads the OpenAPI spec and renders the inputs for any endpoint. On `roxy-submit`, POST the validated values to your own route, which calls the SDK with the secret key, then set the returned data on the target component.
### Pattern 4: widgets auto-mount (no JavaScript wiring)
275
-
276
-
Use a publishable key (`pk_live_*` or `pk_test_*`) for client-side embeds. Get one at <https://roxyapi.com/account>. Publishable keys are origin-restricted at the API gateway. Register the customer domain (e.g. `https://customer.com`) when creating the key, and the gateway will reject requests from any other origin. Never use a secret key in client-side code (secret keys are unprefixed and live server-side only).
The auto-mount script reads `data-*` attributes, calls the matching endpoint, and renders the matching component.
274
+
A zero-wiring embed that reads `data-*` attributes and renders the matching component is on the roadmap. It needs browser-safe keys, which are not yet available. Until then, use Pattern 1 (inline JSON) for no-build pages.
296
275
297
276
### Pattern 5: MCP tool-call response
298
277
@@ -396,7 +375,7 @@ Every visible aspect of the chart is driven by `--roxy-*` CSS custom properties
396
375
397
376
## Domain ordering
398
377
399
-
When listing domains in user-visible copy, use the canonical order: Western astrology, Vedic astrology, numerology, tarot, biorhythm, I Ching, crystals, dreams, angel numbers. Location is utility, not a selling domain.
378
+
When listing domains in user-visible copy, use the canonical order: Western astrology, Vedic astrology, numerology, tarot, human design, forecast, biorhythm, I Ching, crystals, dreams, angel numbers. Location is utility, not a selling domain.
> **Unwrap `data` before passing to the component.** The SDK returns `{ data, error, request, response }`. Pass the envelope and the chart renders `[object Object]`. This is the most common integration bug.
In production, geocode the user's city with `<roxy-location-search>` (see [Quick start](#quick-start)) instead of hardcoding coordinates.
237
+
Then expand into natal charts, kundli, dasha, tarot, and every other domain. The SDK returns `data`, the component renders it; the same pairing holds for all 32 components.
238
+
239
+
> **Pass `data`, not the envelope.** The SDK returns `{ data, error, request, response }`. Pass `data`, or the component renders `[object Object]`. This is the most common integration bug.
240
+
241
+
The key stays on your server. Vanilla HTML or a server-rendered page fetches the same way, then [inlines the JSON into the component](#server-rendered-no-javascript-wiring): no build step, no key in the browser. Try every component in the [live demo](https://roxyapi.github.io/ui/), each with Preview, Code, and shadcn tabs and a live color customizer.
Server-rendered and cached pages (WordPress, JSX SSR, static HTML) cannot always run JavaScript to set the `data` property per element. Render the response into a child `<script type="application/json" class="roxy-data">` on the server instead. The component reads it on load. No per-element script, no API key in the browser.
314
296
297
+
Load the bundle once anywhere on the page. It registers every `roxy-*` element, so every component on the page renders from that single tag.
298
+
315
299
```html
300
+
<!-- Once per page: defines every roxy-* element -->
The breakout 2026 self-knowledge category, computed from the same ephemeris as Western astrology plus the I Ching gate wheel and chakra-style centers. Self-discovery apps, dating and compatibility products, and AI coaching bots ship the full bodygraph first. No coordinates needed; Human Design uses the birth instant, not the observer location.
457
+
458
+
```tsx
459
+
import { RoxyBodygraph } from'@roxyapi/ui-react';
460
+
461
+
// Full bodygraph. The head term every Human Design app leads with ("human design chart").
462
+
// Type, strategy, authority, profile, the nine centers, channels, and every gate
463
+
// activation in one call. Pass the birth instant only, no latitude or longitude.
The first cross-domain, stateless forecast in the catalog: one call merges Western transits, Vedic Vimshottari dasha boundaries, and biorhythm critical days into a single significance-scored, time-ordered timeline. Forecast feeds, transit alerts, and timing tools are the buyers. Acquire on the high-volume `astrology transits` search, convert on the cross-domain timeline no competitor ships. No coordinates needed.
Zero competition domain. Steady search volume with the top Google result being a static calculator page. Pure land-grab for wellness, productivity, sports, and couples apps.
Today every key is a **secret key**: use it server side only (Node, Bun, Hono, Next.js route handlers, Workers). Never commit it, never ship it in a client bundle. Fetch on your server and send the rendered response, not the key, to the browser. The [Start with one component](#start-with-one-component) section and the [framework recipes](#most-used-components-per-domain) show the pattern.
509
539
510
-
-**Secret key** (server-side only). Use in Node, Bun, Hono, Next.js route handlers, Workers. Never commit, never ship in client bundles.
511
-
-**Publishable key** (`pk_live_*` / `pk_test_*`). Safe in browsers, locked to the origins you register on the key. Use with the widgets auto-mount script for WordPress, Shopify, static HTML, embed scenarios. The API gateway rejects requests from any origin not on the allowlist.
540
+
Set `ROXY_API_KEY` to your secret key in your server env for every SDK example on this page.
512
541
513
-
For the SDK examples on this page, set `ROXY_API_KEY` to a secret key in your server env. For the widgets auto-mount path (`data-publishable-key="pk_live_xxx"`), use a publishable key with your domain registered on it.
542
+
Browser-safe keys for direct client-side embedding are on the roadmap, not yet available. Until they ship, keep the fetch on your server.
514
543
515
544
## Distribution
516
545
@@ -520,7 +549,7 @@ For the SDK examples on this page, set `ROXY_API_KEY` to a secret key in your se
@@ -770,7 +799,7 @@ Components ship in Shadow DOM for style isolation; Tailwind utilities are scoped
770
799
<details>
771
800
<summary><strong>What is the security model for API keys?</strong></summary>
772
801
773
-
Two key classes. Secret keys (unprefixed) live server-side only and grant full access. Publishable keys (`pk_live_*` / `pk_test_*`) are browser-safe and locked to an origin allowlist registered on the key. The API gateway rejects requests from any other origin and counts the failed attempt against the rate limit, so a stolen key cannot be brute-fired from elsewhere.
802
+
Today keys are secret keys: they live serverside only and grant full access, so never ship one in a client bundle. Fetch on your server and pass the rendered response, not the key, to the browser. Browser-safe keys with an origin allowlist for direct client-side embedding are on the roadmap and not yet available.
774
803
775
804
For CSP, allow `script-src https://cdn.jsdelivr.net` if loading the bundle from the CDN. Subresource Integrity hashes are available via the jsDelivr SRI API for any pinned version.
776
805
</details>
@@ -781,11 +810,11 @@ For CSP, allow `script-src https://cdn.jsdelivr.net` if loading the bundle from
781
810
Semver. Pre-1.0, minor bumps may include breaking changes (we will note them in the changelog). Patch bumps are always backwards-compatible. Pin a concrete version in production code:
0 commit comments