This is a demonstration of the Star Support AI-powered documentation assistant widget, integrated with a fork of the official Astro documentation site.
- Based on: Fork of the Astro Docs Starlight site
- Modified: Removed all non-English language content to simplify the demo
- Purpose: Showcase Star Support widget capabilities with real documentation content
Star Support is a TypeScript widget library for creating AI-powered question and support bots that understand your documentation content. It uses a simplified RAG (Retrieval-Augmented Generation) approach:
- Pre-built Index: A build script generates AI-powered summaries of each document
- Smart Document Selection: AI selects the most relevant documents per query
- Framework Agnostic: Works with any web application
- Vercel AI SDK: Uses Fireworks AI provider by default (can be modified for other providers)
git clone https://github.com/agoodway/star-support-demo
cd star-support-demo
pnpm install
cp .env.example .env
# Configure your AI_API_KEY in .env
# Build the widget first (required)
cd widget && npm install && npm run build && cd ..
cp -r widget/dist/* public/widget/dist/
# Generate the search index
pnpm run build-star-support-index
# Start the dev server
pnpm run devVisit http://localhost:4321 to see the Star Support widget in action on the Astro documentation.
Set environment variables in .env:
# AI Provider (Required)
AI_API_KEY="fw_your_fireworks_api_key"
AI_MODEL_NAME="accounts/fireworks/models/llama-v3p1-8b-instruct"
# Widget Security (Recommended to prevent API abuse)
STAR_SUPPORT_AUTH_KEY="your_secret_key"
# Search Configuration (Optional)
MAX_SEARCH_RESULTS="4" # Number of documents to use for answers (default: 4)
# Content Path Configuration (Required)
CONTENT_PATH="src/content/docs/en" # Base path where your content files are locatedTest the AI assistant with these documentation-focused questions:
- "How do I add TypeScript to my Astro project?"
- "What's the difference between .astro and .md files?"
- "How do I fetch data from an API in Astro?"
- "Can I use React components in Astro?"
- "How do I set up environment variables?"
- "What's the best way to handle images in Astro?"
- "How do I enable server-side rendering?"
- "How do I deploy my Astro site to Vercel?"
- "How do I create dynamic routes?"
- "What are Astro integrations and how do I install them?"
- "How do I use content collections for my blog?"
- "How do I optimize my Astro site for SEO?"
The widget is integrated in the site footer (src/components/starlight/Footer.astro):
<star-support
api-base-url=""
auth-key={import.meta.env.STAR_SUPPORT_AUTH_KEY || ''}
theme="auto"
position="bottom-right"
welcome-message="Hi! How can I help you with Astro today?"
bot-name="Astro AI"
header-title="Astro Chat"
topic-context="Astro framework documentation - help users understand and use the Astro web framework"
suggested-questions={JSON.stringify([
"How do I install Astro on my Mac?",
"Where can I deploy my Astro app?",
"Can I use React components with Astro?"
])}>
</star-support>This demo uses Astro's Pages API to serve the chat backend, but the Star Support widget is designed to work with any backend that implements the required API interface. You can use Node.js, Python, Elixir, or any other server technology as long as it provides the expected endpoints and response format.
star-support-demo/
├── widget/ # Star Support widget library (future npm package)
│ ├── src/
│ │ ├── star-support.ts # Main widget class
│ │ ├── icons.ts # SVG icon definitions
│ │ ├── types.ts # TypeScript interfaces
│ │ └── styles.css # Widget styles
│ ├── dist/ # Built files (generated)
│ ├── build.js # Custom bundler script
│ └── package.json # Widget package configuration
├── src/pages/api/star-support/
│ └── chat.ts # Chat API endpoint (Astro Pages API)
├── scripts/
│ └── build-index.mjs # Documentation indexer
└── public/
├── star-support-index.json # Generated search index
└── widget/dist/ # Widget files served to browser
Note: The Star Support widget is currently bundled with this demo but will be published as a standalone npm package in the future.
To build the widget locally:
# Install widget dependencies (only needed once)
cd widget && npm install && cd ..
# Build and copy widget to public directory
cd widget && npm run build && cd ..
cp -r widget/dist/* public/widget/dist/The widget uses a custom build script (widget/build.js) that:
- Compiles TypeScript to JavaScript
- Bundles all imports (icons, styles) into a single file
- Outputs browser-ready ES modules
This bundling approach avoids module resolution issues when serving the widget as static files.
pnpm run build-star-support-indexpnpm run dev-
Modify widget code: Edit files in
widget/src/, then rebuild:cd widget && npm run build && cd .. cp -r widget/dist/* public/widget/dist/
-
Update documentation index: After changing content:
pnpm run build-star-support-index
-
Test API endpoints: The chat API is available at:
POST http://localhost:4321/api/star-support/chat
The demo is configured for Vercel deployment:
- Set environment variables in Vercel dashboard
- Deploy with
git push
This demo is built on top of the official Astro documentation, which showcases:
- Content collections
- MDX components
- Starlight theme
- Multi-language support (removed in this demo)
For the original Astro documentation, visit docs.astro.build.
- Star Support widget code: See Star Support repository
- Astro documentation content: See original Astro Docs license