Development
Monorepo structure
Section titled “Monorepo structure”This repository is a pnpm workspace:
| Path | Purpose |
|---|---|
packages/astro-chatty-gpt | The published integration (tsup → dist/) |
playground | Starlight docs site + integration demo |
| Root | Shared scripts, Biome, Changesets |
Requirements
Section titled “Requirements”- Node.js 22.15+ (see
.nvmrc) - pnpm 10+ (
corepack enablerecommended)
pnpm installBuild the integration package (required before the playground can load it):
pnpm package:buildDevelopment commands
Section titled “Development commands”| Command | Description |
|---|---|
pnpm dev | Watch package + run playground dev server in parallel |
pnpm package:dev | Watch packages/astro-chatty-gpt with tsup |
pnpm playground:dev | Astro dev server (Starlight docs) |
pnpm package:build | One-off package build |
pnpm playground:build | astro check + production build + Upstash indexing |
pnpm playground:check | Type-check playground only |
pnpm lint | Biome check across the repo |
The playground uses Astro 6, Starlight 0.39+, Tailwind 4.3, and @astrojs/netlify 7 with HMR for the integration via astro-integration-kit.
Environment variables
Section titled “Environment variables”Copy credentials into playground/.env:
UPSTASH_SEARCH_REST_URL=...UPSTASH_SEARCH_REST_TOKEN=...OPENAI_API_KEY=...Local API testing
Section titled “Local API testing”Use the dev server — astro preview is not supported with @astrojs/netlify v7:
pnpm playground:devThen test:
GET http://localhost:4321/api/search?q=installationPOST http://localhost:4321/api/chatbotwith JSON body
Troubleshooting
Section titled “Troubleshooting””Search service unavailable”
Section titled “”Search service unavailable””- Check Upstash REST URL and token in
.env - Confirm the Search database is active in the Upstash console
”AI service unavailable”
Section titled “”AI service unavailable””- Verify
OPENAI_API_KEYis set and valid - Confirm your account has credits and access to the configured
model - Check platform.openai.com/account/limits
No search results
Section titled “No search results”- Run
pnpm playground:build(orastro build) so content is indexed - Review
excludeRoutesandexcludeTagsinastro.config - Ensure
contentTagmatches your HTML (default:main)
Build-time indexing skipped
Section titled “Build-time indexing skipped”- Set
siteinastro.config - Provide all three env vars (
UPSTASH_*+OPENAI_API_KEYfor chat; indexing only needs Upstash) - Check build logs for
[astro-chatty-gpt]messages
Package changes not reflected
Section titled “Package changes not reflected”Restart the playground dev server after editing packages/astro-chatty-gpt source, or rely on pnpm dev which watches both.