SupabaseAuthWithSSR  by ElectricCodeGuy

Next.js template with Supabase auth, RAG, and AI web search

created 1 year ago
356 stars

Top 79.5% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a production-ready template for Next.js 15 applications, integrating Supabase SSR authentication with advanced AI features like document chat (RAG), web search, and multi-LLM support. It targets developers building complex, AI-powered web applications requiring secure user management and efficient data handling.

How It Works

The architecture leverages Next.js 15's Server Components for SSR authentication and AI logic. Supabase handles user authentication, database storage (including pgvector for embeddings), and file storage with robust Row Level Security (RLS). Document processing is managed by LlamaIndex Cloud, which converts PDFs to markdown and generates embeddings. Tavily AI is used for web search, and Upstash Redis provides rate-limiting and caching. The project prioritizes code locality over strict design patterns, keeping feature-related code together for clarity and maintainability.

Quick Start & Requirements

  • Install: npm install
  • Prerequisites: Supabase account, LlamaIndex Cloud API key, Upstash Redis account, Tavily API key, OpenAI API key, Anthropic API key, Perplexity API key, Langfuse API key.
  • Database Setup: Requires executing SQL scripts in Supabase for user tables, chat sessions, messages, and pgvector table with HNSW indexing.
  • Storage Setup: Create a 'userfiles' bucket in Supabase Storage with specific RLS policies.
  • Environment Variables: Configure .env.local with Supabase URL/keys and other API keys.
  • Docs: Supabase Auth with SSR + RAG + Tavily AI Web Search

Highlighted Details

  • Integrates Supabase Auth with Next.js 15 SSR and React Server Components.
  • Implements RAG for document chat using pgvector with HNSW indexing for efficient similarity search.
  • Supports multiple LLM providers (OpenAI, Anthropic, Perplexity) and Tavily AI for web search.
  • Features secure file storage with user-specific RLS policies in Supabase.
  • Employs a "code locality" philosophy for maintainability, minimizing shared code.

Maintenance & Community

The repository is maintained by ElectricCodeGuy. No specific community channels or roadmap details are provided in the README.

Licensing & Compatibility

Licensed under the MIT License, permitting commercial use and integration with closed-source projects.

Limitations & Caveats

The project requires a significant number of third-party API keys for full functionality, which may incur costs. The "code locality" approach, while aiming for clarity, might lead to some intentional code duplication. The README mentions Next.js 15, which is still relatively new and may have evolving best practices.

Health Check
Last commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
91 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems).

super-rag by superagent-ai

0.3%
380
RAG pipeline for AI apps
created 1 year ago
updated 1 year ago
Starred by Jared Palmer Jared Palmer(Ex-VP of AI at Vercel; Founder of Turborepo; Author of Formik, TSDX).

chatgpt-pgvector by gannonh

0%
938
Domain-specific chat completions app
created 2 years ago
updated 2 years ago
Feedback? Help us improve.