Skip to content

Anurag13075/Breeze

Repository files navigation

🤖 AI Chat to professional docs platform

A production-ready, full-stack AI chat application built with Next.js 14, Supabase, OpenAI & NextAuth.


✨ Features

  • 🔐 Authentication — Secure login with NextAuth + Google OAuth
  • 💬 AI Chat — Real-time conversations powered by OpenAI GPT-4o
  • 🧠 Auto Sessions — Chat sessions auto-generated from first message
  • 🗄️ Persistent Storage — Full chat & message history stored in Supabase
  • Favourites — Bookmark and revisit important conversations
  • 🚫 Rate Limiting — Per-user request limits to prevent abuse
  • Server Actions — Next.js server actions for secure backend logic
  • 🎨 Modern UI — Clean, responsive design with Tailwind CSS + ShadCN

🛠️ Tech Stack

Category Technology
Framework Next.js 14 (App Router)
AI OpenAI GPT-4o (AI SDK)
Database Supabase / PostgreSQL
Auth NextAuth + Google OAuth
Styling Tailwind CSS + ShadCN UI
Deployment Vercel

🚀 Getting Started

1. Clone the repository

git clone https://github.com/Anurag13075/ai-chat-platform.git
cd ai-chat-platform

2. Install dependencies

npm install

3. Configure environment variables

Create a .env.local file in the root:

# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key

# OpenAI
OPENAI_API_KEY=your-openai-key

# Supabase
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_ANON_KEY=your-public-anon-key
SUPABASE_SERVICE_KEY=your-service-role-key

# Rate Limiting
RATE_LIMIT=5

4. Run locally

npm run dev

Visit http://localhost:3000 🎉


☁️ Deployment

git add .
git commit -m "Deploy to Vercel"
git push origin main
  1. Import your repo at vercel.com
  2. Add all environment variables
  3. Update NEXTAUTH_URL to your Vercel domain
  4. Hit Deploy ✅

📡 API Endpoints

Method Endpoint Description
POST /api/v1/chat Send a new message
GET /api/v1/chat Fetch chat history
GET /api/v1/chat/rate-limit Check rate limit status
GET /api/v1/chat/favourite Get favourite chats
POST /api/v1/chat/favourite Add chat to favourites

⚡ Example Server Action

export async function createChatSession(formData: FormData) {
  const message = formData.get("message") as string;
  const userId = formData.get("userId") as string;

  const { text } = await generateText({
    model: openai("gpt-4o-mini"),
    system: TITLE_SYSTEM_PROMPT,
    prompt: message,
  });

  const chat = await prisma.chat.create({
    data: { userId, title: text },
  });

  await prisma.message.create({
    data: {
      chatId: chat.id,
      userId,
      sender: "user",
      content: message,
      status: "PENDING",
      orderIndex: 1,
    },
  });

  return { success: true, data: { chatId: chat.id } };
}

👨‍💻 Author

Anurag Sharma — Full-Stack Developer & AI Engineer

GitHub LinkedIn Portfolio


🤝 Contributing

PRs are welcome! Found this useful? Please ⭐ the repo — it really helps!


Built with ❤️ by Anurag Sharma

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors