SDK Overview
Koryla ships adapters for every major framework. Pick your stack and follow the guide — each one is a 5-minute setup.
Two approaches
| Edge / Middleware | Component SDK | |
|---|---|---|
| What it tests | Entire pages (/ vs /variant-b) | Specific components within a page |
| How | Intercepts the request before your app renders — URL rewrite, no redirect | getVariant() in server code, conditionally render the matching component |
| Code changes | None in your pages | Add getVariant() call + conditional render |
| Flicker | Zero | Zero |
| Client JS | None | None |
Both approaches are fully server-side. The browser never sees the experiment logic.
Choose your framework
- React / Next.js → —
@koryla/react+@koryla/nextmiddleware - Vue / Nuxt → —
@koryla/vue - Astro → —
@koryla/astro - WordPress → — PHP plugin, no npm required
How variant assignment works
- Config fetch —
getVariant()callsGET /api/worker/configwith your API key. Response is cached in memory for 60 seconds (one network call per minute per process). - Cookie check — reads
ky_{experimentId}from the request cookies. If present and valid → return the same variant (sticky session). - Weighted assignment — if no cookie, randomly assigns a variant using the
traffic_weightvalues from your dashboard. - Render — your page code renders the correct variant. Cookie setting is the caller's responsibility.
Finding your experiment ID
Go to Dashboard → Experiments → click your experiment. The ID is in the URL:
/dashboard/my-workspace/experiments/abc-123
Variant IDs are shown in the Variants tab of each experiment.