"# QuizzApp-RBMI
A comprehensive Quiz Application with Role-Based Management Interface built with React (Frontend) and FastAPI (Backend).
- User Management: Create and manage teachers and students
- Quiz Management: Oversee all quizzes and assessments
- Analytics Dashboard: Real-time statistics and activity tracking
- Teacher Activity Lookup: Monitor teacher engagement and quiz creation
- Student Activity Lookup: Track student performance and participation
- Detailed Reports: AI-powered insights using Gemini API
- Bulk User Upload: Import users via Excel/CSV files
- Create and manage quizzes
- Multiple question types (MCQ, True/False, Short Answer)
- View student attempts and results
- Department and class-based filtering
- Browse and attempt available quizzes
- Instant result calculation
- Track quiz history and performance
- Department and class-specific quizzes
- React with Vite
- React Router for navigation
- Tailwind CSS for styling
- Lucide React for icons
- FastAPI - Modern Python web framework
- SQLAlchemy - ORM for database management
- SQLite - Database (can be swapped for PostgreSQL in production)
- JWT - Authentication and authorization
- Bcrypt - Password hashing
- Pydantic - Data validation
QuizzApp-RBMI/
├── frontend/ # React frontend
│ ├── src/
│ │ ├── pages/ # Login, Dashboard pages
│ │ ├── components/ # Reusable components
│ │ └── assets/ # Images, SVGs
│ └── package.json
│
└── backend/ # FastAPI backend
├── app/
│ ├── api/v1/ # API endpoints
│ ├── core/ # Config, security
│ ├── models/ # Database models
│ ├── schemas/ # Pydantic schemas
│ └── db/ # Database setup
├── .env # Environment variables
├── requirements.txt # Python dependencies
└── run.sh # Quick start script
Windows:
start.batLinux/Mac:
./start.shThis will automatically:
- ✅ Check system requirements (Python 3 & Node.js)
- ✅ Create virtual environment for backend
- ✅ Install all dependencies (backend & frontend)
- ✅ Start backend server on http://localhost:8000
- ✅ Start frontend server on http://localhost:5173
- ✅ Open the application in your browser
Note: Press Ctrl+C to stop all servers
- Navigate to backend directory:
cd backend- Run the startup script (creates venv, installs dependencies, starts server):
./run.shOr manually:
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- Access the API:
- API: http://localhost:8000
- API Docs (Swagger): http://localhost:8000/docs
- API Docs (ReDoc): http://localhost:8000/redoc
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Start development server:
npm run dev- Access the app:
- Frontend: http://localhost:5173
Admin Login:
- Email:
admin@macquiz.com - Password:
admin123
POST /api/v1/auth/login- OAuth2 form loginPOST /api/v1/auth/login-json- JSON login
POST /api/v1/users/- Create user (Admin)GET /api/v1/users/- List all users (Admin)GET /api/v1/users/me- Get current userGET /api/v1/users/{id}- Get user by ID (Admin)PUT /api/v1/users/{id}- Update user (Admin)DELETE /api/v1/users/{id}- Delete user (Admin)GET /api/v1/users/activity/teachers- Teacher activity (Admin)GET /api/v1/users/activity/students- Student activity (Admin)
POST /api/v1/quizzes/- Create quiz (Teacher/Admin)GET /api/v1/quizzes/- List quizzesGET /api/v1/quizzes/{id}- Get quiz detailsPUT /api/v1/quizzes/{id}- Update quiz (Teacher/Admin)DELETE /api/v1/quizzes/{id}- Delete quiz (Teacher/Admin)
POST /api/v1/attempts/start- Start quiz attemptPOST /api/v1/attempts/submit- Submit answersGET /api/v1/attempts/my-attempts- Get user attemptsGET /api/v1/attempts/quiz/{id}/attempts- Get quiz attempts (Teacher/Admin)GET /api/v1/attempts/stats/dashboard- Dashboard stats (Admin)GET /api/v1/attempts/stats/activity- Recent activity (Admin)
POST /api/v1/analytics/reports/ai-insights- Generate AI-based insights (Gemini if configured, safe fallback otherwise)
See backend/API_EXAMPLES.md for detailed API usage examples.
- Authentication and profile information
- Roles: admin, teacher, student
- Student-specific: student_id, department, class_year
- Title, description, creator
- Department and class filters
- Duration and marks configuration
- Multiple types: MCQ, True/False, Short Answer
- Options and correct answers
- Individual marks allocation
- Student attempts tracking
- Score and percentage calculation
- Timing information
- Student responses
- Correctness evaluation
- Marks awarded
cd backend
source venv/bin/activate
pytest # (setup tests as needed)cd frontend
npm run test # (setup tests as needed)# Backend
black app/
flake8 app/
# Frontend
npm run lint- Change
SECRET_KEYin.env - Change default admin credentials
- Use PostgreSQL instead of SQLite
- Configure proper CORS origins
- Enable HTTPS
- Set up logging and monitoring
- Configure rate limiting
- Use environment-specific configs
- Update API endpoint URLs
- Build for production:
npm run build - Configure proper CORS
- Set up CDN for static assets
- Enable HTTPS
Backend Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]Frontend Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
CMD ["npm", "run", "preview"]DATABASE_URL=sqlite:///./quizapp.db
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
CORS_ORIGINS=http://localhost:5173,http://localhost:3000
ADMIN_EMAIL=admin@macquiz.com
ADMIN_PASSWORD=admin123VITE_API_URL=http://localhost:8000- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the API Examples
- Check the Backend README
- Create an issue in the repository
- React and Vite teams for excellent frontend tools
- FastAPI team for the amazing Python framework
- Tailwind CSS for the utility-first CSS framework
- Lucide for beautiful icons "