This project is the backend for a quiz application built with FastAPI. It supports features like user authentication, quiz management, and session scheduling.
- User management: Create, retrieve, update, and delete users.
- Quiz management: Admins can create, retrieve, update, and delete quizzes.
- Session management: Schedule quiz sessions with attributes like retakes and timing configurations.
- Python 3.8 or newer
- FastAPI
- Uvicorn: ASGI server for running FastAPI
- SQLAlchemy: ORM for database interactions
- Alembic: For database migrations
- Pydantic: For data validation through Python dataclasses
- PostgreSQL: For the production database
- Clone the repository:
git clone https://github.com/yourrepository/quiz-app-backend.git - Navigate to the project directory:
cd quiz-app-backend - Install dependencies:
pip install -r requirements.txt - Create and configure your
.envfile with necessary environment variables:DATABASE_URL=postgresql://user:password@localhost/dbname SECRET_KEY=your_secret_key_here - Run the Alembic migrations to set up your database schema:
alembic upgrade head - Start the application using Uvicorn:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
To run the tests, use the following command:
pytest
- Ensure all sensitive data is secured in environment variables.
- Set up a Docker container for the application using the provided
Dockerfile. - Deploy using a WSGI server like Gunicorn and a reverse proxy like Nginx:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app.main:app - Consider using Docker Compose for managing service configurations:
docker-compose up --build
For any queries or technical support, please open an issue on the project's GitHub page.
Thank you for using the Quiz App Backend!