/interview

A React application to help manage interview questions and knowledge using Google Sheets as a backend. Built with React, TypeScript, and integrated with AI for AI-powered responses.

Primary LanguageTypeScript

Interview Helper

A React application to help manage interview questions and knowledge using Google Sheets as a backend. Built with React, TypeScript, and integrated with multiple AI services for AI-powered responses.

Features

  • πŸ“ Interview question management
  • πŸ“š Knowledge tracking system
  • πŸ€– AI-powered answers using ChatGPT, Gemini, Mistral
  • 🌐 Multi-language support (English/Vietnamese)
  • 🎨 Dark/Light theme
  • πŸ“Š Google Sheets integration
  • πŸ”„ Real-time updates

Prerequisites

Before you begin, ensure you have:

  • Node.js (version 20 or higher)
  • npm (comes with Node.js)
  • A Google Cloud Platform account
  • A Google Sheet for storing data

Installation

  1. Clone the repository:
git clone https://github.com/huyduc1602/interview.git
cd interview
  1. Install dependencies:
npm install
  1. Set up environment variables: Create a .env.local file in the root directory:
VITE_GOOGLE_SHEET_API_KEY=your_google_sheet_api_key
VITE_SPREADSHEET_ID=your_spreadsheet_id
VITE_OPENCHAT_API_KEY=your_chatgpt_api_key
VITE_GEMINI_API_KEY=your_gemini_api_key
VITE_MISTRAL_API_KEY=your_mistral_api_key

Google Sheets Setup

  1. Create a Google Sheet with two tabs:

    • "Danh mα»₯c kiαΊΏn thα»©c" (Knowledge Categories)
    • "CΓ’u hỏi phỏng vαΊ₯n" (Interview Questions)
  2. Google Cloud Platform setup:

    • Visit Google Cloud Console
    • Create a new project
    • Enable Google Sheets API
    • Create credentials (API key)
    • Add your domain to authorized origins
  3. Sheet structure:

    • Knowledge tab columns: Category, Content, Status
    • Questions tab columns: Category, Question, Answer

Available Scripts

# Start development server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

# Run ESLint
npm run lint

# Get Google OAuth refresh token
npm run get-token

Project Structure

interview/
β”œβ”€β”€ public/                     # Static files
β”œβ”€β”€ scripts/                    # Utility scripts
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/                 # Static assets (images, fonts, etc.)
β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ auth/               # Authentication components
β”‚   β”‚   β”œβ”€β”€ icons/              # Icon components
β”‚   β”‚   β”œβ”€β”€ ui/                 # UI components (buttons, inputs, etc.)
β”‚   β”œβ”€β”€ hooks/                  # Custom hooks
β”‚   β”œβ”€β”€ layouts/                # Layout components
β”‚   β”œβ”€β”€ locales/                # i18n translations
β”‚   β”œβ”€β”€ pages/                  # Page components
β”‚   β”‚   β”œβ”€β”€ InterviewQuestions/ # Interview Questions page components
β”‚   β”‚   β”œβ”€β”€ KnowledgeBase/      # Knowledge Base page components
β”‚   β”œβ”€β”€ services/               # API services
β”‚   β”œβ”€β”€ store/                  # Redux store
β”‚   β”‚   β”œβ”€β”€ actions/            # Redux actions
β”‚   β”‚   β”œβ”€β”€ reducers/           # Redux reducers
β”‚   β”‚   β”œβ”€β”€ selectors/          # Redux selectors
β”‚   β”‚   β”œβ”€β”€ slice/              # Redux slices
β”‚   β”œβ”€β”€ styles/                 # Global styles
β”‚   β”œβ”€β”€ types/                  # TypeScript types
β”‚   β”œβ”€β”€ utils/                  # Utility functions
β”‚   β”œβ”€β”€ App.tsx                 # Main App component
β”‚   β”œβ”€β”€ index.tsx               # Entry point
└── [README.md](http://_vscodecontentref_/2)                   # Project documentation

Environment Variables

Variable Description Required
VITE_GOOGLE_SHEET_API_KEY Google Sheets API key Yes
VITE_SPREADSHEET_ID ID of your Google Sheet Yes
VITE_OPENAI_API_KEY OpenAI API key Yes
VITE_OPENCHAT_API_KEY OpenChat API key Yes
VITE_GEMINI_API_KEY Gemini API key Yes
VITE_MISTRAL_API_KEY Mistral API key Yes
VITE_PERFLEXITY_API_KEY Perflexity API key Yes
VITE_GOOGLE_CLIENT_ID Google OAuth Client ID Yes
VITE_GOOGLE_CLIENT_SECRET Google OAuth Client Secret Yes
VITE_GOOGLE_REFRESH_TOKEN Google OAuth Refresh Token Yes
VITE_GITHUB_CLIENT_ID GitHub OAuth Client ID Yes
VITE_SUPABASE_URL Supabase URL Yes
VITE_SUPABASE_ANON_KEY Supabase Anonymous Key Yes
VITE_PORT Development server port No

Repository Secrets for Deployment

For GitHub Actions deployment, add these secrets to your repository:

Secret Name Description Required
OPENAI_API_KEY OpenAI API key for AI responses Yes
GEMINI_API_KEY Google Gemini API key for AI responses Yes
MISTRAL_API_KEY Mistral AI API key for AI responses Yes
OPENCHAT_API_KEY OpenChat API key for AI responses Yes
PERFLEXITY_API_KEY Perflexity API key for AI responses Yes
GOOGLE_SHEET_API_KEY API key for Google Sheets integration Yes
GOOGLE_CLIENT_ID Google OAuth Client ID Yes
GOOGLE_CLIENT_SECRET Google OAuth Client Secret Yes
GOOGLE_REFRESH_TOKEN Google OAuth Refresh Token Yes
SUPABASE_URL Supabase project URL Yes
SUPABASE_ANON_KEY Supabase anonymous key Yes
GITHUB_TOKEN Automatically provided by GitHub Actions Yes
BASE_URL Base URL path for deployment (e.g., '/interview/') Yes

Development

  1. Start the development server:
npm run dev
  1. Open http://localhost:5173

  2. Make changes and see them reflected in real-time

Building for Production

  1. Create production build:
npm run build
  1. Preview the build:
npm run preview

Deployment

This project uses GitHub Actions for CI/CD. On push to main:

  1. Tests are run
  2. Build is created
  3. Deployment to GitHub Pages

Contributing

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

Troubleshooting

Common issues and solutions:

  1. API Key errors:

    • Verify API key in .env.local
    • Check Google Cloud Console for restrictions
  2. Sheet access issues:

    • Ensure sheet is shared properly
    • Verify spreadsheet ID
  3. Build errors:

    • Clear node_modules: rm -rf node_modules
    • Reinstall: npm install

License

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

Acknowledgments

  • React + TypeScript
  • Vite
  • Tailwind CSS
  • shadcn/ui
  • Redux Toolkit
  • Google Sheets API
  • OpenAI API
  • Gemini API
  • Mistral API
  • Lucide Icons
  • i18next
  • React Router
  • JSZip
  • FileSaver.js