Skip to content

Quick start

You need a Cloudflare account, Node.js 22 or later, pnpm, and an Anthropic API key.

Terminal window
git clone https://github.com/YOUR-ORG/answerkit.git
cd answerkit
pnpm install

Run these from the repository root and copy each ID that Wrangler prints into wrangler.jsonc, replacing the existing database_id and KV id:

Terminal window
npx wrangler d1 create answerkit
npx wrangler kv namespace create answerkit-cache
npx wrangler r2 bucket create answerkit-pages
npx wrangler queues create answerkit-crawl
npx wrangler queues create answerkit-embed
npx wrangler vectorize create answerkit-chunks --dimensions=768 --metric=cosine
npx wrangler vectorize create-metadata-index answerkit-chunks --property-name=botId --type=string

Create the metadata index before you add any content. Retrieval filters vectors by bot, and Vectorize only filters on metadata that was indexed before the vectors were inserted.

Terminal window
npx wrangler secret put ANTHROPIC_API_KEY
npx wrangler secret put ADMIN_PASSWORD
npx wrangler secret put AUTH_SECRET

ADMIN_PASSWORD must be at least 8 characters and AUTH_SECRET at least 16. A good way to generate the secret is openssl rand -base64 32. See Configuration for optional settings such as handoff email and Turnstile.

Terminal window
pnpm --filter @answerkit/api exec wrangler d1 migrations apply DB --remote --config ../../wrangler.jsonc
Terminal window
pnpm build
pnpm --filter @answerkit/api exec wrangler deploy --config ../../wrangler.jsonc

pnpm build builds the chat widget and the admin dashboard. One Worker serves the dashboard, the widget script, and the API.

  1. Open your Worker’s URL and sign in. The email is admin@answerkit.local unless you set ADMIN_EMAIL, and the password is your ADMIN_PASSWORD.
  2. Create a bot and add the domains of the sites that will embed it.
  3. On the Sources tab, add your docs site as a Website. AnswerKit finds its sitemap on its own. Wait for the status to show Ready.
  4. On the Test tab, ask a few questions a visitor would. Nothing you ask there is saved.
  5. On the Embed tab, copy the snippet and paste it into your site before the closing </body> tag.

That is it. Questions your docs cannot answer will start showing up on the Unanswered tab.

Create .dev.vars in the repository root with ADMIN_PASSWORD and AUTH_SECRET, then run pnpm db:migrate and pnpm dev. Workers AI calls go to your Cloudflare account even locally, and Vectorize is not available in local development, so answers need a deployed Worker.