{"id":20117074,"url":"https://github.com/akshar-raaj/softwarequizzes","last_synced_at":"2026-05-13T03:06:43.884Z","repository":{"id":216696479,"uuid":"730556278","full_name":"akshar-raaj/softwarequizzes","owner":"akshar-raaj","description":"Powers the backend for softwarequizzes.com.","archived":false,"fork":false,"pushed_at":"2024-07-08T15:52:53.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T19:31:08.704Z","etag":null,"topics":["api","fastapi","sqlalchemy"],"latest_commit_sha":null,"homepage":"http://api.softwarequizzes.com/docs","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akshar-raaj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-12-12T07:21:05.000Z","updated_at":"2024-07-08T15:52:56.000Z","dependencies_parsed_at":"2024-01-12T03:51:27.151Z","dependency_job_id":"58cbeaef-74e6-4100-9ab5-1ba51c95a785","html_url":"https://github.com/akshar-raaj/softwarequizzes","commit_stats":null,"previous_names":["akshar-raaj/softwarequizzes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akshar-raaj/softwarequizzes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshar-raaj%2Fsoftwarequizzes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshar-raaj%2Fsoftwarequizzes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshar-raaj%2Fsoftwarequizzes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshar-raaj%2Fsoftwarequizzes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshar-raaj","download_url":"https://codeload.github.com/akshar-raaj/softwarequizzes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshar-raaj%2Fsoftwarequizzes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32965808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","fastapi","sqlalchemy"],"created_at":"2024-11-13T18:43:56.453Z","updated_at":"2026-05-13T03:06:43.869Z","avatar_url":"https://github.com/akshar-raaj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\n\nThis repository powers backend of softwarequizes.com.\n\nThe APIs are hosted at http://api.softwarequizzes.com/docs.\n\n## Features\n\nThe application allows the following operations:\n- Create question\n- Create question choices\n- List questions\n- List question choices\n- User registration\n- User login\n- Answer a question\n- Track user's progress\n- Generate report\n\n## Tech Stack\n\nProgramming Language: Python\nAPI Framework: FastAPI\nTransactional Database: MySQL\nCache and session storage: Redis\nSearch Engine: Elasticsearch\nSQL Toolkit: SQLAlchemy\n\n\n### Python\n\nAllows rapid application development because of it's dynamically typed nature.\n\n### FastAPI\n\nA modern and high performance web framework geared towards building APIs.\n\nIt uses Python's async/await feature i.e cooperative multitasking and event loop making its speed at par with Node and Go.\n\nAnd it exploits Python's type hints and stands on shoulders of giants like Pydantic. This gives several features out of the box, making it a modern framework.\n\n### MySQL\n\nA relational database providing strong ACID guarantees.\n\n## Deployment Stack\nWeb Server: Gunicorn\nReverse Proxy and Load Balancer: Nginx\n\n## Setup\n\nInstall the requirements\n\n    pip install -r requirements.txt\n\nCopy the contents of `.env.example` to `.env`.\n\nEnsure you provide appropriate values for the following in `.env`\n- DATABASE_CONNECTION_STRING\n- SECRET_KEY\n- REDIS_HOST\n- REDIS_PORT\n\n## Server\n\nThe server can be started using the following command:\n\n    uvicorn main:app --reload --port 8000\n\nThis would start the server. Server would accept connections on port 8000.\n\nYou should be able to get response using following command:\n\n    curl -X GET http://localhost:8000/\n\n## API Documentation\n\nAPI Documentation can be accessed at:\n\n    http://localhost:8000/docs\n\n## Production deployment\n\nInvoke the following command\n\n    /home/ubuntu/.pyenv/versions/softwarequizzes/bin/gunicorn main:app --config ./gunicorn.conf.py\n\nThis assumes that Gunicorn executable is at `/home/ubuntu/.pyenv/versions/softwarequizzes/bin/gunicorn`.\n\nSee gunicorn.conf.py to see the process id file path and access log file path.\n\nThis will start a Gunicorn server at port 8002.\n\nIt's highly likely that the server is serving multiple domains and hence Nginx is being used as a reverse proxy.\n\nNginx configuration file would look like:\n\n    server {\n            listen 80;\n            listen [::]:80;\n\n            server_name api.softwarequizzes.com;\n\n            location / {\n                proxy_pass http://127.0.0.1:8001;\n            }\n    }\n\n## Production documentation\n\nThis application is deployed at api.softwarequizzes.com.\n\n## Architecture\n\n![softwarequizzes](https://github.com/akshar-raaj/softwarequizzes/assets/889120/d08399b8-8c3f-4cff-9c8c-cae80d06b75d)\n\n\n## Database Replication\n\nOur transactional database is MySQL.\n\nWe have configured replication for reliability and high availability.\n\nThe following link mentions the steps needed to configure replication.\n\nhttps://dev.mysql.com/doc/refman/8.0/en/replication-configuration.html\n\n### Source database server\n\nWe created a snapshot on the source database. The relevant dump file is dbdump.db\n\n### Replica database server\n\nInstall MySQL server\n\nhttps://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04\n\nChange data directory of MySQL to point to EBS\n\nhttps://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-20-04\n\nSteps:\n\n    sudo rm -rf /data/mysql/\n    sudo rsync -av /var/lib/mysql /data/\n    sudo systemctl start mysql.service\n    sudo mysql \u003c dbdump.db\n\nIssue the following commands:\n\n    mysql\u003e set global server_id = 2;\n    mysql\u003e change replication source to\n    -\u003e source_host = '\u003cip\u003e',\n    -\u003e source_user = 'repl',\n    -\u003e source_password = '\u003cpass\u003e',\n    -\u003e source_log_file = 'binlog.000038',\n    -\u003e source_log_pos = 893,\n    -\u003e GET_MASTER_PUBLIC_KEY=1;\n\nIssue start replica command\n\n    mysql\u003e start replica;\n\nThe replica should catch-up with the master soon.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshar-raaj%2Fsoftwarequizzes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshar-raaj%2Fsoftwarequizzes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshar-raaj%2Fsoftwarequizzes/lists"}