Overview
Add your Invent AI assistant to any Nuxt 3 application. Perfect for Vue.js applications with server-side rendering and static generation.Installation
1
Create Assistant Component
2
Add to App Layout
3
Configure Environment
Add to Add to
nuxt.config.ts:.env:User Authentication
Server-Side Hash Generation
Use Nuxt server routes to generate the hash securely:Using in Component
Integration with Nuxt Auth
Using @sidebase/nuxt-auth
TypeScript Support
Add type declarations:Composable for Authentication
Create a reusable composable:Tips for Nuxt
Server Routes
Use server routes for secure hash generation
Composables
Create reusable composables for auth logic
SSR Compatible
Works with SSR, SSG, and SPA modes
Type Safe
Full TypeScript support
Troubleshooting
Script not loading
Script not loading
Solutions:
- Ensure plugin is client-side only (
.client.ts) - Check that script loads after component mounts
- Verify URL is correct
- Check browser console for errors
SSR hydration mismatch
SSR hydration mismatch
Solutions:
- Use
ClientOnlycomponent if needed - Ensure script loads client-side only
- Check that user data is fetched client-side
Environment variables not working
Environment variables not working
Solutions:
- Restart dev server after adding env variables
- Check
nuxt.config.tsruntimeConfig - Use
NUXT_PUBLIC_prefix for public variables - Keep secret key private (no prefix)
Best Practices
- Use server routes for hash generation
- Keep secret key in
.env(never commit) - Use composables for reusable logic
- Test in both SSR and SPA modes
- Leverage Nuxt’s built-in security features