{"id":16886889,"url":"https://github.com/jlevy/autotube","last_synced_at":"2025-04-12T00:30:32.095Z","repository":{"id":184760799,"uuid":"672411966","full_name":"jlevy/autotube","owner":"jlevy","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-30T20:27:33.000Z","size":379,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T23:23:27.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/jlevy.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-07-30T01:57:55.000Z","updated_at":"2024-06-19T07:18:35.000Z","dependencies_parsed_at":"2023-08-18T20:00:39.284Z","dependency_job_id":null,"html_url":"https://github.com/jlevy/autotube","commit_stats":null,"previous_names":["jlevy/autotube"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fautotube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fautotube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fautotube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Fautotube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlevy","download_url":"https://codeload.github.com/jlevy/autotube/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233723960,"owners_count":18720110,"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-10-13T16:41:51.726Z","updated_at":"2025-01-13T09:49:47.526Z","avatar_url":"https://github.com/jlevy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Developer Setup\n\n### Prerequisites\n\n- have [pyenv installed](https://github.com/pyenv/pyenv)\n- poetry [installed manually](https://python-poetry.org/docs/#installation)\n- have [nvm installed](https://github.com/nvm-sh/nvm)\n\nInstall Python and Node. Tested with these versions:\n\n```\npyenv install 3.11.1\nnvm install v20.3.1\n```\n\nAlso:\n\n```\n# For YouTube support (yt_dlp):\nbrew install ffmpeg\n# For Hasura CLI:\ncurl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash\n```\n\n\n### IDE\n\nConfigure VSCode to autoformat:\n\n- Python with black (it should adapt to the backend/pyproject.toml settings)\n- ESLint and Prettier installed and run by default.\n- Install [TypeScript Import Sorter](https://marketplace.visualstudio.com/items?itemName=mike-co.import-sorter)\n\nVSCode's settings.json for these:\n\n```\n    \"black-formatter.args\": [\n        \"--line-length\",\n        \"100\"\n    ],\n    \"[typescript]\": {\n        \"editor.defaultFormatter\": \"dbaeumer.vscode-eslint\",\n        \"editor.codeActionsOnSave\": [\n            \"source.formatDocument\",\n            \"source.fixAll.eslint\"\n        ],\n        \"editor.formatOnSave\": true,\n    },\n    \"[typescriptreact]\": {\n        \"editor.defaultFormatter\": \"dbaeumer.vscode-eslint\",\n        \"editor.codeActionsOnSave\": [\n            \"source.formatDocument\",\n            \"source.fixAll.eslint\"\n        ],\n        \"editor.formatOnSave\": true,\n    },\n    \"importSorter.sortConfiguration.customOrderingRules.defaultNumberOfEmptyLinesAfterGroup\": 0,\n    \"importSorter.generalConfiguration.sortOnBeforeSave\": true,\n    \"importSorter.sortConfiguration.removeUnusedImports\": true,\n    \"importSorter.sortConfiguration.removeUnusedDefaultImports\": true\n```\n\n## Backend\n\n### Installation\n\n```\ncd backend\npoetry install\npoetry shell\n```\n\n### Database Setup\n\nUse Postgres 15 locally or in the cloud.\n\n```\ncreatedb XXX\n```\n\nCreate `secrets/secrets.toml` (using `secrets/secrets.toml.template`) and put an appropriate URI like inside,\nlike `database_uri = \"postgresql://postgres@localhost/XXX\"`.\n\nMigrate database:\n\n```\n# Setup for database operations:\ncd backend/src\nexport FLASK_APP=manage.py\n\n# First database migration:\nflask db upgrade\n```\n\nEnsure initial values values for the enum types are inserted\n(which is requried by Hasura for the enums):\n\n```\n# Idempotent insertion of enums:\npython -m load_init_model update_enum_tables\n```\n\n### Hasura Setup\n\nSet up Hasura locally or via their cloud offering and connect it to the database.\nUse the Relay endpoint (not the regular Hasura endpoint).\nNote web UI is very useful but if we make any changes (like relations) we want to save\nthem as metadata in the hasura/YAML export.\n\n### Database Migrations and Schema Changes\n\nOnly required when changing model or schema (can skip this section on initial setup).\nWorkflow for updating database and GraphQL schemas:\n\n```\n# Convenience function for development to fully erase the db and migrations and start over:\nflask erase_db_all  # caution!\n\n# To create a new migration after model changes:\nflask db migrate -m \"Some model change.\"\n# Review migrations/versions for correctness.\n# Then apply (and check in updated version file):\nflask db upgrade\n```\n\nRerun update_enum_tables (as above) if appropriate.\n\nConfigure the backend endpoint environment variables for webhooks, e.g.\n```\n# Webhooks are configured as {{NEXT_PUBLIC_BACKEND_URL}}/{{NEXT_PUBLIC_BACKEND_API_PREFIX}}/\u003cmethod\u003e\n# in the metadata.\nNEXT_PUBLIC_BACKEND_URL=http://127.0.0.1:5000\nNEXT_PUBLIC_BACKEND_API_PREFIX=api/v1\n```\n\nMake changes in Hasura to adjust enums, relations, etc.\nThis can be done in the dashboard or via commandline as below.\nThen save the changes made from Hasura:\n\n```\n# Hasura metadata management:\ncd hasura\nhasura metadata reload   # Pick up changes to database.\nhasura metadata export   # Save changes as YAML.\n# Handle meatadata conflicts (usually only needed for significant schema\n# deletions/changes):\nhasura metadata ic status\nhasura metadata ic list\nhasura metadata ic drop\n```\n\nFinally export the new schema for use in the frontend:\n\n```\ncd frontend\nnpm run schema\n```\n\nNow check in the changes (backend migrations, schema.graphql, and Hasura metadata YAML files).\n\n### Keys\n\nAdd `secret_openai = \"sk-...\"` into `secrets/secrets.toml`.\n\nCopy `frontend/env.template` to `frontend/.env.local` and edit with admin secret.\n\nCopy `hasura/env.template` to `hasura/.env` and edit with admin secret.\n\n\n### Python Updates \n\nIf desired to fully update packages:\n\n```\npoetry up --latest\n```\n\nNote we're using [the poetry up plugin](https://github.com/MousaZeidBaker/poetry-plugin-up)\nto help with updates.\n\n\n## Frontend\n\n### Building and Running Frontend\n\n```\ncd frontend\n# Packages and build are from Remix:\nnpm install\n# Hotloading dev server and relay server at once:\nnpm run relay-dev\n# Build and run Relay and Next:\n# (use this to catch build errors the dev server may tolerate)\nnpm run build\nnpm run start\n# Build with React profiling:\nnpm run build -- --profile\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Fautotube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlevy%2Fautotube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Fautotube/lists"}