Nuxt SDK
@subdomainto/nuxt v0.1 supports Nuxt 3 and 4 with H3 1.15 or 2.x on Node.js 20+. It is server-only.
Installation
npm install @subdomainto/nuxt
Create the client
import { createSubdomainToClient } from '@subdomainto/nuxt';
const client = createSubdomainToClient();
const domain = await client.domains.create('portal.customer.com', 'customer-42-domain');
The factory reads SUBDOMAINTO_API_KEY and optional SUBDOMAINTO_BASE_URL. Use it only in Nitro handlers, server routes, or other server code.
Verify an H3 webhook
import { verifyWebhookEvent } from '@subdomainto/nuxt';
export default defineEventHandler(async (event) => {
const webhook = await verifyWebhookEvent(event);
return { received: webhook.id };
});
The helper reads the untouched H3 request body, SubdomainTo-Signature, and SUBDOMAINTO_WEBHOOK_SECRET. It rejects missing bodies and invalid deliveries.