---
name: queek-headless
description: Build a new website or app for an existing Queek store through the Headless API, and deploy it. Use when the user has a Queek store and wants a custom storefront (Next.js, React, Vite or a mobile app). No Queek connector is required.
---

# Build a site or app for an existing Queek store

The result: a new site or app that reads the merchant's catalogue from the Headless API, sends shoppers to Queek's hosted checkout, and is deployed. Queek OS (Queek's connector for AI assistants) is not required. If the user has a site with its own hard-coded products to move onto Queek, follow https://usequeek.com/skills/site.md instead.

Work through the steps in order. Each step ends with what you must see before moving on.

## 0. How to read this file and the docs

Download every Queek URL in this file with `curl -sSf <url>` and read the whole file. A summary loses the exact click paths, error codes and commands. Do not work from memory.

## 1. Choose the build

Ask the user what they are building, and whether their Queek store has a paid plan.

- Server-rendered (the default): the starter, a Next.js site, with a **Server or backend** connection. The secret key stays in the host's server environment and never reaches the browser.
- Static or browser-only (Lovable, Bolt, v0, Vite, a single-page app): a **Website** connection and its public key. Read https://docs.usequeek.com/docs/storefront/connections for what it needs.
- No paid plan: a live store needs one, and the API answers `403 plan_inactive` without it. The user upgrades under Settings, then Billing, then Subscription. Until then, build on a dev store: the user opens the account menu, then Developer (accepting the Developer Terms the first time), then Dev stores, creates one and presses Generate test data. Tell the user plainly: a dev store holds sample products, never a copy of their own catalogue, so the site shows their real products only once it uses the live store. Build and test on the user's own computer, and deploy only after the live store has a plan. Never deploy a dev-store site publicly. Dev stores are explained in https://docs.usequeek.com/docs/sandbox.

You are done with this step when the user has agreed which build you will make and whether it targets the live store or a dev store.

## 2. The user sets up the connection

An AI tool cannot do these clicks unless Queek OS is connected, and then only the ones marked below. Give the user this list and wait for them to finish. Building on a dev store? Every click below happens inside the dev store (the user opens it from Developers, then Dev stores), not the live store.

1. In the Apps window, open Headless API and press Install (free, built by Queek). Skip this if Channels already shows Headless API in the sidebar.
2. If Queek OS is connected, you can create a Website, Mobile app or (dev store only) Testing on my computer connection yourself with `create_storefront_connection`; the user presses Confirm on the card. Creating a Server or backend connection, and Development mode on, are the user's in the dashboard. Otherwise: open Channels, then Headless API, then Connect a site or app. Under "What are you building?" pick Server or backend for the starter, Website for a static build on a live store, or Mobile app for an app. On a dev store, a static build uses Testing on my computer instead of Website. For a Website connection on a live store, the user turns on Development mode on the connection while you build on their computer, because localhost is refused otherwise. It lasts 14 days. They turn it off once the production address is listed (step 7). See https://docs.usequeek.com/docs/storefront/connections#development-mode.
3. On the connection page, press Copy for AI and paste the text to you.
4. Server or backend: the starter uses only the secret key; the public key in the Copy for AI text is not used by server code (a public key from a server answers `403 origin_required`). The secret key is shown once; if it is lost, the user presses Replace secret key on the connection page. The user keeps the secret key from the connection page and pastes it into `.env.local` themselves once the project exists (step 4). You never ask for the key in chat. Never read or print any `.env*` file, and never pipe a secret into a command.
5. Dev store only: the user copies the storefront password from Developers, then Dev stores, and pastes it into `.env.local` the same way, as `QUEEK_STOREFRONT_PASSWORD`. A static build on a dev store: read the "storefront password" part of the Dev stores page first, and never put the password in browser code.

You are done with this step when the user has pasted the Copy for AI text and has the secret key (and the dev-store password, if any) ready to paste.

## 3. Check the connection (only if Queek OS is connected)

If tools like `get_store_overview` are in this session, call `list_storefront_connections`, or `get_storefront_connection` with the connection number from the Copy for AI text. Check its status, `api_access` and the allowed websites and return links. These tools only read. Every change stays a dashboard click for the user. If the tools are not there, skip this step: Queek OS is never required.

You are done with this step when you have read the connection back, or you have skipped the step.

## 4. Build the site

1. The starter needs Node.js 20.9 or later and Yarn 1. Fetch it: `npx degit usequeek/developers/examples/nextjs-headless <dir>`, then `yarn install` inside `<dir>`. Ask the user to copy `.env.example` to `.env.local` and fill it in with what they kept from step 2 (the starter's `.gitignore` keeps `.env.local` out of git). Only then run `yarn dev`. For a static build, start your own project instead and follow the rules page.
2. Read https://docs.usequeek.com/docs/storefront/rules-for-ai-builders and follow it while you adapt the design. Quickstart: https://docs.usequeek.com/docs/storefront. Machine-readable guide: https://client.usequeek.com/llms.txt.

You are done with this step when the site runs on the user's computer and shows the store's products.

## 5. Verify locally

Go through the "Before you tell the merchant it works" list on the rules page: the catalogue, a product page, add to cart, `POST /store/cart/validate`, and the Checkout button landing on Queek's hosted checkout page. Check through the site's own pages, never with a command that carries the key. For the starter, `node --env-file=.env.local scripts/smoke.mjs` checks the API calls without printing the key; on a live store (`sk_live_`) it checks reads only, so check the cart through the site's own pages. Stop at Queek's checkout page. Never pay on a live store; on a dev store the checkout is a simulated payment page. The `/thanks` return page is tested after deploy: a Server connection accepts only https return links.

If a call fails, find its `error.code` in the rules page table and do what it says. On `plan_inactive`, stop and tell the user: the live store needs a paid plan, or build on a dev store.

You are done with this step when every item on that list passes and you have told the user the result.

## 6. Deploy

Built on a dev store? First get live keys, because the deployed site uses live keys only and never `QUEEK_STOREFRONT_PASSWORD`. The live store needs a paid plan. Starter (Server or backend connection): a Server connection has no Go live. On the live store the user creates a new Server or backend connection (Channels, then Headless API, then Connect a site or app) and sets its `sk_live_` key in the host, and can then disconnect the dev-store connection. Static build (Testing on my computer connection): the user presses Go live on it, as https://docs.usequeek.com/docs/storefront/connections describes. That creates a Website connection on the live store, and its public key goes in the host.

Follow https://docs.usequeek.com/docs/storefront/deploy. If the user asks where to host, read that page and suggest from it. Do not invent facts about a host. The user sets the environment variables in the host's settings themselves. Never put the secret key in the project's files, the host CLI or the chat.

If the user hosts on Cloudflare and their AI tool can add connectors, recommend they add Cloudflare's own MCP connector (https://mcp.cloudflare.com/mcp) and sign in to their Cloudflare account through it. Then use it for the Cloudflare side: creating the Worker, its variables and its address. Queek does not deploy sites. The user still types secrets into Cloudflare's settings themselves, never in chat.

You are done with this step when the site is live at a stable production address with live keys.

## 7. Connect the live site

1. Website connection: the site's production address (https) must be in the connection's "Websites allowed to use this key", and then Development mode must be off. If Queek OS is connected, you can add the website and turn Development mode off yourself with `update_storefront_connection`; the user sees a Confirm card for each and nothing changes until they press it. Without Queek OS, the user does both on the connection page. Server or backend connections list no websites, but one can name the site it powers (`Your site's address` on the connection: one https address, no page after it), which makes it a choice under Online Store, Send visitors to my site. Naming it does not send visitors there on its own: the user then chooses it there, and it takes effect once the server has made a request. Ask the user for the address, never guess it. If Queek OS is connected, set it with `update_storefront_connection` (`set_site_address`); the user sees a Confirm card. Without Queek OS, the user types it on the connection page.
2. On the live store's connection (the one the site now uses), add `https://<site>/thanks` (the starter has that page) under "After checkout, send customers back to". The website must already be on the connection's list: add the website first and wait for the user's Confirm, then add the return link in a later call. Without Queek OS, the user adds it on the connection page.
3. Optional, for the starter: Settings, then Notifications, then Webhooks, an endpoint at `https://<site>/api/queek-webhook` for the topics `products/create`, `products/update` and `products/delete`, with its signing secret set as `QUEEK_WEBHOOK_SECRET` in the host. See https://docs.usequeek.com/docs/webhooks. Without it, pages refresh on a timer.

You are done with this step when the live site loads its products from the live store.

## 8. Pre-launch checklist

Check each, then tell the user the result:

- No secret key in the browser bundle, the repository or the chat. Search the project's source, not `.env*`.
- The site uses the live store's key, with no dev-store password or test key left in production.
- The rules-page checklist passes on the production address, up to Queek's checkout page.
- The return link works, and the production address is listed if the connection is a Website one.
- You have told the user how pages refresh (webhook or timer), and what they still have to do.

You are done with this step when the user has the production address, which connection it uses and what is left for them.

## Rules

- No secret in the chat, in browser code (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`) or in git.
- Never read or print `.env*`. The user pastes secrets into `.env.local` and the host's environment settings.
- Never invent a link, command or tool name. Use only what is written here, in the linked docs, or what the connector returns.
- On any `error.code`, follow the rules page table. On `plan_inactive`, stop and tell the user.
