Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c01bd6f

Browse files
authoredDec 14, 2024··
Merge pull request #13 from QuizCast/dev
Dev
2 parents 2cc9a60 + 80fe51a commit c01bd6f

File tree

4 files changed

+180
-1
lines changed

4 files changed

+180
-1
lines changed
 

‎LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Pawan Pinsara
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md

Lines changed: 159 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,159 @@
1-
# This is the Backend of Supabase Hackathon
1+
2+
<img src="https://github.com/user-attachments/assets/4d84857a-fa96-436c-a81c-0dd26a8a1aa7" alt="logo" width="200"/>
3+
4+
[![Build and Deploy to Azure](https://github.com/QuizCast/backend/actions/workflows/azure-serveless.yml/badge.svg)](https://github.com/QuizCast/backend/actions/workflows/azure-serveless.yml)
5+
[![Made with Supabase](https://supabase.com/badge-made-with-supabase-dark.svg)](https://supabase.com)
6+
7+
# QuizCast Backend
8+
9+
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.
10+
11+
---
12+
13+
## Features
14+
15+
- **User Authentication:** Powered by Supabase (JWT tokens).
16+
- **Quiz Management:** Create quizzes, add questions, and share quiz keys.
17+
- **Real-time Updates:** Uses Supabase Realtime for live leaderboard updates and question broadcasts.
18+
- **Profile Picture Upload:** Hosts can upload profile images, stored in Supabase's S3 bucket.
19+
- **Docker Support:** Ready-to-use Docker container configuration for easy deployment.
20+
21+
---
22+
23+
## Prerequisites
24+
25+
1. Python 3.8+ installed.
26+
2. `pip` package manager.
27+
3. **Supabase** account and access to Supabase API.
28+
4. `docker` and `docker-compose` (optional, for containerized deployment).
29+
30+
---
31+
32+
## Setup Instructions
33+
34+
### 1. Clone the Repository
35+
```bash
36+
git clone https://github.com/QuizCast/backend.git
37+
cd backend
38+
```
39+
40+
### 2. Create a Virtual Environment
41+
```bash
42+
python -m venv .venv
43+
source ./.venv/bin/activate # On Windows: venv\Scripts\activate
44+
```
45+
46+
### 3. Install Dependencies
47+
```bash
48+
pip install -r requirements.txt
49+
```
50+
51+
### 4. Configure Environment Variables
52+
Create a `.env` file in the root directory and add the following variables:
53+
```
54+
SUPABASE_URL=<your_supabase_url>
55+
SUPABASE_KEY=<your_supabase_api_key>
56+
SUPABASE_BUCKET=<your_supabase_bucket_name>
57+
SUPABASE_JWT_SECRET=<your_supabase_jwt_secret>
58+
```
59+
60+
### 5. Run the Application
61+
You can start the server using the following command:
62+
```bash
63+
uvicorn app.main:app --host 0.0.0.0 --port 8000
64+
```
65+
66+
Alternatively, use Docker for a containerized setup:
67+
```bash
68+
docker build -t quizcast-backend .
69+
docker run -p 8000:8000 quizcast-backend
70+
```
71+
72+
---
73+
74+
## API Documentation
75+
76+
After starting the server, access the interactive API documentation (Swagger UI) at:
77+
```
78+
http://127.0.0.1:8000/docs
79+
```
80+
or the ReDoc version at:
81+
```
82+
http://127.0.0.1:8000/redoc
83+
```
84+
85+
### Authentication Endpoints
86+
- `/authentication/signup` - Sign up users.
87+
- `/authentication/login` - Log in users.
88+
- `/authentication/logout` - Log out users.
89+
90+
### User Endpoints
91+
- `/user/users` - Retrieve all users.
92+
- `/user/create_user` - Create a new user.
93+
- `/user/update_user` - Update user details.
94+
- `/user/get_user/{email}` - Retrieve user by email.
95+
- `/user/get_quizHistory/{user_id}` - Retrieve quiz history.
96+
97+
### Quiz Endpoints
98+
- `/quiz/join` - Join a quiz.
99+
- `/quiz/updateScore` - Submit an answer and update score.
100+
- `/quiz/addQuestions` - Add questions to a quiz.
101+
- `/quiz/deleteRoom` - Delete a quiz room.
102+
103+
---
104+
105+
<img src="images/swaggerUI.png"></img>
106+
107+
## Project Structure
108+
109+
```
110+
backend/
111+
112+
├── app/
113+
│ ├── main.py # Entry point for the API
114+
| ├── api/ # Endpoints
115+
│ ├── core/ # Configurations
116+
│ ├── crud/ # Database Crud operations
117+
│ ├── db/ # Supabase client setup using PythonSDK
118+
| ├── schemas/ # Pydantic Schemas for validation
119+
| ├── utils/
120+
121+
├── Dockerfile # Docker configuration
122+
├── requirements.txt # Python dependencies
123+
├── .env # Environment variables
124+
├── startup.sh # Startup script for the FastAPP
125+
└── README.md # Project documentation
126+
```
127+
128+
---
129+
130+
## Contributing ❤️
131+
132+
We welcome contributions from the community! To get started:
133+
134+
1. Fork the repository.
135+
2. Create a new branch:
136+
```bash
137+
git checkout -b feature/your-feature-name
138+
```
139+
3. Commit your changes:
140+
```bash
141+
git commit -m "Add some feature"
142+
```
143+
4. Push your branch:
144+
```bash
145+
git push origin feature/your-feature-name
146+
```
147+
5. Create a pull request.
148+
149+
---
150+
151+
## License
152+
153+
This project is open-source and available under the MIT License.
154+
155+
---
156+
157+
## Contact
158+
159+
For questions or feedback, feel free to reach out or open an issue. Happy coding!

‎app/utils/hashing.py

Whitespace-only changes.

‎images/swaggerUI.png

50.6 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.