Menu

Component previews

How the Poker Study component docs use one Studio key for live previews, and how an app built from the registry keeps it on the server.

Our poker components (cards, tables, ranges, strategy bars, grades) are a shadcn registry at pokerstudy.ai/ui. Live previews on those component docs share one Studio key.

In the component docs

The visitor enters the key once, in a key bar or modal in the header.

  • A key provider wraps the docs layout, and a key-entry component in the header is the only place the visitor types it.
  • Every component page puts its preview in the same gated preview wrapper.
  • The site keeps the key in sessionStorage for that tab and leaves localStorage and cookies unused. The key is only sent to pokerstudy.ai, is never logged, and is cleared when the tab closes.

The full standard is on the API key page.

Checking the key

The site checks the key with GET /api/trainer/stats and Authorization: Bearer psk_…:

StatusResult
200The key is accepted.
401Every preview stays on its sample, with an Enter your API key button.
503The check could not run. The sample stays up and the site tries again.

The check reads the status and discards the body, a small summary of the key owner's preflop drills.

In an app built from the registry

Keep the key in POKERSTUDY_API_KEY on the server. The installed proxy, app/api/pokerstudy/[...path] (web/registry/pokerstudy/proxy-route.ts in the registry), attaches the key there. Keep the psk_ key out of client code.