Overview
Add your Invent AI assistant to any Astro site. Perfect for content-focused websites with islands architecture and multi-framework support.Installation
1
2
Add to Layout
3
Configure Environment
Add to
.env:User Authentication
Server-Side Hash Generation
Use Astro API endpoints:Using in Layout with Server-Side Data
Content Collections Integration
Pass content data for better context:TypeScript Support
Add type declarations:Using with React/Vue/Svelte Islands
Astro’s island architecture allows mixing frameworks:Tips for Astro
Islands Architecture
Perfect for partial hydration
Multi-Framework
Use React, Vue, Svelte, or pure Astro
Content Collections
Integrate with content data
SSG & SSR
Works with static and server modes
Troubleshooting
Script not loading
Script not loading
Solutions:
- Ensure script tag is in component, not layout head
- Check client directives if using framework components
- Verify URL is correct
- Check browser console for errors
Hydration issues
Hydration issues
Solutions:
- Use appropriate client directive (client:load, client:visible)
- Ensure script loads after component hydrates
- Check for SSR/client mismatches
Environment variables not found
Environment variables not found
Solutions:
- Restart dev server after adding env variables
- Use
PUBLIC_prefix for client-accessible variables - Keep secret key without prefix (server-only)
- Use
import.meta.envnotprocess.env
Best Practices
- Use API routes or server-side code for hash generation
- Keep secret key in
.env(never commit) - Use
PUBLIC_prefix only for non-sensitive variables - Choose appropriate client directives for islands
- Leverage Astro’s content collections for context