> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# Add Lynkow to an Existing Project

**Published**: 2026-11-30
**Category**: Getting Started

This guide adds Lynkow to a site you already have, with the Next.js App Router. To start a new site instead, follow the [Quick Start](/sdk/getting-started/quick-start).

> **Reference** - This guide is a tutorial. For exhaustive, always-current signatures and field lists, see the auto-generated reference:
> 
> - SDK: [SDK Reference](/sdk) and [`ContentsService`](/sdk/services/sdk-contents-service)
> - API: [Storefront: Content](/storefront-api/storefront-content)

## Prerequisites

- Node.js 20.9 or later (the SDK alone runs on Node 18)
- A Lynkow site, and its Site ID: the admin shows it under **Settings > Developers > Storefront**

## Install

```bash
npm install lynkow
```

If you work with an AI coding assistant, also install the Lynkow AI skills from the project root. [Install the Lynkow AI Skills](/sdk/getting-started/ai-skills) explains the formats.

```bash
npx @lynkow/skills@latest
```

## Create the client

Add your Site ID to `.env.local`:

```env
NEXT_PUBLIC_LYNKOW_SITE_ID=your-site-id
```

Create one shared client in `lib/lynkow.ts` and import it everywhere:

```typescript
import { createClient } from 'lynkow'

export const lynkow = createClient({
  siteId: process.env.NEXT_PUBLIC_LYNKOW_SITE_ID!,
  publishableKey: process.env.NEXT_PUBLIC_LYNKOW_PUBLISHABLE_KEY,
  fetchOptions: { next: { revalidate: 60 } },
})
```

| Option | Default | Use |
| --- | --- | --- |
| `siteId` | required | Your Site ID. |
| `publishableKey` | none | The site's storefront key (`lkw_pk_...`), from **Settings > Developers > Storefront**. Optional for content, required for commerce. |
| `locale` | the site's default locale | Locale of every request. See [Multi-language](/sdk/features/i18n). |
| `fetchOptions` | `{}` | Merged into every `fetch` call. `{ next: { revalidate: 60 } }` caches responses for 60 seconds. |
| `retry` | `true` | Retries reads on 429, 503 and network errors. `false` disables it. |


The [SDK Reference](/sdk) lists the other options. Never set `serverKey` or `clientIp` on this shared client: a call made for one buyer from your server needs its own client ([Server Key and Buyer IP](/sdk/advanced/server-key-buyer-ip)). To refresh pages as soon as content changes, add a webhook: see [Webhooks & Cache Revalidation](/sdk/advanced/webhooks-revalidation).

## List articles

`app/blog/page.tsx`:

```tsx
import { lynkow } from '@/lib/lynkow'

export default async function BlogPage() {
  const { data: articles, meta } = await lynkow.contents.list({
    limit: 10,
    sort: 'published_at',
    order: 'desc',
  })

  return (
    <main>
      <h1>Blog</h1>
      <ul>
        {articles.map((article) => (
          <li key={article.id}>
            <a href={`/blog/${article.slug}`}>{article.title}</a>
            {article.excerpt && <p>{article.excerpt}</p>}
          </li>
        ))}
      </ul>
      <p>Page {meta.currentPage} of {meta.lastPage}</p>
    </main>
  )
}
```

List rows carry no `body`. Read the article itself for it.

## Show one article

`app/blog/[slug]/page.tsx`:

```tsx
import { notFound } from 'next/navigation'
import { isLynkowError } from 'lynkow'
import { lynkow } from '@/lib/lynkow'

export default async function ArticlePage({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params

  let article
  try {
    article = await lynkow.contents.getBySlug(slug)
  } catch (error) {
    if (isLynkowError(error) && error.code === 'NOT_FOUND') notFound()
    throw error
  }

  return (
    <article>
      <h1>{article.title}</h1>
      {article.author && <p>By {article.author.fullName}</p>}
      <div dangerouslySetInnerHTML={{ __html: article.body }} />
    </article>
  )
}
```

`body` is rendered HTML. The article also carries its categories, tags and SEO fields: see the [SDK Types](/sdk/types). [Error Handling & Resilience](/sdk/advanced/error-handling) covers the other error codes.

## Next Steps

- [Complete Integration Checklist](/sdk/getting-started/integration-checklist) - every feature, with its guide
- [Build a Blog with Next.js](/sdk/getting-started/blog-nextjs) - categories, pagination, metadata and images
- [Media & Image Optimization](/sdk/media-seo/media-images) - responsive image variants