Astro AI Chatbot Template is a modern, production-ready template for building AI-powered chat interfaces. Built with Astro, React, and the Vercel AI SDK, it provides a beautiful, responsive UI with mock implementations that you can easily replace with real AI providers.
Perfect for developers who want to quickly bootstrap AI chat applications with multiple provider support, conversation history, file uploads, and a polished user experience.
-
Clone and Install
git clone https://github.com/Marve10s/Astro-Vercel-SDK-AI-Chatbot.git cd Astro-Vercel-SDK-AI-Chatbot pnpm installOr Fork and Install
1.1 Click the 'Fork' button in the top right corner of this repository
1.2 Clone your forked repository
git clone https://github.com/YOUR_USERNAME/Astro-Vercel-SDK-AI-Chatbot.git cd Astro-Vercel-SDK-AI-Chatbot && pnpm install
-
Development
pnpm dev
-
Configure Environment
cp .env.example .env.local
Add your API keys for the providers you want to use:
- OpenAI (
OPENAI_API_KEY) - Anthropic (
ANTHROPIC_API_KEY) - Google Gemini (
GOOGLE_GENERATIVE_AI_API_KEY) - Groq (
GROQ_API_KEY)
- OpenAI (
-
Build
pnpm build pnpm preview
- π€ Multiple AI Providers - OpenAI, Anthropic, Google Gemini, Groq
- π¬ Real-time Streaming - Token-by-token response streaming
- π File Uploads - Support for image attachments
- π Dark/Light Mode - Built-in theme switching
- πΎ Conversation History - Persistent chat sessions
- π± Responsive Design - Mobile-first approach
- π¨ Beautiful UI - Modern design with Tailwind CSS
- β‘ Fast Performance - Astro's static generation + React islands
- π§ TypeScript - Full type safety
- π§© Modular Components - Easy to customize and extend
/
βββ public/ # Static assets
βββ src/
β βββ components/
β β βββ Chatbot.tsx # Main chat interface
β β βββ ThemeToggle.tsx # Theme switcher
β β βββ prompt-kit/ # UI primitives
β β β βββ chat-container.tsx
β β β βββ message.tsx
β β β βββ prompt-input.tsx
β β β βββ ...
β β βββ ui/ # Shared UI components
β βββ lib/
β β βββ utils.ts # Utility functions
β βββ mocks/ # Mock implementations
β β βββ ai-vercel-sdk.ts # AI provider mocks
β β βββ supabase.ts # Database mocks
β βββ pages/
β β βββ index.astro # Main page
β βββ styles/
β βββ global.css # Global styles + Tailwind
βββ astro.config.mjs # Astro configuration
βββ tailwind.config.mjs # Tailwind configuration
βββ package.json
| Metric | Score |
|---|---|
| π Performance | 98/100 |
| βΏ Accessibility | 96/100 |
| ποΈ Best Practices | 100/100 |
| π SEO | 100/100 |
Add support for new AI providers by extending the mock implementations in src/mocks/ai-vercel-sdk.ts:
export type Provider = "openai" | "anthropic" | "google" | "groq" | "your-provider";- Modify
src/components/prompt-kit/for core UI changes - Add custom components in
src/components/ - Customize themes in
src/styles/global.css
Replace mock functions with real API calls:
// Replace this in Chatbot.tsx
import { generateChat } from "@/mocks/ai-vercel-sdk";
// With your real implementation
import { generateChat } from "@/lib/ai-service";- Push to GitHub
- Connect to Vercel
- Add environment variables
- Deploy!
The template works with any static hosting service. For API routes, use:
// src/pages/api/chat.ts
export const config = { runtime: "edge" };
export async function POST({ request }) {
// Your AI logic here
}Have you built something amazing with this template? I'd love to see it!
- Create a GitHub issue with screenshots
- Share your demo link and modifications
Check out these amazing implementations by our community:
[Your project here - be the first to showcase!]
This project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ using Astro and Vercel AI SDK
