A modern, type-safe AI chat web client powered by Groq with advanced message editing and chat history management. Built with React 18, TypeScript, Vite, Tailwind CSS, and Shadcn/ui components for a premium user experience.
- βοΈ Built with React 18 + TypeScript for type safety and reliability
- π¨ Tailwind CSS + Shadcn/ui + Radix UI for a polished, accessible UI
- π Beautiful light/dark theme toggle with clean, modern design
- π¬ Real-time chat with smooth typing indicators
- π Chat history with localStorage persistence
- π Multiple conversations with sidebar navigation
- βοΈ Edit both user and assistant messages inline
- π₯ "Gaslit!" badges on edited messages (toggle on/off)
- π One-click copy for any message
- ποΈ Delete individual chats or clear all history
- π― Keyboard shortcuts (Cmd/Ctrl+K for new chat, Escape to close dialogs)
- π Toast notifications for user actions
- βοΈ Vercel-ready serverless deployment
- π Secure API key handling (server-side only)
- π± Fully responsive design
- Frontend: React 18, TypeScript, Vite
- Styling: Tailwind CSS, Shadcn/ui components, Radix UI primitives
- UI Components: Badge, Button, Card, Dialog, Input, Label, ScrollArea, Separator, Switch, Textarea
- Notifications: Sonner (toast library)
- Markdown: React Markdown with GitHub Flavored Markdown
- Backend: Vercel Serverless Functions / Express (local dev)
- AI: Groq API (Llama 3.3 70B by default)
- Storage: localStorage for chat history and preferences
GaslightGPT/
βββ api/ # Vercel serverless functions
β βββ chat.js # Groq API endpoint (production)
βββ src/
β βββ components/ # React components
β β βββ ui/ # Shadcn/ui components
β β β βββ badge.tsx
β β β βββ button.tsx
β β β βββ card.tsx
β β β βββ dialog.tsx
β β β βββ input.tsx
β β β βββ label.tsx
β β β βββ scroll-area.tsx
β β β βββ separator.tsx
β β β βββ switch.tsx
β β β βββ textarea.tsx
β β βββ Chat.tsx # Main chat component
β β βββ ChatMessage.tsx # Message display with copy/edit
β β βββ ErrorBoundary.tsx # Error boundary wrapper
β β βββ Header.tsx # Top navigation bar
β β βββ Logo.tsx # Logo wrapper component
β β βββ LogoIcon.tsx # SVG logo icon
β β βββ SettingsDialog.tsx # Settings modal
β β βββ Sidebar.tsx # Chat history sidebar
β β βββ TypingIndicator.tsx # Loading animation
β βββ hooks/ # Custom React hooks
β β βββ index.ts
β β βββ useAutoResize.ts # Textarea auto-resize
β β βββ useAutoScroll.ts # Chat auto-scroll
β β βββ useLocalStorage.ts # Generic localStorage hook
β βββ lib/
β β βββ chatStorage.ts # Chat history management
β β βββ utils.ts # Utility functions (cn)
β βββ types/ # TypeScript definitions
β β βββ api.ts # API request/response types
β β βββ chat.ts # Chat and message types
β β βββ index.ts # Type exports
β βββ App.tsx # Root component with state
β βββ main.tsx # Entry point
β βββ index.css # Global styles & Tailwind
βββ public/
β βββ favicon.ico # Favicon (32x32)
β βββ favicon-16.png # 16x16 favicon
β βββ favicon-32.png # 32x32 favicon
β βββ favicon-48.png # 48x48 favicon
β βββ favicon-192.png # 192x192 PWA icon
β βββ favicon-512.png # 512x512 PWA icon
β βββ apple-touch-icon.png # iOS home screen icon (180x180)
β βββ logo.svg # Merged SVG logo
β βββ manifest.json # PWA manifest
βββ index.html # HTML entry point
βββ server-dev.js # Local development API server
βββ vite.config.js # Vite configuration
βββ tsconfig.json # TypeScript configuration
βββ tailwind.config.js # Tailwind configuration
βββ vercel.json # Vercel deployment config
βββ package.json # Dependencies
Or manually:
# Install Vercel CLI
npm install -g vercel
# Deploy
vercelIn your Vercel dashboard:
- Go to Settings β Environment Variables
- Add these variables:
GROQ_API_KEY: Your Groq API key (get one here)GROQ_MODEL: (optional) Model to use (default:llama-3.3-70b-versatile)
After adding environment variables, trigger a new deployment or use:
vercel --prod- Node.js (v18 or higher recommended)
- npm or yarn
- A Groq API key (get one here)
- Clone and install dependencies
git clone https://github.com/YOUR_USERNAME/GaslightGPT.git
cd GaslightGPT
npm install- Set up environment variables
# Create .env file
cp .env.example .env
# Edit .env and add your GROQ_API_KEY
# GROQ_API_KEY=your_key_here
# GROQ_MODEL=llama-3.3-70b-versatile- Start the development server
# Runs both the API server (port 3001) and Vite dev server (port 5173)
npm run devOpen http://localhost:5173 in your browser.
Note: The
npm run devcommand usesconcurrentlyto run both the Express API server and the Vite frontend dev server simultaneously. For production deployment, use Vercel's serverless functions instead (see deployment section above).
If you prefer to test with Vercel's serverless environment locally:
# Install Vercel CLI globally
npm install -g vercel
# Run with Vercel Dev
npm run vercel-devThis will start at http://localhost:3000 but requires answering setup prompts on first run.
Create a .env file based on .env.example:
# Groq Configuration
GROQ_API_KEY=your_api_key_here
# Optional: Model selection
GROQ_MODEL=llama-3.3-70b-versatileAvailable models:
llama-3.3-70b-versatile(default, best quality and speed balance)llama-3.1-8b-instant(fastest responses)mixtral-8x7b-32768(large context window)gemma2-9b-it(Google's efficient model)
Full model list: https://console.groq.com/docs/models
- Type your message in the input box
- Press Enter or click "Send"
- Watch the typing indicator as the AI responds
- Edit Messages: Click any message to edit it inline, then save
- Copy Messages: Click the copy button (π) to copy message content
- New Chat: Click the "+" button or press
Cmd/Ctrl+K - Chat History: Click the hamburger menu to view past conversations
- Delete Chats: Hover over a chat in the sidebar and click the trash icon
- Settings: Click the gear icon to access theme toggle, clear chat options
- Theme Toggle: Switch between light and dark mode in settings
- Gaslit Labels: Toggle the "Gaslit!" badges on edited messages
Cmd/Ctrl + K: Start a new chatEscape: Close settings dialog or sidebar (on mobile)
GaslightGPT follows a clean, modern design approach:
- No AI slop: Removed excessive purple gradients, over-centered layouts, and stacked backdrop blurs
- Varied spacing: Different border radii and padding for visual hierarchy
- Subtle shadows: Single-layer shadows for depth without complexity
- Theme-aware: Colors adapt to light/dark mode using CSS custom properties
- Accessibility: Built on Radix UI primitives for keyboard navigation and screen readers
- Never commit your
.envfile to the repository .env.examplecontains placeholder names only- For Vercel: Add secrets in the dashboard under Environment Variables
- API keys are only used server-side, never exposed to the client
- Chat history is stored locally in browser localStorage only
Vercel Deployment:
- Make sure environment variables are set in Vercel dashboard
- Check deployment logs in Vercel dashboard for errors
- Verify your OpenAI API key is valid and has credits
Local Development:
- Ensure all dependencies are installed (
npm install) - Check that your
.envfile exists and contains valid values - Verify ports 3001 (API) and 5173 (frontend) are not in use
- If you see "EADDRINUSE" errors, kill the process using the port
- Check browser console for errors (F12 β Console tab)
API Errors:
- Verify your
GROQ_API_KEYis correct and active - Check if you're hitting rate limits (Groq offers 1000 free requests)
- Try a different model if one isn't working
- Ensure the selected model is available on your Groq plan
TypeScript Errors:
- Run
npm run buildto check for type errors - Ensure all
.tsxfiles import types from@/types - Check that
tsconfig.jsonis properly configured
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.