Skip to content

Gr8Soln/OUI-InfoMate

Repository files navigation

OUI Assistant Frontend

A modern, responsive React application built with TypeScript that provides an AI-powered chatbot interface for Oduduwa University Ipetumodu (OUI) students. Get instant information about university services, procedures, and campus life through an intuitive chat interface.

OUI Assistant TypeScript Vite TailwindCSS

🎯 Features

Core Functionality

  • AI-Powered Chat Interface - Interactive chatbot for university information
  • User Authentication - Secure login/signup with JWT token management
  • Real-time Messaging - Instant responses with smooth chat experience
  • Chat History Management - Persistent conversation history
  • Responsive Design - Optimized for desktop and mobile devices

User Experience

  • Dark/Light Theme Toggle - Customizable appearance
  • Pre-defined Questions - Quick-start suggestions for common queries
  • Auto-scroll Messages - Automatically scrolls to latest messages
  • Mobile-First Design - Collapsible sidebar for mobile users
  • Markdown Support - Rich text formatting in chat responses

Technical Features

  • Type-Safe Development - Full TypeScript implementation
  • Modern State Management - Zustand for efficient state handling
  • API Integration - React Query for optimized data fetching
  • Component Library - Shadcn/ui for consistent design system
  • Form Validation - React Hook Form with Zod schemas

πŸ› οΈ Tech Stack

Core Framework

  • React 18.3.1 - Modern React with hooks and concurrent features
  • TypeScript 5.5.3 - Type-safe JavaScript development
  • Vite 5.4.1 - Fast build tool and development server

Styling & UI

  • TailwindCSS 3.4.11 - Utility-first CSS framework
  • Shadcn/ui - High-quality component library
  • Radix UI - Headless UI primitives
  • Lucide React - Beautiful SVG icons
  • next-themes - Theme management

State Management & Data

  • Zustand - Lightweight state management
  • TanStack React Query - Data fetching and caching
  • React Hook Form - Form state management
  • Zod - Schema validation

Routing & Navigation

  • React Router DOM - Client-side routing
  • React Navigation - Programmatic navigation

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript ESLint - TypeScript-specific linting rules

πŸš€ Getting Started

Prerequisites

  • Node.js 18.0 or higher
  • npm or bun package manager
  • Git for version control

Installation

  1. Clone the repository

    git clone https://github.com/emmanuelayinde/OUI-InfoMate.git
    cd OUI-InfoMate/frontend
  2. Install dependencies

    # Using npm
    npm install
    
    # Using bun (recommended)
    bun install
  3. Environment Setup

    # Copy environment template
    cp .env.example .env
    
    # Configure your environment variables
    VITE_BASE_API_URL=http://localhost:8000
  4. Start development server

    # Using npm
    npm run dev
    
    # Using bun
    bun dev
  5. Open your browser Navigate to http://localhost:5173

πŸ“ Project Structure

