Quick start
You need a Cloudflare account, Node.js 22 or later, pnpm, and an Anthropic API key.
1. Get the code
Section titled “1. Get the code”git clone https://github.com/YOUR-ORG/answerkit.gitcd answerkitpnpm install2. Create the Cloudflare resources
Section titled “2. Create the Cloudflare resources”Run these from the repository root and copy each ID that Wrangler prints into wrangler.jsonc, replacing the existing database_id and KV id:
npx wrangler d1 create answerkitnpx wrangler kv namespace create answerkit-cachenpx wrangler r2 bucket create answerkit-pagesnpx wrangler queues create answerkit-crawlnpx wrangler queues create answerkit-embednpx wrangler vectorize create answerkit-chunks --dimensions=768 --metric=cosinenpx wrangler vectorize create-metadata-index answerkit-chunks --property-name=botId --type=stringCreate 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.
3. Set your secrets
Section titled “3. Set your secrets”npx wrangler secret put ANTHROPIC_API_KEYnpx wrangler secret put ADMIN_PASSWORDnpx wrangler secret put AUTH_SECRETADMIN_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.
4. Run the database migrations
Section titled “4. Run the database migrations”pnpm --filter @answerkit/api exec wrangler d1 migrations apply DB --remote --config ../../wrangler.jsonc5. Build and deploy
Section titled “5. Build and deploy”pnpm buildpnpm --filter @answerkit/api exec wrangler deploy --config ../../wrangler.jsoncpnpm build builds the chat widget and the admin dashboard. One Worker serves the dashboard, the widget script, and the API.
6. Create your bot
Section titled “6. Create your bot”- Open your Worker’s URL and sign in. The email is
admin@answerkit.localunless you setADMIN_EMAIL, and the password is yourADMIN_PASSWORD. - Create a bot and add the domains of the sites that will embed it.
- 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.
- On the Test tab, ask a few questions a visitor would. Nothing you ask there is saved.
- 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.
Local development
Section titled “Local development”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.