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.