The @laioutr/app-klaviyo package integrates a Laioutr-powered Nuxt app with Klaviyo. It uses the Klaviyo Client API to subscribe profiles to a list (newsletter signup). The package registers with the Laioutr orchestr and exposes a single action: SubscribeAction. No cart, product, or menu capabilities are included; the focus is email/list subscription.
Configuration is minimal: Klaviyo company ID, API base URL, and a default list ID for subscriptions. The module installs @laioutr-core/frontend-core, @laioutr-core/orchestr, @nuxt/image, and @laioutr-app/ui on prepare. Placeholder directories for app blocks and sections exist for future use.
The module expects configuration under the key @laioutr/app-klaviyo in nuxt.config.ts (or via runtimeConfig). Two options are required; one is optional.
| Option | Type | Description |
|---|---|---|
baseURL | string | Klaviyo API base URL. Default: https://a.klaviyo.com. |
companyId | string | Klaviyo company (account) ID. Sent as company_id on every API request. |
defaultNewsletterListId | string | Default list ID for newsletter subscriptions when the action input does not specify a list. |
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@laioutr/app-klaviyo', '@laioutr-core/orchestr'],
'@laioutr/app-klaviyo': {
baseURL: process.env.KLAVIYO_BASE_URL ?? 'https://a.klaviyo.com',
companyId: process.env.KLAVIYO_COMPANY_ID!,
defaultNewsletterListId: process.env.KLAVIYO_DEFAULT_NEWSLETTER_LIST_ID!,
},
});
Use environment variables for companyId and defaultNewsletterListId in production; do not commit them if they are sensitive.
baseURL and companyId. All requests are sent as POST with Content-Type: application/json and the Klaviyo API revision header (2025-07-15). The SDK is passed into the orchestr context as klaviyoClient; defaultNewsletterListId is also in context for the subscribe action.errors, it throws an AggregateError with one Error per API error (title and detail). Non-OK responses without a JSON error body throw a generic Error with status and body.The package implements the canonical SubscribeAction from @laioutr-core/canonical-types/newsletter. No queries, links, or component resolvers are provided.
listId (optional; falls back to defaultNewsletterListId), email, source (optional custom source), phone, person (firstName, lastName, title), address (address1, address2, city, countryCode, provinceCode, postalCode, latitude, longitude), customFields (mapped to profile properties).{ status: 'success' }.company_id in API calls).defaultNewsletterListId (or pass listId in the action input)./client/subscriptions (create client subscription). Ensure your Klaviyo plan and settings allow this endpoint and the revision 2025-07-15.This package does not set or read any cookies. Subscription is stateless per request.
@laioutr/app-klaviyo and @laioutr-core/orchestr to Nuxt modules.baseURL (optional), companyId, and defaultNewsletterListId under @laioutr/app-klaviyo (e.g. from env).email; optionally pass listId, source, phone, person, address, and customFields.