Skip to content
developerammar382Public

About

A modern AI chat assistant built with React, Vite, and Google Gemini Flash, featuring a polished responsive UI, secure Vercel serverless proxy for API key protection, and exportable chat history. Perfect for developers who want a fast, clean conversational interface with secure deployment and strong frontend performance

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

✦ AI Chat App

A polished AI chat assistant built with React, Vite, and Google Gemini Flash — optimized for modern conversation design and secure serverless API delivery.

React TypeScript Vite Tailwind CSS Vercel License: MIT


Live Demo • Source Code


Overview

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.

Features

Core Experience

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

Developer Experience

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

Tech Stack

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

Project Structure

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

Live Demo

Experience the app live on Vercel:

Setup

Prerequisites

  • Node.js 18+
  • npm
  • Vercel account for deployment and local function preview

Installation

git clone https://github.com/ammarshahid/aschat.git
cd aschat
npm install
cp .env.example .env

Open .env and add your Gemini API key:

GEMINI_API_KEY=your_gemini_api_key_here

The .env file is ignored by Git, so your secret key remains private.

Local Development

To run the frontend only:

npm run dev

To run the app with Vercel serverless functions locally:

npm install -g vercel
vercel dev

Use vercel dev so the /api/gemini endpoint works locally.

Deployment on Vercel

This project is already compatible with Vercel.

Add environment variables

  1. Go to your Vercel dashboard.
  2. Select the AI Chat project.
  3. Navigate to Settings > Environment Variables.
  4. Add:
    • GEMINI_API_KEY
    • value: your Gemini API key
    • environment: Production (and Preview if needed)

Redeploy

After saving the env var, redeploy your project.

Security Notes

  • The frontend does not contain the Gemini API key anymore.
  • Requests go through the secure api/gemini.ts proxy.
  • The key is stored only in Vercel env vars and local .env during development.

How to Use

  1. Open the chat app in the browser.
  2. Enter a prompt or question.
  3. Receive responses generated by Gemini.
  4. Optionally export the conversation as a text file.

Notes

  • api/gemini.ts handles the server-side request to Gemini.
  • src/lib/gemini.ts handles the frontend request to the proxy.
  • Customize UI and content by editing components in src/.

Contributing

Contributions are welcome.

  1. Fork the repo
  2. Create a branch: git checkout -b feature/your-change
  3. Commit your changes: git commit -m "Add feature"
  4. Push and open a pull request

License

This project is licensed under the MIT License.


Built with React · Hosted on Vercel · Secure Gemini serverless proxy

About

A modern AI chat assistant built with React, Vite, and Google Gemini Flash, featuring a polished responsive UI, secure Vercel serverless proxy for API key protection, and exportable chat history. Perfect for developers who want a fast, clean conversational interface with secure deployment and strong frontend performance

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages