
vercel ai chatbot supabase
A Hackable AI-Chat Template Powered By Vercel's AI SDK, and using Supabase for Auth/DB
Repository Info
About This Server
A Hackable AI-Chat Template Powered By Vercel's AI SDK, and using Supabase for Auth/DB
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Next.js Ai-Chat with Supabase
This is a chat application template built with Next.js and Supabase, providing a modern UI for conversations with AI assistants.
Features
- Real-time chat interface
- Model selector for different AI models
- Public/private visibility for chats
- Document management
- Suggestions system
- User authentication via Supabase Auth
- Row-level security for data protection
Tech Stack
- Frontend: Next.js, React, Tailwind CSS
- Backend: Supabase (PostgreSQL, Auth)
- Styling: Tailwind CSS
Getting Started
Prerequisites
- Supabase CLI installed (for local development)
- A Supabase project (for production)
Setting Up the Project
- Clone this repository
git clone https://github.com/will-lp1/vercel-ai-chatbot-supabase.git
cd <repository-name>
- Install dependencies
pnpm install
- Set up Supabase locally
supabase init
supabase start
- Copy the environment variables
cp .env.example .env.local
-
Update the
.env.localfile with your Supabase URL and anon key (found in the Supabase dashboard or from the local setup) -
Run the development server
pnpm dev
Open http://localhost:3000 to see the application running.
Database Structure
The application uses the following tables in Supabase:
Chat: Stores chat conversationsMessage: Stores individual messages in chatsMessageContent: Stores different types of content within messagesDocument: Stores document informationSuggestion: Stores suggestions for document improvementsVote: Tracks user votes on messages
See the supabase/README.md file for more details on the database structure and migration files.
Authentication
The application uses Supabase Auth for user authentication. Users can:
- Sign up with email and password
- Log in with existing credentials
- Access their own chats and documents
Deployment
Deploying the Frontend
You can deploy the Next.js application to Vercel:
- Push your code to a GitHub repository
- Import the project in Vercel
- Set the environment variables (from your Supabase project)
- Deploy
Setting Up the Database
There are multiple ways to set up the database for this application:
Option 1: Using Supabase CLI (Recommended for Development)
- Create a Supabase project
- Link your local project to the Supabase project:
supabase link --project-ref your-project-ref
- Push the migrations:
supabase db push
Option 2: Using Supabase SQL Editor Directly
- Navigate to your Supabase project dashboard
- Go to the SQL Editor tab
- Copy the contents of the migration files from either:
supabase/migrations/*.sqlfileslib/db/migrations/*.sqlfiles
- Paste and execute these SQL files in order in the SQL Editor
For example, first execute 20240601000000_initial_schema.sql, then 20240601000001_functions_and_types.sql.
Option 3: Using supabase-mcp-server with AI Coding Tools
For a seamless setup experience, you can use the supabase-mcp-server with AI coding tools to:
- Follow the setup
- Connect to your Supabase project through the server
- Have the AI assistant analyze the migration files and apply them to your project
This approach is particularly useful when working with AI coding IDEs, like Windsurf and Cursor, that can help automate the setup process and ensure all migrations are applied correctly.
Project Structure
/app: Next.js app router files/components: React components/lib: Utility functions and shared code/public: Static assets/supabase: Supabase configuration and migrations
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Quick Start
Clone the repository
git clone https://github.com/will-lp1/vercel-ai-chatbot-supabaseInstall dependencies
cd vercel-ai-chatbot-supabase
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.