Edge SDK Reference
Legacy reference for the SveltyCMS Edge SDK — currently unavailable pending reimplementation.
On this page
The Edge SDK is currently unavailable — the @utils/sdk/edge-sdk module was removed from the codebase pending reimplementation. This page is preserved for reference only.
The Goal
Deliver content with ultra-low latency by fetching data directly from the network edge. The Edge SDK was designed for environments like Cloudflare Workers or Vercel Edge where a full Node.js runtime is unavailable or too heavy.
Recommended Alternative
For edge deployments, use the standard REST API or GraphQL endpoint directly from your edge functions:
// Use the REST API directly from edge runtimes
const response = await fetch("https://cms.yourproject.com/api/collections/posts", {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const data = await response.json();
For standard SvelteKit apps, use the Internal Local SDK (locals.cms) instead — zero HTTP overhead, direct database adapter access.
Quick Reference (Legacy API)
| Method | Purpose | Local SDK Equivalent |
|---|---|---|
getEntries |
Fetch multiple entries with filters | locals.cms.collections.find |
getEntry |
Fetch a single entry by ID | locals.cms.collections.findById |
graphql |
Execute raw GraphQL queries | (use REST/GraphQL endpoints) |
Fetching Content
const posts = await cms.getEntries("posts", {
limit: 10,
filter: { status: "published" },
});
```
---
## 3. The Mechanics
### Edge-First Architecture
sequenceDiagram participant User participant Edge as Edge Function (CF/Vercel) participant Origin as SveltyCMS Origin participant DB as Database
User->>Edge: Request Page Edge->>Origin: Edge SDK: fetch(/api/search) Origin->>DB: Optimized Query DB—>>Origin: JSON Data Origin—>>Edge: Gzip Encrypted Response Edge—>>User: Rendered HTML
### Performance Features
- **Zero Dependencies**: No Axios, Lodash, or heavy polyfills. Uses native `fetch`.
- **Sub-millisecond Serialization**: Optimized JSON parsing and DTO (Data Transfer Object) mapping.
- **Smart Timeouts**: Built-in `AbortController` support for edge-runtime safety.
---
**Next Steps**: For real-time updates at the edge, see the [Content & Search Reference](/docs/reference/api/content).