A polished AI chat assistant built with React, Vite, and Google Gemini Flash — optimized for modern conversation design and secure serverless API delivery.
A clean and modern AI chat application with a polished user interface, conversation export, and a secure serverless proxy for Gemini. Built to deliver conversational AI with a strong focus on privacy and deployment simplicity.
| Feature | Description |
|---|---|
| AI Chat | Interactive chat UI powered by Google Gemini Flash |
| Secure Proxy | Serverless Vercel function hides the Gemini API key |
| Theme Toggle | Light / dark mode support |
| Export | Download conversation history as a text file |
| Responsive | Works on desktop and mobile screens |
| Feature | Description |
|---|---|
| Vite | Fast build and dev environment |
| TypeScript | Static typing throughout the app |
| Tailwind CSS | Utility-first styling |
| Radix UI | Accessible UI primitives |
| Framer Motion | Smooth animations |
Frontend React 19 + TypeScript 5.9
Build Vite 7
Styling Tailwind CSS 4
UI Radix UI + Lucide React
Animations Framer Motion
Validation Zod
Hosting Vercel serverless functions
aschat/
├── api/ # Vercel serverless functions
│ └── gemini.ts # Secure Gemini backend proxy
├── public/ # Static assets, favicon, Open Graph image
├── src/ # App source code
│ ├── components/ # UI components
│ ├── hooks/ # Custom hooks
│ ├── lib/ # Chat helper and API wrapper
│ └── pages/ # Page-level components
├── .env.example # Example environment variables
├── .gitignore # Ignored files and folders
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite configuration
└── README.md # Project documentation
Experience the app live on Vercel:
- Node.js 18+
- npm
- Vercel account for deployment and local function preview
git clone https://github.com/ammarshahid/aschat.git
cd aschat
npm install
cp .env.example .envOpen .env and add your Gemini API key:
GEMINI_API_KEY=your_gemini_api_key_hereThe
.envfile is ignored by Git, so your secret key remains private.
To run the frontend only:
npm run devTo run the app with Vercel serverless functions locally:
npm install -g vercel
vercel devUse
vercel devso the/api/geminiendpoint works locally.
This project is already compatible with Vercel.
- Go to your Vercel dashboard.
- Select the AI Chat project.
- Navigate to Settings > Environment Variables.
- Add:
GEMINI_API_KEY- value: your Gemini API key
- environment:
Production(andPreviewif needed)
After saving the env var, redeploy your project.
- The frontend does not contain the Gemini API key anymore.
- Requests go through the secure
api/gemini.tsproxy. - The key is stored only in Vercel env vars and local
.envduring development.
- Open the chat app in the browser.
- Enter a prompt or question.
- Receive responses generated by Gemini.
- Optionally export the conversation as a text file.
api/gemini.tshandles the server-side request to Gemini.src/lib/gemini.tshandles the frontend request to the proxy.- Customize UI and content by editing components in
src/.
Contributions are welcome.
- Fork the repo
- Create a branch:
git checkout -b feature/your-change - Commit your changes:
git commit -m "Add feature" - Push and open a pull request
This project is licensed under the MIT License.
Built with React · Hosted on Vercel · Secure Gemini serverless proxy