{"id":18405738,"url":"https://github.com/pybites-open-source/questionnaire-api","last_synced_at":"2025-04-07T08:32:11.771Z","repository":{"id":86406834,"uuid":"213205318","full_name":"PyBites-Open-Source/questionnaire-api","owner":"PyBites-Open-Source","description":"💡 Questionnaire REST API","archived":false,"fork":false,"pushed_at":"2019-11-05T19:13:54.000Z","size":560,"stargazers_count":28,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-22T15:12:05.331Z","etag":null,"topics":["api","flask","hacktoberfest","python3","questionnaire-api","quiz","swagger-ui"],"latest_commit_sha":null,"homepage":"https://pybites-open-source.github.io/questionnaire-api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PyBites-Open-Source.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-06T16:43:00.000Z","updated_at":"2024-10-03T14:28:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"3959d8d2-c664-4080-b1b5-56ac5f19e0e3","html_url":"https://github.com/PyBites-Open-Source/questionnaire-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fquestionnaire-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fquestionnaire-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fquestionnaire-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PyBites-Open-Source%2Fquestionnaire-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PyBites-Open-Source","download_url":"https://codeload.github.com/PyBites-Open-Source/questionnaire-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247620263,"owners_count":20968172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","flask","hacktoberfest","python3","questionnaire-api","quiz","swagger-ui"],"created_at":"2024-11-06T03:04:32.552Z","updated_at":"2025-04-07T08:32:11.757Z","avatar_url":"https://github.com/PyBites-Open-Source.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./logo/opentrivia.png\" width=\"220\"\u003e\n\u003c/p\u003e\n\n[![Open Issues](https://img.shields.io/github/issues/PyBites-Open-Source/questionnaire-api?style=for-the-badge)](https://github.com/PyBites-Open-Source/questionnaire-api/issues) [![Forks](https://img.shields.io/github/forks/PyBites-Open-Source/questionnaire-api?style=for-the-badge)](https://github.com/PyBites-Open-Source/questionnaire-api/network/members) [![Stars](https://img.shields.io/github/stars/PyBites-Open-Source/questionnaire-api?style=for-the-badge)](https://github.com/PyBites-Open-Source/questionnaire-api/stargazers) ![Build](https://img.shields.io/travis/PyBites-Open-Source/questionnaire-api?style=for-the-badge) ![Maintained](https://img.shields.io/maintenance/yes/2019?style=for-the-badge\u0026logo=github)  ![Made with Python](https://img.shields.io/badge/Made%20with-Python-blueviolet?style=for-the-badge\u0026logo=python)  ![Open Source Love](https://img.shields.io/badge/Open%20Source-%E2%99%A5-red?style=for-the-badge\u0026logo=open-source-initiative)  ![Built with Love](https://img.shields.io/badge/Built%20With-%E2%99%A5-critical?style=for-the-badge\u0026logo=ko-fi) [![PyBites/Opentrivia](https://img.shields.io/badge/PyBites%2FOpentrivia-Chat-success?logo=slack\u0026style=for-the-badge)](https://app.slack.com/client/T4SJVFM8C/CMYR582R4)\n\n`THIS PROJECT IS UNDER ACTIVE DEVELOPMENT, README MAY CHANGE EVERY ONCE IN A WHILE`\n\n\n## Index\n\n- [Index](#index)\n- [About](#about)\n- [Usage](#usage)\n  - [Installation](#installation)\n- [File Structure](#file-structure)\n- [Guideline](#guideline)\n- [Gallery](#gallery)\n- [Endpoints](#endpoints)\n- [Credit/Acknowledgment](#creditacknowledgment)\n- [License](#license)\n\n## About\nThis will be a free to use, open sourced questions database which has a REST API implemented in Python3 \u0026 Flask using PostgresSQL database, also this will be a source for a minimal quizzing website which will also let contributors add new questions in multiple categories and as MCQ or T/F types. \n\n## Usage\nTo use this project.\n\n### Installation\n\n**Development**\n\nIf you want just to do a simple test run of the application, you can install and use it \nwith development config.\n\n- Clone the repository\n\n```bash\n$ git clone https://github.com/PyBites-Open-Source/questionnaire-api.git\n```\n\n- Create the virtualenv and activate it\n\n```bash\n$ cd questionnaire-api\n$ python -m venv virtualenv\n$ source virtualenv/bin/activate # unix\n$ .\\virtualenv\\Scripts\\activate  # windows\n```\n\n- Install requirements\n\n```bash\n$ pip3 install -r ./src/requirements.txt\n```\n- Create database and apply migrations\n\n```\n$ cd src \u0026\u0026 flask db upgrade\n```  \n\n- Run the application\n\n```bash\n$ cd src \u0026\u0026 flask run\n```\n**Production**\n\nIn order to use postgresql database ready for production, you need to use docker and to add some additional environment variables. \n\n- Setup database \n\n```bash\n# create .env file wihtin src folder with the following environment variables. \nPOSTGRES_USER=\"trivia\"\nPOSTGRES_PASSWORD=\"trivia\"\nPOSTGRES_DB_PROD=\"opentrivia_prod\"\nPOSTGRES_DB_TEST=\"opentrivia_test\"\nDB_PORT=\"5432\"\nDB_HOST=\"localhost\"\n\n# if you want to change these settings you have to change also the init.sql file \n# from db folder. \n```\n\n- Run the application\n\n```bash\n$ cd src \u0026\u0026 docker-compose up\n```\n\n## File Structure\n- Add a file structure here with the basic details about files, below is an example.\n\n```\n.\n├── docker\n│   ├── api-server\n│   │   └── Dockerfile\n│   └── db-server\n│       └── Dockerfile\n├── logo\n│   └── opentrivia.png\n├── src\n│   ├── app\n│   │   ├── api\n│   │   │   ├── routes\n│   │   │   │   ├── __init__.py\n│   │   │   │   ├── answers.py\n│   │   │   │   ├── categories.py\n│   │   │   │   └── questions.py\n│   │   │   ├── tests\n│   │   │   │   ├── __init__.py\n│   │   │   │   ├── test_answers.py\n│   │   │   │   ├── test_categories.py\n│   │   │   │   └── test_questions.py\n│   │   │   └── __init__.py\n│   │   ├── models\n│   │   │   ├── __init__.py\n│   │   │   ├── answer.py\n│   │   │   ├── category.py\n│   │   │   └── question.py\n│   │   ├── static\n│   │   │   └── swagger.json\n│   │   ├── templates\n│   │   │   ├── base.html\n│   │   │   ├── developer.html\n│   │   │   └── home.html\n│   │   ├── __init__.py\n│   │   └── views.py\n│   ├── db\n│   │   └── init.sql\n│   ├── instance\n│   │   └── dev_opentrivia.db\n│   ├── migrations\n│   │   ├── versions\n│   │   │   └── 798672a50ee1_.py\n│   │   ├── README\n│   │   ├── alembic.ini\n│   │   ├── env.py\n│   │   └── script.py.mako\n│   ├── tests\n│   │   ├── __init__.py\n│   │   └── test_opentrivia.py\n│   ├── config.py\n│   ├── docker-compose.yml\n│   ├── requirements.txt\n│   └── run.py\n├── CONTRIBUTING.md\n├── LICENSE\n├── README.md\n└── _config.yml\n```\n\n\n## Guideline\n\n- __Code Style__\n\nIn order to maintain the code style consistency across entire project we use a code formatter. Therefore, we kindly suggest you to do the same whenever you push commits to this project. \n\nThe python code formatter we chose is called black. Black is a great tool and it can be installed quickly by running \n\n`pip install black`.  \n\nor\n\n`python3.6 -m pip install black`\n\nIt requires Python 3.6.0+ to run.\n\n- __Usage__\n\n`black {source_file_or_directory}`\n\nFor more details and available options, please check the [GitHub project](https://github.com/psf/black).\n\n- __Close Issues__\n\nClose issues using keywords: [how to ?](https://help.github.com/en/articles/closing-issues-using-keywords)\n\n## Gallery\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./logo/swaggerui.png\"\u003e\n\u003c/p\u003e\n\n## Endpoints\n\n`Available Views`\n- [x] http://127.0.0.1:5000/            #Home Page\n- [x] http://127.0.0.1:5000/developer   #Developer Page\n- [x] http://127.0.0.1:5000/swagger/    #Swagger UI\n\n`Available Endpoints`\n\n- Questions\n    - [x] `GET api/v1/questions` **(Get all Questions)**\n    - [x] `GET api/v1/questions/\u003cid\u003e` **(Get Question)**\n    - [x] `POST api/v1/questions` **(Create new Question)**\n    - [x] `PUT api/v1/questions/\u003cid\u003e` **(Update Question)**\n    - [x] `DELETE api/v1/questions/\u003cid\u003e` **(Delete Question)**\n- Answers \n    - [x] `GET api/v1/answers/\u003cid\u003e` **(Get Answer)**\n    - [x] `POST api/v1/answers` **(Create new Answer)**\n    - [x] `PUT api/v1/answers/\u003cid\u003e` **(Update Answer)**\n    - [x] `DELETE api/v1/answers/\u003cid` **(Delete Answer)**\n- Categories \n    - [x] `GET api/v1/categories` **(Get all Categories)**\n    - [x] `GET api/v1/categories/\u003cid\u003e` **(Get Category)**\n    - [x] `POST api/v1/categories` **(Create new Category)**\n    - [x] `PUT GET api/v1/categories/\u003cid\u003e` **(Update Category)**\n    - [x] `DELETE GET api/v1/categories/\u003cid\u003e` **(Delete Category)**\n\nfeel free to add more functionalities\nendpoint url structure:  **/api/v1/. . .**\n\n## Credit/Acknowledgment\n[![Contributors](https://img.shields.io/github/contributors/PyBites-Open-Source/questionnaire-api?style=for-the-badge)](https://github.com/PyBites-Open-Source/questionnaire-api/graphs/contributors)\n\n## License\n[![License](https://img.shields.io/github/license/PyBites-Open-Source/questionnaire-api?style=for-the-badge)](https://github.com/PyBites-Open-Source/questionnaire-api/blob/master/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybites-open-source%2Fquestionnaire-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpybites-open-source%2Fquestionnaire-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybites-open-source%2Fquestionnaire-api/lists"}