Skip to content

coderask/interchat_showcase

Repository files navigation

Interchat Logo

Interchat

Real-time AI collaboration — powered by GPT-4o, RAG, and seamless team workflows.

Live App · Features · Tech Stack · Local Setup · Environment Variables


Interchat Workspace


Overview

Interchat is a full-stack, real-time AI collaboration platform that embeds AI assistants directly into team conversations. Users can chat with teammates, spin up AI-powered workspaces, and pull context from Google Drive, GitHub repositories, or their own conversation history — all in one place.

Live: https://interchat.app


Features

Real-Time Messaging

  • Direct 1-to-1 conversations between users
  • Messages delivered instantly via Socket.io
  • File attachments with Google Cloud Storage backing
  • Conversation history with efficient pagination

AI Chat (per Conversation)

  • Each conversation has its own AI chat session powered by OpenAI
  • Choose between GPT-4o-mini (fast) and GPT-4o (powerful)
  • Streaming responses with smooth word-level output
  • Auto-generated chat titles from the first message
  • Full message history persisted in MongoDB

AI Conversation View

Workspaces (Collaborative AI Spaces)

  • Shared AI workspaces for multi-user teams
  • Invite collaborators directly or by email (even before they sign up)
  • Switch AI models mid-conversation
  • Real-time updates for all participants via Socket.io

Context Manager (RAG-Powered)

Pull knowledge into every workspace from three sources:

Source Description
Conversations Semantically search past message threads
Google Drive Index PDFs, Docs, Sheets, and Presentations
GitHub Browse repositories and index source files

The AI uses these as retrieval-augmented generation (RAG) context when answering questions. Powered by Pinecone vector search with BGE Reranker v2-m3 for relevance ranking.

Context Manager

Friends & Social

  • Add friends by email address
  • Send and accept/reject friend requests
  • View friend profiles
  • Workspaces can be shared with anyone in your network

Friends Page

Authentication

  • Enterprise SSO via Auth0
  • Secure JWT sessions with NextAuth
  • Google Cloud file uploads scoped per user
  • GitHub OAuth for repository access (tokens stored in HTTP-only cookies)

Tech Stack

Layer Technology
Framework Next.js 15 (App Router), React 19, TypeScript 5
Styling Tailwind CSS, Radix UI, Motion
Real-time Socket.io 4 (dedicated server on port 4000)
Auth Auth0 + NextAuth 4
Database MongoDB Atlas
AI / LLM OpenAI GPT-4o / GPT-4o-mini via Vercel AI SDK
Vector DB Pinecone (RAG context)
Embeddings / Reranking LlamaIndex, LangChain, BGE Reranker v2-m3
File Storage Google Cloud Storage
Integrations Google Drive API, GitHub REST API (Octokit)
Email Resend
Deployment Vercel

Project Structure

interchat_showcase/
├── app/
│   ├── (with-sidebar)/         # Protected routes (sidebar layout)
│   │   ├── conversations/      # DM threads
│   │   ├── workspaces/         # Collaborative AI workspaces
│   │   ├── friends/            # Friend management & profile
│   │   ├── profile/            # User settings
│   │   └── feedback/           # Feedback form
│   ├── api/
│   │   ├── auth/               # NextAuth handlers
│   │   ├── chat/               # LLM + workspace AI endpoints
│   │   ├── github/callback     # GitHub OAuth callback
│   │   └── upload/files        # Google Cloud file upload
│   └── components/             # 60+ shared UI components
├── lib/
│   └── tools/                  # RAG search tools (Pinecone)
├── types/                      # TypeScript definitions
├── public/images/              # Static assets & screenshots
├── scripts/                    # DB migration scripts
└── socketServer.ts             # Dedicated Socket.io server

Local Setup

Prerequisites

  • Node.js 18+
  • MongoDB Atlas account (free tier works)
  • Auth0 account
  • OpenAI API key
  • Pinecone account (for RAG features)
  • Google Cloud project (for file uploads and Drive integration)
  • GitHub OAuth App (for GitHub context)
  • Resend account (for emails)

1. Clone and install

git clone https://github.com/your-username/interchat_showcase.git
cd interchat_showcase
npm install

