Skip to content

NikVince/ai-chat-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

84 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Chat Interface

University Course Assignment License Phase Grade

πŸ“š 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.


πŸ› οΈ 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:
    git clone https://github.com/NikVince/ai-chat-interface.git
    cd ai-chat-interface
  2. Install dependencies:
    npm install
    cd frontend && npm install
    cd ../backend && npm install
  3. Create environment files:
    # In backend directory
    cp .env.example .env
    # Edit .env with your configuration
  4. Start development servers:
    # From root directory
    npm run dev
  5. Access the application:

Environment Variables

Create a .env file in the backend directory with:

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.


πŸ§ͺ Testing (Summary)

  • Frontend: Unit tests with Vitest & React Testing Library
    cd frontend
    npm run test
  • Backend: API tests with Mocha & Sinon
    cd backend
    npm test
  • Manual Test Plan: See 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

  • Two dynamic aspects: Real-time chat + Export Chat transcript (frontend-backend communication)
  • Responsive design: Mobile-first with Tailwind CSS
  • Frontend-backend communication: RESTful API
  • Functioning application: NOT mockups - actually works
  • Demo mode: Tutors can evaluate without API keys
  • GitHub repository: Professional, complete, public
  • Security: API keys never exposed to frontend
  • Documentation: JSDoc, README, architecture
  • Error handling: User-friendly messages, loading states
  • Quality gates: All core requirements tested and documented

For full compliance details and rationale, see docs/design_choices_and_changes.md.


πŸ“– Documentation & Further Reading


πŸ“¦ 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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors