https://github.com/nikvince/ai-chat-interface
Privacy-first AI chat interface where users provide their own OpenAI API keys. Built with React + Vite frontend and Node.js/Express backend featuring secure API proxy, real-time messaging, and responsive design. No data stored on servers.
https://github.com/nikvince/ai-chat-interface
chat express javascript nodejs openai portfolio privacy react tailwind vite
Last synced: 3 months ago
JSON representation
Privacy-first AI chat interface where users provide their own OpenAI API keys. Built with React + Vite frontend and Node.js/Express backend featuring secure API proxy, real-time messaging, and responsive design. No data stored on servers.
- Host: GitHub
- URL: https://github.com/nikvince/ai-chat-interface
- Owner: NikVince
- License: mit
- Created: 2025-06-09T13:44:37.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-12T08:19:29.000Z (about 1 year ago)
- Last Synced: 2025-06-12T08:32:59.454Z (about 1 year ago)
- Topics: chat, express, javascript, nodejs, openai, portfolio, privacy, react, tailwind, vite
- Language: JavaScript
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AI Chat Interface
[](https://iu.org)
[](https://github.com/NikVince/ai-chat-interface)
[](https://github.com/NikVince/ai-chat-interface)
[](LICENSE)
[](https://github.com/NikVince/ai-chat-interface)
[](https://github.com/NikVince/ai-chat-interface)
## ๐ Academic Context
This project was developed as part of the **Project Java and Web Development (DLBCSPJWD01)** portfolio assignment at **IU International University**. The assignment followed a structured three-phase approach designed to demonstrate comprehensive understanding of modern full-stack web development principles.
**๐ Academic Achievement: 99/100 Grade**
This project successfully demonstrated mastery of full-stack web development, achieving the highest possible score in the course evaluation.
---
## ๐๏ธ Architecture Overview
```
ai-chat-interface/
โโโ backend/ # Express API server
โ โโโ middleware/ # Express middleware (e.g., validation)
โ โโโ routes/ # API route definitions (e.g., chat.js)
โ โโโ utils/ # Backend utilities (e.g., openai.js)
โ โโโ test/ # Backend test helpers and route tests
โ โโโ tests/ # (empty/reserved for future tests)
โ โโโ node_modules/ # Backend dependencies
โ โโโ package.json # Backend dependencies/config
โ โโโ server.js # Main server file
โโโ frontend/ # React + Vite + Tailwind frontend
โ โโโ src/
โ โ โโโ components/ # React components (ChatInterface, MessageList, etc.)
โ โ โโโ hooks/ # Custom React hooks (useChat.js)
โ โ โโโ utils/ # Frontend utility functions
โ โ โโโ assets/ # Static assets (e.g., react.svg)
โ โ โโโ test/ # Frontend test setup
โ โ โโโ App.jsx # Root component
โ โ โโโ main.jsx # Vite entry point
โ โ โโโ App.css # App-level styles (Tailwind only)
โ โ โโโ index.css # Tailwind base styles
โ โโโ public/ # Static public assets (favicons, manifest, etc.)
โ โโโ cypress/ # E2E test setup (fixtures, support, e2e)
โ โโโ dist/ # Production build output
โ โโโ node_modules/ # Frontend dependencies
โ โโโ package.json # Frontend dependencies/config
โ โโโ tailwind.config.js # Tailwind CSS config
โ โโโ vite.config.js # Vite config
โ โโโ vitest.config.js # Vitest config
โ โโโ postcss.config.cjs # PostCSS config
โ โโโ README.md # Frontend-specific documentation
โโโ docs/ # Project documentation (design, tests, deployment)
โโโ docs_assignement/ # Assignment transcript and requirements
โโโ docs_phase3/ # Phase 3 deliverables (abstract, screencast, etc.)
โโโ instructions/ # Project instructions and checklists
โโโ .github/ # GitHub workflows and templates
โโโ .vercel/ # Vercel deployment config
โโโ node_modules/ # Root dependencies (if any)
โโโ package.json # Root dependencies/config
โโโ package-lock.json # Root lockfile
โโโ vercel.json # Vercel monorepo deployment config
โโโ env.example # Example environment variables
โโโ LICENSE # License file
โโโ README.md # Main project documentation
```
- **Backend:** Node.js, Express.js. RESTful API, modular middleware, secure proxy for OpenAI, input validation, and rate limiting. All API endpoints are defined in `backend/routes/`.
- **Frontend:** React 18, Vite, Tailwind CSS. Functional components, custom hooks, mobile-first responsive design, and all UI logic in `frontend/src/`.
- **Testing:**
- **Frontend:** Unit tests (Vitest), E2E structure (Cypress)
- **Backend:** API and route tests (Mocha, helpers)
- **Documentation:** All design, test, and deployment docs in `/docs`. Assignment and requirements in `/docs_assignement`. Phase 3 deliverables in `/docs_phase3`.
- **Deployment:** Monorepo setup for Vercel, with configuration in `vercel.json` and `.vercel/`.
> **For the architecture diagram and detailed design choices, see [docs/design_choices_and_changes.md](docs/design_choices_and_changes.md).**
---
## ๐ ๏ธ Installation & Setup
### Prerequisites
- Node.js (v18 or higher)
- npm (v8 or higher)
- OpenAI API key (optional, demo mode available)
### Quick Start
1. Clone the repository:
```bash
git clone https://github.com/NikVince/ai-chat-interface.git
cd ai-chat-interface
```
2. Install dependencies:
```bash
npm install
cd frontend && npm install
cd ../backend && npm install
```
3. Create environment files:
```bash
# In backend directory
cp .env.example .env
# Edit .env with your configuration
```
4. Start development servers:
```bash
# From root directory
npm run dev
```
5. Access the application:
- Frontend: http://localhost:5173
- Backend: http://localhost:3000
### Environment Variables
Create a `.env` file in the backend directory with:
```env
PORT=3000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
```
---
## ๐ Features (Summary)
- Real-time chat interface with OpenAI integration
- Settings management (API key, model selection)
- **Demo mode** for evaluation without API key
- Responsive design (mobile-first)
- Secure API key handling (never exposed to frontend)
- Error handling and loading states
- Rate limiting and CORS protection
- **Export Chat Transcript** (dynamic frontend-backend feature)
> **For a full feature list and rationale, see [docs/design_choices_and_changes.md](docs/design_choices_and_changes.md).**
---
## ๐งช Testing (Summary)
- **Frontend:** Unit tests with Vitest & React Testing Library
```bash
cd frontend
npm run test
```
- **Backend:** API tests with Mocha & Sinon
```bash
cd backend
npm test
```
- **Manual Test Plan:** See [docs/test_cases.md](docs/test_cases.md) for comprehensive manual test cases covering all user actions, features, error cases, demo mode, settings, export, and accessibility.
---
## ๐งโ๐ป Demo Mode
- **Purpose:** Allows full evaluation of the chat interface without an OpenAI API key.
- **How to Use:** Toggle "Demo Mode" in the settings panel. All chat features will work with simulated responses.
- **Note:** Demo mode always returns the same default response, regardless of the type of input message.
---
## โ
Assignment Compliance Checklist
- [x] Two dynamic aspects: Real-time chat + **Export Chat transcript** (frontend-backend communication)
- [x] Responsive design: Mobile-first with Tailwind CSS
- [x] Frontend-backend communication: RESTful API
- [x] Functioning application: NOT mockups - actually works
- [x] Demo mode: Tutors can evaluate without API keys
- [x] GitHub repository: Professional, complete, public
- [x] Security: API keys never exposed to frontend
- [x] Documentation: JSDoc, README, architecture
- [x] Error handling: User-friendly messages, loading states
- [x] Quality gates: All core requirements tested and documented
> **For full compliance details and rationale, see [docs/design_choices_and_changes.md](docs/design_choices_and_changes.md).**
---
## ๐ Documentation & Further Reading
- [Design Choices & Changes to Proposal](docs/design_choices_and_changes.md)
- [Manual Test Cases](docs/test_cases.md)
- [Vercel Deployment Guide](docs/vercel_deployment_guide.md)
---
## ๐ฆ Submission & Finalization
- **Final submission (Phase 3) has been completed and includes:**
- This repository (all code, docs, and installation instructions)
- A 2-page abstract (available in `/docs_phase3`)
- A screencast video (available in `/docs_phase3`)
- Zipped folder structure as per assignment requirements
> **All Phase 3 deliverables have been successfully completed and submitted.**
---
---
## ๐ Academic Integrity
This project represents original work completed as part of the IU International University curriculum, achieving a 99/100 grade. All external resources, libraries, and references are properly documented and attributed according to academic standards.