A modern, real-time Q&A platform built with FastAPI and Next.js that enables dynamic question-answer interactions with live updates, user authentication, and admin management capabilities.
- Real-time Q&A: Ask questions and get instant answers with live updates
- WebSocket Integration: Real-time communication for instant notifications
- User Authentication: Secure login/signup system with JWT tokens
- Admin Panel: Manage questions, update statuses, and moderate content
- Guest Mode: Allow anonymous users to participate
- Smart Sorting: Questions automatically sorted by priority and status
- Status Tracking: Questions can be marked as Pending, Escalated, or Answered
- Priority Sorting: Escalated questions appear first, followed by pending, then answered
- Real-time Updates: All users see new questions and answers instantly
- Answer Suggestions: AI-powered answer suggestions for questions
- Responsive Design: Modern UI built with Tailwind CSS
- Real-time Notifications: Instant updates when new questions/answers are posted
- Clean Interface: Intuitive dashboard for easy navigation
- Mobile Friendly: Optimized for all device sizes
- FastAPI - Modern, fast web framework for building APIs
- SQLAlchemy - SQL toolkit and ORM
- WebSockets - Real-time bidirectional communication
- JWT Authentication - Secure token-based authentication
- SQLite - Lightweight database for development
- Pydantic - Data validation using Python type annotations
- Next.js 15 - React framework for production
- React 19 - Modern React with latest features
- Tailwind CSS - Utility-first CSS framework
- WebSocket Client - Real-time frontend communication
- Python 3.8+
- Node.js 18+
- npm or yarn
git clone https://github.com/yourusername/QA-pulse---Dynamic-question-answer-system-with-real-time-updates.git
cd QA-pulse---Dynamic-question-answer-system-with-real-time-updates
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the backend server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
The backend will be available at http://localhost:8000
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Run the development server
npm run dev
The frontend will be available at http://localhost:3000
- Access the Application: Open
http://localhost:3000
in your browser - Authentication:
- Sign up for a new account, or
- Log in with existing credentials, or
- Use guest mode for anonymous participation
- Ask Questions: Use the question form to post new questions
- Answer Questions: Provide answers to questions in real-time
- Admin Features: If you're an admin, you can update question statuses
- Ask questions
- Provide answers
- View all questions and answers
- Real-time updates
- All regular user features
- Update question statuses (Pending โ Escalated โ Answered)
- Moderate content
- Manage the Q&A flow
- Ask questions anonymously
- Provide answers anonymously
- View all content
- No persistent account
POST /signup
- Register a new userPOST /token
- Login and get JWT token
GET /questions/
- Get all questions (sorted by priority)POST /questions/
- Create a new questionPUT /questions/{question_id}/status
- Update question status (admin only)GET /questions/{question_id}/suggestions
- Get AI-powered answer suggestions
POST /questions/{question_id}/answers
- Add an answer to a question
WS /ws
- Real-time communication endpoint
Create a .env
file in the backend directory:
# JWT Settings
SECRET_KEY=your-secret-key-here
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Database
DATABASE_URL=sqlite:///./qa_app.db
# CORS Settings
ALLOWED_ORIGINS=http://localhost:3000
The application uses SQLite by default. The database file (qa_app.db
) will be created automatically when you first run the application.
QA-pulse/
โโโ backend/
โ โโโ app/
โ โ โโโ auth.py # Authentication logic
โ โ โโโ main.py # FastAPI application
โ โ โโโ models/
โ โ โ โโโ models.py # Database models
โ โ โโโ database/
โ โ โ โโโ database.py # Database configuration
โ โ โโโ rag/
โ โ โ โโโ llm_wrapper.py # AI integration
โ โ โ โโโ suggestions.py # Answer suggestions
โ โ โโโ schemas.py # Pydantic schemas
โ โโโ requirements.txt # Python dependencies
โ โโโ venv/ # Virtual environment
โโโ frontend/
โ โโโ app/
โ โ โโโ components/
โ โ โ โโโ QuestionForm.js # Question input form
โ โ โ โโโ QuestionList.js # Questions display
โ โ โ โโโ AnswerForm.js # Answer input form
โ โ โ โโโ auth/
โ โ โ โโโ AuthWrapper.js # Authentication wrapper
โ โ โ โโโ Login.js # Login component
โ โ โ โโโ SignUp.js # Signup component
โ โ โโโ layout.js # Root layout
โ โ โโโ page.js # Main page
โ โ โโโ globals.css # Global styles
โ โโโ package.json # Node.js dependencies
โ โโโ next.config.js # Next.js configuration
โโโ README.md # This file
# Install Heroku CLI
# Create Procfile in backend directory
echo "web: uvicorn app.main:app --host 0.0.0.0 --port \$PORT" > Procfile
# Deploy to Heroku
heroku create your-app-name
git add .
git commit -m "Deploy to Heroku"
git push heroku main
# Install Vercel CLI
npm i -g vercel
# Deploy to Vercel
vercel
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainers
- Email notifications for new questions/answers
- Rich text editor for questions and answers
- File attachments support
- Search and filtering capabilities
- User reputation system
- Categories and tags for questions
- Mobile app development
- Advanced analytics dashboard
- FastAPI community for the excellent framework
- Next.js team for the amazing React framework
- Tailwind CSS for the utility-first CSS framework
- All contributors and users of this project
Made with โค๏ธ for the developer community