A modern, responsive React application for the InterviewPrep platform - a community-sourced interview question bank where students can browse, submit, and upvote interview questions from real company interviews.
Note: This is the frontend repository. The backend API is maintained in a separate repository.
- Project Overview
- Tech Stack
- Features
- Project Structure
- Getting Started
- Environment Setup
- Components
- Pages
- API Integration
- Styling
- Contributing
- Development Guidelines
- Building for Production
InterviewPrep Frontend is a React application that provides an intuitive interface for browsing and submitting interview questions. This is a Hacktoberfest 2025 project with detailed TODO comments throughout the codebase for contributors to implement features.
- User registration and authentication
- Browse interview questions with advanced filtering
- Search questions by keyword
- Submit new interview questions
- Upvote helpful questions
- Responsive design for mobile, tablet, and desktop
This frontend application (separate repository) connects to the backend API:
- Makes HTTP requests using Axios
- Sends JWT tokens for authentication
- Receives and displays JSON data
- Handles errors and loading states
- React 18 - UI library with hooks
- Vite - Fast build tool and dev server
- Tailwind CSS - Utility-first styling
- React Router - Client-side routing
- Axios - HTTP client
- React Hot Toast - Notifications
- Context API - State management
- Project structure and boilerplate
- Routing setup
- Component templates with TODOs
- Axios configuration with interceptors
- Auth context setup
- Tailwind CSS configuration
- Responsive navbar and footer
- API integration (auth, questions)
- Form submissions and validation
- Search and filtering functionality
- Upvote system
- Pagination
- Error handling
- Loading states
- Toast notifications
frontend/
βββ public/
β βββ vite.svg # Favicon
β
βββ src/
β βββ api/
β β βββ axios.js # Axios instance [PARTIAL]
β β βββ authApi.js # Auth API [TODO]
β β βββ questionApi.js # Question API [TODO]
β β
β βββ components/
β β βββ Navbar.jsx # Navigation [COMPLETE]
β β βββ Footer.jsx # Footer [COMPLETE]
β β βββ QuestionCard.jsx # Question card [TODO]
β β βββ PrivateRoute.jsx # Route protection [COMPLETE]
β β βββ Loading.jsx # Loading spinner [COMPLETE]
β β
β βββ context/
β β βββ AuthContext.jsx # Auth state [TODO]
β β
β βββ pages/
β β βββ Home.jsx # Landing page [TODO]
β β βββ Questions.jsx # Browse page [TODO]
β β βββ AddQuestion.jsx # Submit form [TODO]
β β βββ Login.jsx # Login page [TODO]
β β βββ Register.jsx # Register page [TODO]
β β
β βββ utils/
β β βββ dateUtils.js # Date formatting [COMPLETE]
β β
β βββ App.jsx # Main app [TODO]
β βββ main.jsx # Entry point [COMPLETE]
β βββ index.css # Global styles [COMPLETE]
β
βββ .env.example # Environment template
βββ index.html # HTML entry
βββ package.json # Dependencies
βββ tailwind.config.js # Tailwind config
βββ vite.config.js # Vite config
- Node.js v16 or higher
- npm or yarn
- Backend API running (see backend repository)
- Git
- Clone the repository
git clone <frontend-repo-url>
cd interviewprep-frontend
- Install dependencies
npm install
- Setup environment variables
cp .env.example .env
Edit .env
file with your backend API URL:
VITE_API_URL=http://localhost:5000/api
VITE_APP_NAME=InterviewPrep
VITE_ITEMS_PER_PAGE=10
- Start the development server
npm run dev
The app will start on: http://localhost:5173
Create a .env
file in the root directory:
# Backend API URL
VITE_API_URL=http://localhost:5000/api
# App Configuration
VITE_APP_NAME=InterviewPrep
VITE_ITEMS_PER_PAGE=10
Important: All environment variables must be prefixed with VITE_
to be accessible in the app.
Make sure the backend API is running:
- Backend should be running on
http://localhost:5000
- Update
VITE_API_URL
in.env
to match your backend URL - Backend CORS should allow requests from
http://localhost:5173
Navigation bar with authentication-aware links.
- Status: Complete
- Features: Logo, nav links, auth buttons, responsive menu
Footer with copyright and social links.
- Status: Complete
Displays a single question with metadata.
- Status: TODO - needs API integration
- Props:
question
- Question objectonUpvote
- Upvote handler function
Protected route wrapper for authenticated users.
- Status: Complete
- Props:
children
- Components to renderrole
- Optional role requirement
Loading spinner component.
- Status: Complete
Landing page with features and CTA.
- Status: TODO
- Needs: Fetch recent questions, display features
Browse all questions with filters and search.
- Status: TODO
- Needs: API integration, filters, pagination
Form to submit new questions (protected).
- Status: TODO
- Needs: Form validation, API submission
User login page.
- Status: TODO
- Needs: Connect to auth context
User registration page.
- Status: TODO
- Needs: Connect to auth context
Pre-configured axios instance with:
- Base URL from environment
- Request interceptor (adds auth token)
- Response interceptor (handles errors)
Authentication API functions to implement:
register(userData) // Register new user
login(credentials) // Login user
getProfile() // Get current user
logout() // Logout user
Question API functions to implement:
getAllQuestions(filters) // Get questions with filters
getQuestionById(id) // Get single question
createQuestion(data) // Create new question
updateQuestion(id, data) // Update question
deleteQuestion(id) // Delete question
upvoteQuestion(id) // Toggle upvote
searchQuestions(query) // Search questions
getCategories() // Get unique categories
The project uses Tailwind CSS for styling.
Configuration: tailwind.config.js
Usage Example:
<div className="flex items-center justify-between p-4 bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow">
<h2 className="text-xl font-bold text-gray-900">Title</h2>
</div>
Contains:
- Tailwind directives
- CSS reset
- Global typography
- Custom utility classes
- Mobile: < 768px
- Tablet: 768px - 1024px
- Desktop: > 1024px
Use Tailwind responsive prefixes: sm:
, md:
, lg:
, xl:
This is a Hacktoberfest 2024 project! We welcome contributions from developers of all skill levels.
-
Find an Issue
- Browse open issues
- Look for
hacktoberfest
,good-first-issue
, orhelp-wanted
labels - Comment to get assigned
-
Fork and Clone
git clone https://github.com/your-username/interviewprep-frontend.git
cd interviewprep-frontend
- Create a Branch
git checkout -b feature/your-feature-name
-
Follow TODO Comments
- Every file has detailed TODO comments
- Read the instructions carefully
- Follow existing code patterns
-
Test Your Changes
- Test in browser (Chrome, Firefox, Safari)
- Test responsive design (mobile, tablet, desktop)
- Check browser console for errors
-
Commit and Push
git add .
git commit -m "feat: implement question filters"
git push origin feature/your-feature-name
Commit Message Convention:
feat:
- New featurefix:
- Bug fixstyle:
- Styling changesrefactor:
- Code refactoringdocs:
- Documentation
- Create Pull Request
- Link related issue
- Describe changes
- Wait for review
π’ Easy (Beginner-Friendly)
- Implement basic components
- Add styling improvements
- Form validation
- Loading states
- Error messages
π‘ Medium
- API integration
- Search functionality
- Filtering logic
- Pagination
- Auth context implementation
π΄ Hard
- Advanced search
- Real-time updates
- Infinite scroll
- Dark mode
- Performance optimization
React Best Practices:
- Use functional components with hooks
- Destructure props
- Keep components focused and small
- Use meaningful names
JavaScript:
- Use ES6+ features
- Use
const
/let
, avoidvar
- Prefer arrow functions
- Use template literals
- One component per file
- Group related components
- Keep utilities separate
- Follow existing patterns
Always handle errors gracefully:
try {
const response = await apiFunction();
// Handle success
} catch (error) {
toast.error(error.response?.data?.message || 'Something went wrong');
}
Use React Context for global state:
- Auth state in AuthContext
- Keep local state minimal
- Avoid prop drilling
npm run dev # Start dev server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
Before submitting PR:
- Tested in Chrome, Firefox, Safari
- Tested on mobile viewport
- No console errors
- Forms validate correctly
- Loading states display
- Error handling works
- API calls succeed
npm run build
Output directory: dist/
npm run preview
The dist/
folder can be deployed to:
- Vercel (recommended for Vite)
- Netlify
- GitHub Pages
- AWS S3
- Any static hosting service
Important: Set environment variables in your hosting platform:
VITE_API_URL
- Production API URL
- Push code to GitHub
- Import project in Vercel
- Set environment variables
- Deploy
Solution:
- Verify backend is running
- Check
VITE_API_URL
in.env
- Check CORS settings in backend
Solution: Vite will automatically try the next available port.
Solution:
- Ensure variables are prefixed with
VITE_
- Restart dev server after changing
.env
- Use
import.meta.env.VITE_VAR_NAME
to access
Solution:
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install
- Use React.memo for expensive components
- Lazy load routes with React.lazy
- Optimize images
- Use production build for deployment
The app follows accessibility best practices:
- Semantic HTML
- ARIA labels where needed
- Keyboard navigation
- Focus indicators
- Alt text for images
Supports modern browsers:
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Backend Repository: Backend Repo
- Documentation for Endpoints[API Routes]: Docs
For questions or issues:
- Check existing issues
- Read TODO comments in code
- Create new issue with details
- Join community discussions
- π§ Email: microsoftclub@dau.ac.in
π‘ Happy Coding & Keep Contributing! π
#Hacktoberfest2025 #OpenSource #InterviewPrep