A production-ready, full-stack AI chat application featuring real-time streaming, tool usage (web search), and robust workspace management. Built with modern technologies focusing on security, scalability, and user experience.
- 🤖 Advanced AI Agent: Powered by LangGraph & OpenAI/OpenRouter, capable of multi-step reasoning and tool usage.
- Web Search: Tavily-powered search for current information
- URL Fetcher: Extract and summarize content from any webpage
- ⚡ Real-time Streaming: Custom server-sent events (SSE) implementation for token-by-token responses.
- 🔐 Secure Authentication: HttpOnly cookie-based JWT authentication with access/refresh token rotation. No localStorage tokens.
- 🏢 Workspace Management: Organize chats into workspaces; users can manage multiple distinct contexts.
- 💬 Rich Chat Interface: Markdown support, code highlighting, auto-scrolling, and tool call visualization.
- 🛡️ Robust Security: Strict data isolation (ownership checks), input validation (Zod), and secure headers.
- 🎨 Modern UI: Responsive design built with React, Tailwind CSS, and Shadcn/ui.
The application follows a clean 3-tier architecture:
- Frontend (SPA): React + Vite. Handles UI, auth context, and optimistic updates.
- Backend (API): Node.js + Express. Exposes REST endpoints and manages the LangChain/LangGraph agent runtime.
- Database: MongoDB (via Prisma). Stores users, workspaces, chat history, and messages.
- Framework: React 18, Vite
- Language: TypeScript
- Styling: Tailwind CSS, Shadcn/ui, Lucide React
- State: Context API (Auth, Workspaces) + Custom Hooks
- HTTP: Axios (Centralized client with interceptors)
- Runtime: Node.js, Express
- Language: TypeScript
- Database: MongoDB, Prisma ORM
- AI/LLM: LangChain, LangGraph, OpenRouter (GPT-4o)
- Tools: Tavily Search API, URL Fetcher (Cheerio)
- Auth: JSON Web Tokens (JWT), Bcrypt
- Node.js (v18+)
- npm or yarn
- MongoDB Database (Local or Atlas URI)
- API Keys:
- OpenRouter API Key (for LLM)
- Tavily API Key (for web search tool)
git clone <repository-url>
cd assessmentcd backend
npm install
# Create .env file
cp .env.example .env
# Update .env with your credentials (DATABASE_URL, API keys)
# Push database schema
npx prisma db push
# Start development server
npm run devcd ../frontend
npm install
# Create .env file
cp .env.example .env
# Update .env (VITE_API_URL=http://localhost:8080)
# Start development server
npm run devThe application should now be running at http://localhost:5173 (frontend) and http://localhost:8080 (backend).
PORT=8080
DATABASE_URL="mongodb+srv://..."
JWT_SECRET="complex-secret-key"
REFRESH_SECRET="complex-refresh-secret"
FRONTEND_URL="http://localhost:5173"
OPENROUTER_API_KEY="sk-or-..."
TAVILY_API_KEY="tvly-..."VITE_API_URL="http://localhost:8080"POST /api/auth/signup: Create accountPOST /api/auth/login: Login (returns httpOnly cookies)POST /api/auth/logout: LogoutPOST /api/auth/refresh: Refresh access tokenGET /api/auth/me: Get current user
GET /api/workspaces: List workspacesPOST /api/workspaces: Create workspacePUT /api/workspaces/:id: Update workspaceDELETE /api/workspaces/:id: Delete workspace
GET /api/chat-pages/workspace/:id: List chatsPOST /api/chat-pages/workspace/:id: Create chatGET /api/chat-pages/:id/messages: Get message historyPOST /api/chat/:id/stream: Stream AI response (SSE)
Run the backend build verification:
cd backend
npm run buildRun frontend linting:
cd frontend
npm run lint- Fork the repo
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
MIT