AI Chat
A clean, minimal AI chat interface powered by OpenAI's API. Built with React, TypeScript, and Tailwind CSS.
Features
- ๐ฌ Real-time chat with OpenAI models (defaults to
gpt-4o) - ๐จ Customizable background โ set any image URL with adjustable opacity and blur
- โจ Smooth animations via Framer Motion
- ๐ Markdown rendering for AI responses (code blocks, lists, bold, etc.)
- โจ๏ธ Auto-expanding textarea โ
Enterto send,Shift+Enterfor new lines - ๐ Dark-first design with shadcn/ui components
Getting Started
Prerequisites
- Node.js 18+ and npm
- An OpenAI API key
Setup
# 1. Clone the repo
git clone <YOUR_GIT_URL>
cd <YOUR_PROJECT_NAME>
# 2. Install dependencies
npm install
# 3. Create your environment file
cp .env.example .env
# Then edit .env and add your OpenAI API key
# 4. Start the dev server
npm run devEnvironment Variables
Create a .env file at the project root:
VITE_OPENAI_API_KEY=your_openai_api_key_here
VITE_OPENAI_MODEL=gpt-4o # optional, defaults to gpt-4o
โ ๏ธ Note: The API key is used directly in the browser (dangerouslyAllowBrowser: true). This is fine for local development or personal use, but for production deployments consider proxying requests through a backend.
Available Scripts
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Production build |
npm run preview |
Preview production build locally |
npm run lint |
Run ESLint |
npm run test |
Run tests with Vitest |
Tech Stack
| Layer | Technology |
|---|---|
| Framework | React 18 + TypeScript |
| Build tool | Vite |
| Styling | Tailwind CSS + shadcn/ui |
| Animations | Framer Motion |
| AI | OpenAI Node SDK |
| Routing | React Router v6 |
| Data fetching | TanStack Query |
| Markdown | react-markdown |
| Forms | React Hook Form + Zod |
Project Structure
src/
โโโ components/
โ โโโ BackgroundSettings.tsx # Background image/opacity/blur controls
โ โโโ ChatInput.tsx # Auto-expanding message input
โ โโโ ChatMessage.tsx # Message bubble + typing indicator
โ โโโ ui/ # shadcn/ui primitives
โโโ hooks/ # Custom React hooks
โโโ lib/ # Shared utilities
โโโ pages/
โ โโโ Index.tsx # Main chat page
โ โโโ NotFound.tsx # 404 page
โโโ main.tsx
License
MIT
On this page
Languages
TypeScript100.0%
Created March 6, 2026
Updated March 6, 2026