2. Configure environment variables

Copy the template below into a .env.local file and fill in your values:

cp .env.example .env.local   # or create .env.local manually

See the Environment Variables section for the full list.

3. Start the Socket.io server

Interchat uses a dedicated real-time server running on port 4000. Start it in one terminal:

npm run start:socket

4. Start the Next.js dev server

In a second terminal:

npm run dev

Open http://localhost:3000 in your browser.

5. Sign in

Navigate to http://localhost:3000 and sign in via Auth0. A user record is automatically created in MongoDB on first login.


Environment Variables

Create a .env.local file in the project root with the following variables:

# ── NextAuth ──────────────────────────────────────────────────────────────────
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3000

# ── Auth0 ─────────────────────────────────────────────────────────────────────
AUTH0_SECRET=your_auth0_secret
AUTH0_BASE_URL=http://localhost:3000
AUTH0_ISSUER_BASE_URL=https://YOUR_DOMAIN.auth0.com
AUTH0_CLIENT_ID=your_auth0_client_id
AUTH0_CLIENT_SECRET=your_auth0_client_secret
NEXT_PUBLIC_AUTH0_CLIENT_ID=your_auth0_client_id
NEXT_PUBLIC_AUTH0_ISSUER_BASE_URL=https://YOUR_DOMAIN.auth0.com

# ── MongoDB ───────────────────────────────────────────────────────────────────
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<dbname>

# ── OpenAI ────────────────────────────────────────────────────────────────────
OPENAI_API_KEY=sk-...

# ── Pinecone (RAG) ────────────────────────────────────────────────────────────
PINECONE_API_KEY=pcsk_...
PINECONE_INDEX_NAME=messages-index

# ── Google Cloud Storage ──────────────────────────────────────────────────────
GOOGLE_CLOUD_PROJECT_ID=your_project_id
GOOGLE_CLOUD_BUCKET_NAME=your_bucket_name
GOOGLE_CLOUD_KEY_JSON={"type":"service_account",...}   # service account JSON (stringified)

# ── Google Drive / OAuth ──────────────────────────────────────────────────────
GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-...
GOOGLE_API_KEY=AIzaSy...

# ── GitHub OAuth ──────────────────────────────────────────────────────────────
NEXT_PUBLIC_GITHUB_CLIENT_ID=your_github_oauth_app_client_id
GITHUB_CLIENT_SECRET=your_github_oauth_app_client_secret

# ── Email (Resend) ────────────────────────────────────────────────────────────
RESEND_API_KEY=re_...

# ── Socket.io ─────────────────────────────────────────────────────────────────
NEXT_PUBLIC_SOCKET_URL=http://localhost:4000
SOCKET_PORT=4000

Available Scripts

Command Description
npm run dev Start Next.js development server (port 3000)
npm run start:socket Start Socket.io real-time server (port 4000)
npm run build Build for production
npm run start Start production server
npm run lint Run ESLint

Both npm run dev and npm run start:socket must be running simultaneously for full functionality.


Database Schema (MongoDB)

Interchat uses a single MongoDB database (messaging_app) with the following collections:

Collection Purpose
users User profiles, friends list, pending invites
conversations DM threads between participants
messages Individual messages within conversations
llm_chats AI chat sessions linked to conversations
llm_messages Messages within AI chat sessions
workspaces Collaborative AI workspaces
workspace_messages Messages within workspaces

Architecture

Browser (React / Next.js)
        │
        ├── HTTP/REST ──► Next.js API Routes (/api/*)
        │                        │
        │                        ├── MongoDB Atlas (persistence)
        │                        ├── OpenAI API (LLM streaming)
        │                        ├── Pinecone (vector search / RAG)
        │                        ├── Google Cloud Storage (file uploads)
        │                        ├── Google Drive API (document import)
        │                        └── GitHub REST API (repo import)
        │
        └── WebSocket ──► Socket.io Server (port 4000)
                                 │
                                 └── Rooms: conversations · llm-chats · workspaces

Screenshots

Landing Page
Landing Page
Workspace View
Workspace View
AI Conversation
AI Conversation
Friends Page
Friends & Profile

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages