Welcome to the QuizCast Backend repository! This backend is built using Python's FastAPI framework, providing the core functionality and database management for the QuizCast platform. It handles user authentication, quiz management, leaderboard updates, and integrates seamlessly with Supabase for authentication, real-time database updates, and storage.
- User Authentication: Powered by Supabase (JWT tokens).
- Quiz Management: Create quizzes, add questions, and share quiz keys.
- Real-time Updates: Uses Supabase Realtime for live leaderboard updates and question broadcasts.
- Profile Picture Upload: Hosts can upload profile images, stored in Supabase's S3 bucket.
- Docker Support: Ready-to-use Docker container configuration for easy deployment.
- Python 3.8+ installed.
pip
package manager.- Supabase account and access to Supabase API.
docker
anddocker-compose
(optional, for containerized deployment).
git clone https://github.com/QuizCast/backend.git
cd backend
python -m venv .venv
source ./.venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file in the root directory and add the following variables:
SUPABASE_URL=<your_supabase_url>
SUPABASE_KEY=<your_supabase_api_key>
SUPABASE_BUCKET=<your_supabase_bucket_name>
SUPABASE_JWT_SECRET=<your_supabase_jwt_secret>
You can start the server using the following command:
uvicorn app.main:app --host 0.0.0.0 --port 8000
Alternatively, use Docker for a containerized setup:
docker build -t quizcast-backend .
docker run -p 8000:8000 quizcast-backend
After starting the server, access the interactive API documentation (Swagger UI) at:
http://127.0.0.1:8000/docs
or the ReDoc version at:
http://127.0.0.1:8000/redoc
/authentication/signup
- Sign up users./authentication/login
- Log in users./authentication/logout
- Log out users.
/user/users
- Retrieve all users./user/create_user
- Create a new user./user/update_user
- Update user details./user/get_user/{email}
- Retrieve user by email./user/get_quizHistory/{user_id}
- Retrieve quiz history.
/quiz/join
- Join a quiz./quiz/updateScore
- Submit an answer and update score./quiz/addQuestions
- Add questions to a quiz./quiz/deleteRoom
- Delete a quiz room.
backend/
│
├── app/
│ ├── main.py # Entry point for the API
| ├── api/ # Endpoints
│ ├── core/ # Configurations
│ ├── crud/ # Database Crud operations
│ ├── db/ # Supabase client setup using PythonSDK
| ├── schemas/ # Pydantic Schemas for validation
| ├── utils/
│
├── Dockerfile # Docker configuration
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── startup.sh # Startup script for the FastAPP
└── README.md # Project documentation
We welcome contributions from the community! To get started:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add some feature"
- Push your branch:
git push origin feature/your-feature-name
- Create a pull request.
This project is open-source and available under the MIT License.
For questions or feedback, feel free to reach out or open an issue. Happy coding!