Installation
Get the Sitemap.xml SDK up and running in your project in under two minutes. The SDK is designed to be lightweight, framework-agnostic, and fully typed for modern development workflows.
18+ or a modern browser environment. For backend usage, we recommend a managed runtime or serverless function.
Package Manager
Install the core SDK using your preferred package manager. The package includes TypeScript definitions out of the box.
bashnpm install @sitemap/sdk pnpm add @sitemap/sdk yarn add @sitemap/sdk
CDN / Browser
For client-side implementations or quick prototyping, load the SDK directly from our edge CDN:
html<script type="module"> import { SitemapClient } from "https://cdn.sitemap.xml/v2.4.1/sitemap.esm.js"; </script>
Initialization
After installation, create a new client instance using your API key. You can find your key in the Dashboard → Settings → API Keys.
javascriptimport { SitemapClient } from "@sitemap/sdk"; const sitemap = new SitemapClient({ apiKey: process.env.SITEMAP_API_KEY, domain: "https://example.com", // Optional: Enable verbose logging during development debug: process.env.NODE_ENV === "development" }); // Verify connection const health = await sitemap.ping(); console.log(health.status); // "connected"
apiKey in client-side code. Use environment variables or a backend proxy for production deployments.
Framework Presets
We provide optimized adapters for popular frameworks to handle routing and dynamic pages automatically:
bash# Next.js / App Router npm install @sitemap/adapter-nextjs # Nuxt 3 npm install @sitemap/adapter-nuxt # Astro npm install @sitemap/adapter-astro
Next Steps
Now that the SDK is installed, proceed to the Quick Start guide to generate your first sitemap, or explore the API Reference for detailed method documentation.