frontend/
β”œβ”€β”€ public/                 # Static assets
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ placeholder.svg
β”‚   └── robots.txt
β”œβ”€β”€ src/                    # Source code
β”‚   β”œβ”€β”€ api/               # API layer
β”‚   β”‚   β”œβ”€β”€ auth.ts        # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ chat.ts        # Chat endpoints
β”‚   β”‚   β”œβ”€β”€ axios.ts       # HTTP client setup
β”‚   β”‚   └── index.ts       # API exports
β”‚   β”œβ”€β”€ components/        # Reusable components
β”‚   β”‚   β”œβ”€β”€ ui/            # Shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ ChatSidebar.tsx
β”‚   β”‚   β”œβ”€β”€ Loader.tsx
β”‚   β”‚   └── theme-toggle.tsx
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ auth/          # Authentication hooks
β”‚   β”‚   β”œβ”€β”€ use-mobile.tsx
β”‚   β”‚   └── use-toast.ts
β”‚   β”œβ”€β”€ lib/               # Utility libraries
β”‚   β”‚   └── utils.ts       # Helper functions
β”‚   β”œβ”€β”€ pages/             # Application pages
β”‚   β”‚   β”œβ”€β”€ Chat.tsx       # Main chat interface
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx  # User dashboard
β”‚   β”‚   β”œβ”€β”€ Landing.tsx    # Homepage
β”‚   β”‚   β”œβ”€β”€ Login.tsx      # Login page
β”‚   β”‚   β”œβ”€β”€ NotFound.tsx   # 404 page
β”‚   β”‚   └── Signup.tsx     # Registration page
β”‚   β”œβ”€β”€ store/             # State management
β”‚   β”‚   β”œβ”€β”€ use-auth.ts    # Authentication state
β”‚   β”‚   └── use-chat.ts    # Chat state
β”‚   β”œβ”€β”€ types/             # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ auth.ts        # Auth types
β”‚   β”‚   β”œβ”€β”€ chat.ts        # Chat types
β”‚   β”‚   └── index.ts       # Type exports
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   β”œβ”€β”€ cookie.ts      # Cookie management
β”‚   β”‚   β”œβ”€β”€ markdown.ts    # Markdown processing
β”‚   β”‚   └── index.ts       # Utility exports
β”‚   β”œβ”€β”€ App.tsx            # Main application component
β”‚   β”œβ”€β”€ main.tsx           # Application entry point
β”‚   └── index.css          # Global styles
β”œβ”€β”€ .env.example           # Environment template
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ tailwind.config.ts     # TailwindCSS configuration
β”œβ”€β”€ tsconfig.json          # TypeScript configuration
└── vite.config.ts         # Vite configuration

πŸ”§ Available Scripts

# Development
npm run dev          # Start development server
npm run build        # Build for production
npm run build:dev    # Build for development
npm run preview      # Preview production build

# Code Quality
npm run lint         # Run ESLint
npm run format       # Format code with Prettier

# Type Checking
npm run type-check   # Run TypeScript compiler check

🌐 Environment Variables

Create a .env file in the root directory:

# Backend API Configuration
VITE_BASE_API_URL=http://localhost:8000

# Optional: Additional configuration
VITE_APP_NAME=OUI Assistant
VITE_APP_VERSION=1.0.0

πŸ“± Key Components

Authentication System

  • Login/Signup Pages - User registration and authentication
  • Protected Routes - Route guards for authenticated users
  • Token Management - JWT token storage and refresh
  • User Profile - Profile management and display

Chat Interface

  • Chat Sidebar - Chat history and navigation
  • Message Display - Rich message rendering with markdown
  • Input Handler - Message composition and sending
  • Pre-defined Questions - Quick-start conversation starters

State Management

  • Auth Store - User authentication state
  • Chat Store - Chat history and active conversation
  • UI State - Theme, sidebar, and global UI state

🎨 Theming

The application supports both light and dark themes:

  • Theme Toggle - Switch between light/dark modes
  • System Preference - Respects user's system theme
  • Persistent Storage - Theme preference saved locally
  • CSS Variables - Customizable color scheme

πŸ“¦ Build & Deployment

Production Build

npm run build

Deploy to Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod

Deploy to Netlify

# Build the project
npm run build

# Deploy dist folder to Netlify

πŸ”§ Configuration

TailwindCSS

The project uses a custom TailwindCSS configuration with:

  • Custom Colors - OUI brand colors
  • Typography Plugin - Enhanced text styling
  • Animation Classes - Smooth transitions and animations

TypeScript

Strict TypeScript configuration with:

  • Path Mapping - @/ alias for src directory
  • Strict Mode - Enhanced type checking
  • Module Resolution - Node.js style imports

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Commit your changes
    git commit -m 'Add some amazing feature'
  4. Push to the branch
    git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“ Code Style

This project follows these coding standards:

  • ESLint for code quality
  • Prettier for code formatting
  • TypeScript for type safety
  • Conventional Commits for commit messages

πŸ› Troubleshooting

Common Issues

Build Errors

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

Type Errors

# Run type checking
npm run type-check

Environment Issues

  • Ensure .env file exists and contains required variables
  • Check API endpoint connectivity
  • Verify backend server is running

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Team

πŸ™ Acknowledgments

  • Oduduwa University Ipetumodu - For project inspiration
  • Shadcn/ui - For the excellent component library
  • TailwindCSS - For the utility-first CSS framework
  • React Team - For the amazing framework

For more information about the backend API, see the Backend Documentation.

Happy Coding! πŸš€

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages