DEV Community

Cover image for AtlasHackathon - A Quiz API using MongoDB and FastAPI
Manuel Kanetscheider
Manuel Kanetscheider

Posted on

AtlasHackathon - A Quiz API using MongoDB and FastAPI

I created this application to take part in MongoDB Atlas Hackathon.

Project Idea

I wanted to create a quiz API. The API allows to create quizzes and subsequently also to submit a quiz and calculate the achieved points. Quizzes can also be tagged with categories (e.g. fun, programming, general knowledge etc.).
The API also includes authentication using OAUTH2, the user data as well as all other data is stored in the MongoDB cloud atlas database.

Core functions at a glance:

  • Authentication/ Authorization using OAuth2
  • CRUD Operations for quiz categories
  • CRUD Operations for quizzes
    • Including Quiz submition and calulating the total and reached points
  • Also, the project is fully covered by unit tests

Overview of My Submission

This project was built on top of the following tech-stack:

You can test the API with the included Postman collection:
Postman Collection

Before using the collection, please create a Postman environment:
Postman environment configuration

  • api_url: URL to the API
  • username: email of your user
  • password: plain text password of your user

After this step the Access Token can be obtained:
Optain access token

Alternatively, the API can also be tested with the built-in Swagger UI:
FastAPI Swagger UI
The docs are available at this link: {host}:{port}/docs

After that: Have fun :)

For more details, please read the README.md

Submission Category: Choose Your Own Adventure

Link to Code

MongoDB Quiz API

This project was created as part of the MongoDB Hackathon, it is a quiz API that provides the following functions:

  • Authentication/ Authorization using OAuth2
  • CRUD Operations for quiz categories
  • CRUD Operations for quizzes
    • Including Quiz submition and calulating the total and reached points
  • Also, the project is fully covered by unit tests

Getting Started

This project is built on top of the Python FastApi framework using the awesome cloud based MongoDB Atlas database.

Dependencies

Tech-stack

Installing

1. Clone the git repo:

git clone https://github.com/manukanne/cloudatlas-quiz-api.git

2. Download and install Python

To download python, please vistit this link.

For this project the following Python version was used: 3.9.*

3. Create a python virtual envrionment:

For more information on how to create please visit this link.

4. Install the required packages

pip install requirement.txt

For more information, please vist this link

Additional Resources / Info

Top comments (0)