Putiikkipalvelu Docs
SDK

Getting Started

Install and configure the Putiikkipalvelu Storefront SDK

Installation

npm install @putiikkipalvelu/storefront-sdk

Quick Start

Create a client instance and start making requests:

import { createStorefrontClient } from '@putiikkipalvelu/storefront-sdk';

const storefront = createStorefrontClient({
  apiKey: process.env.STOREFRONT_API_KEY!,
  baseUrl: process.env.NEXT_PUBLIC_STOREFRONT_API_URL!,
});

// Fetch store configuration
const config = await storefront.store.getConfig();
console.log(config.store.name);

Configuration Options

OptionTypeRequiredDefaultDescription
apiKeystringYes-Your store's API key from Dashboard
baseUrlstringYes-Storefront API URL
timeoutnumberNo30000Request timeout in milliseconds

Next.js Setup

Create a lib/storefront.ts file in your project:

import { createStorefrontClient } from '@putiikkipalvelu/storefront-sdk';

const API_KEY = process.env.STOREFRONT_API_KEY || '';
const BASE_URL = process.env.NEXT_PUBLIC_STOREFRONT_API_URL || '';

export const storefront = createStorefrontClient({
  apiKey: API_KEY,
  baseUrl: BASE_URL,
});

Then use it in your pages or components:

import { storefront } from '@/lib/storefront';

export default async function Page() {
  const config = await storefront.store.getConfig({
    next: { revalidate: 300 } // Cache for 5 minutes
  });

  return <h1>{config.store.name}</h1>;
}

Environment Variables

Add these to your .env.local:

STOREFRONT_API_KEY=your_api_key_here
NEXT_PUBLIC_STOREFRONT_API_URL=https://putiikkipalvelu.fi

Available Resources

ResourceDescription
storefront.storeStore configuration, SEO, campaigns
storefront.productsProduct catalog, listings, details
storefront.reviewsList and submit product reviews
storefront.categoriesCategory tree and navigation

Additional documented resources include cart, checkout, customer, orders, discount codes, shipping, tickets, and pages — see the sidebar.

TypeScript Support

The SDK is fully typed. Import types directly:

import type {
  // Store types
  StoreConfig,
  Campaign,
  StoreInfo,
  StoreSeo,
  // Product types
  Product,
  ProductDetail,
  ProductVariation,
  // Category types
  Category,
  CategoryResponse,
  // Review types
  Review,
  ReviewListResponse,
  SubmitReviewParams,
  SubmitReviewResponse,
} from '@putiikkipalvelu/storefront-sdk';

On this page