{"id":18830303,"url":"https://github.com/sopherapps/you-hedge-back","last_synced_at":"2025-07-11T07:39:14.824Z","repository":{"id":50350504,"uuid":"518297342","full_name":"sopherapps/you-hedge-back","owner":"sopherapps","description":"This is the back end of the YouHedge app that handles authentication of the client apps as well as hosts the privacy policy and the terms of service documents.","archived":false,"fork":false,"pushed_at":"2024-09-03T20:27:05.000Z","size":920,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-30T06:43:11.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sopherapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2022-07-27T03:35:53.000Z","updated_at":"2024-09-03T20:27:08.000Z","dependencies_parsed_at":"2024-12-30T06:41:37.289Z","dependency_job_id":"fbd77b18-ca15-4688-b900-d9789171f474","html_url":"https://github.com/sopherapps/you-hedge-back","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/sopherapps%2Fyou-hedge-back","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fyou-hedge-back/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fyou-hedge-back/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sopherapps%2Fyou-hedge-back/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sopherapps","download_url":"https://codeload.github.com/sopherapps/you-hedge-back/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768957,"owners_count":19693760,"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":[],"created_at":"2024-11-08T01:48:30.771Z","updated_at":"2025-02-20T02:41:10.827Z","avatar_url":"https://github.com/sopherapps.png","language":"CSS","readme":"# you-hedge-back\n\nThis is the back end of the YouHedge app that handles authentication of the client apps,\nquerying of the Youtube API as well as hosts the privacy policy and the terms of service documents.\nThe front end can be found at [https://github.com/sopherapps/you-hedge](https://github.com/sopherapps/you-hedge).\n\n## Dependencies\n\n- [Python v3.9+](https://www.python.org/downloads/release/python-390/)\n- [Flask v2.0+](https://flask.palletsprojects.com/en/2.1.x/)\n- [gevent v21.12+](https://www.gevent.org/)\n- [uwsgi v2.0+](https://uwsgi-docs.readthedocs.io/en/latest/)\n\n## Quick Start\n\n- To get to know what kind of requests the API can handler can be found in\n  the [API docs](https://documenter.getpostman.com/view/17998957/UzXPwGN8)\n- Ensure you have [Python v3.9+](https://www.python.org/downloads/release/python-390/) installed.\n- Clone the repo\n\n```shell\ngit clone git@github.com:sopherapps/you-hedge-back.git\n```\n\n- Copy the `example.config.json` file to `config.json` file and update the variables in the `config.json` file.\n\n```shell\ncp example.config.json config.json\n```\n\n- Create a virtual environment and activate it.\n\n```shell\npython3 -m venv env\nsource env/bin/activate # for unix\n```\n\n- Install dependencies\n\n```shell\npip install -r requirements.txt\n```\n\n- Start the uwsgi application\n\n```shell\nuwsgi --master \\\n  --workers 4 \\\n  --gevent 2000 \\\n  --protocol http \\\n  --socket 0.0.0.0:8000 \\\n  --module main:app\n```\n\n- Open your browser at [http://localhost:8000](http://localhost:8000)\n\n## In Production\n\n- You can run the app as a systemd service and expose it via an Nginx reverse proxy.\n- The service file (e.g. /etc/systemd/system/youhedge.service) can look like:\n\n```\n[Unit]\nDescription=youhedge backend uwsgi daemon\nAfter=network.target\n\n[Service]\nUser=\u003cyour-user\u003e\nGroup=www-data\nWorkingDirectory=/path-to-your-projects-folder/you-hedge-back\nExecStart=/path-to-your-projects-folder/you-hedge-back/env/bin/uwsgi --master \\\n          --workers 4 \\\n          --gevent 2000 \\\n          --protocol uwsgi \\\n          --socket 127.0.0.1:8000 \\\n          --module main:app\n\n[Install]\nWantedBy=multi-user.target\n```\n\n- Be sure to add the following config in the Nginx server config (e.g. /etc/nginx/sites-available/youhedge_api) for this app.\n\n```\nserver {\n    server_name your-domain; # e.g. server_name example.com\n\n    location = /favicon.ico { access_log off; log_not_found off; }\n    location /static/ {\n       alias /path-to-your-projects-folder/you-hedge-back/services/website/static/;\n    }\n\n    location / {\n       include uwsgi_params;\n       uwsgi_pass uwsgi://127.0.0.1:8000;\n       # these increased timeouts are for the sake of long-polling for google authentication status\n       uwsgi_read_timeout 300s;\n       proxy_read_timeout 300s;\n       proxy_connect_timeout 300s;\n       proxy_send_timeout 300s;\n    }\n}\n```\n\n## Running tests\n\n- Ensure you have [Python v3.9+](https://www.python.org/downloads/release/python-390/) installed.\n- Clone the repo\n\n```shell\ngit clone git@github.com:sopherapps/you-hedge-back.git\n```\n\n- Copy the `example.config.json` file to `config.json` file and update the variables in the `config.json` file.\n\n```shell\ncp example.config.json config.json\n```\n\n- Create a virtual environment and activate it.\n\n```shell\npython3 -m venv env\nsource env/bin/activate # for unix\n```\n\n- Install dependencies\n\n```shell\npip install -r requirements.txt\n```\n\n- Install dependencies\n\n```shell\npip install -r requirements.txt\n```\n\n- Run the test command\n\n```shell\npython -m unittest\n```\n\n## Design\n\n### Constraints\n\n- Flask must be used.\n- Flask however is a synchronous framework.\n- Youtube API has daily quotas of around 10000\n\n### Design Decisions\n\n- There will be a cache for all requests except authentication requests\n- Since this is basically a proxy, we need to be able to handle multiple requests concurrently.\n  That means we will need to use uwsgi, gevent, and flask.\n\n## License\n\nCopyright (c) 2022 [Martin Ahindura](https://github.com/tinitto). Licensed under the [MIT License](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsopherapps%2Fyou-hedge-back","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsopherapps%2Fyou-hedge-back","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsopherapps%2Fyou-hedge-back/lists"}