{"id":17654921,"url":"https://github.com/ellmetha/django-js-routes","last_synced_at":"2025-10-16T05:22:14.681Z","repository":{"id":38848173,"uuid":"192266606","full_name":"ellmetha/django-js-routes","owner":"ellmetha","description":"Expose and perform reverse lookups of Django URLs in the frontend world.","archived":false,"fork":false,"pushed_at":"2025-04-16T15:32:26.000Z","size":4463,"stargazers_count":34,"open_issues_count":9,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-23T05:39:21.432Z","etag":null,"topics":["django","export","frontend","javascript","js","resolution","reverse","routes","urls"],"latest_commit_sha":null,"homepage":"","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/ellmetha.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","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,"zenodo":null}},"created_at":"2019-06-17T03:09:28.000Z","updated_at":"2025-06-12T13:46:47.000Z","dependencies_parsed_at":"2023-02-18T19:30:41.311Z","dependency_job_id":"b4e669d4-1915-484c-a677-9e1727ff1670","html_url":"https://github.com/ellmetha/django-js-routes","commit_stats":{"total_commits":188,"total_committers":3,"mean_commits":"62.666666666666664","dds":"0.35106382978723405","last_synced_commit":"38d4e8149f7832688f5868aefaffceace9c83bbf"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ellmetha/django-js-routes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-js-routes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-js-routes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-js-routes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-js-routes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ellmetha","download_url":"https://codeload.github.com/ellmetha/django-js-routes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellmetha%2Fdjango-js-routes/sbom","scorecard":{"id":373495,"data":{"date":"2025-08-11","repo":{"name":"github.com/ellmetha/django-js-routes","commit":"ac2ac82093628bf10dad540b91b6631ca0a21588"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/3 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/ellmetha/django-js-routes/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/ellmetha/django-js-routes/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/ellmetha/django-js-routes/ci.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:45","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:46","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:49","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"43 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-7xr5-9hcq-chf9","Warn: Project is vulnerable to: GHSA-rrqc-c2jx-6jgv","Warn: Project is vulnerable to: GHSA-29gw-9793-fvw7","Warn: Project is vulnerable to: PYSEC-2022-42969","Warn: Project is vulnerable to: PYSEC-2023-117 / GHSA-mrwq-x4v8-fh7p","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579","Warn: Project is vulnerable to: GHSA-2m57-hf25-phgg","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T13:32:55.550Z","repository_id":38848173,"created_at":"2025-08-18T13:32:55.550Z","updated_at":"2025-08-18T13:32:55.550Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279159299,"owners_count":26116435,"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","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"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":["django","export","frontend","javascript","js","resolution","reverse","routes","urls"],"created_at":"2024-10-23T12:40:18.813Z","updated_at":"2025-10-16T05:22:14.652Z","avatar_url":"https://github.com/ellmetha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-js-routes\n################\n\n.. image:: https://img.shields.io/pypi/l/django-js-routes.svg\n    :target: https://pypi.python.org/pypi/django-js-routes/\n    :alt: License\n\n.. image:: https://img.shields.io/pypi/pyversions/django-js-routes.svg\n    :target: https://pypi.python.org/pypi/django-js-routes\n\n.. image:: https://img.shields.io/pypi/v/django-js-routes.svg\n    :target: https://pypi.python.org/pypi/django-js-routes/\n    :alt: Latest Version\n\n.. image:: https://github.com/ellmetha/django-js-routes/workflows/CI/badge.svg\n  :target: https://github.com/ellmetha/django-js-routes/actions\n  :alt: Build status\n\n|\n\n**Django-js-routes** is a Django application allowing to expose and perform reverse lookups of\nDjango named URL patterns on the client side.\n\n.. contents:: Table of Contents\n    :local:\n\nMain requirements\n=================\n\nPython 3.6+, Django 3.2+.\n\nInstallation\n============\n\nTo install Django-js-routes, please use the pip_ command as follows:\n\n.. code-block:: shell\n\n    $ pip install django-js-routes\n\nOnce the package is installed, you'll have to add the application to ``INSTALLED_APPS`` in your\nproject's settings module:\n\n.. code-block:: python\n\n    INSTALLED_APPS = (\n        # all other apps...\n        'js_routes',\n    )\n\nYou can then define which URL patterns or URL namespaces you want to expose to the client side by\nsetting the ``JS_ROUTES_INCLUSION_LIST`` setting. This setting allows to define which URLs should be\nserialized and made available to the client side through the generated and / or exported Javascript\nhelper. This list should contain only URL pattern names or namespaces. Here is an example:\n\n.. code-block:: python\n\n    JS_ROUTES_INCLUSION_LIST = [\n        'home',\n        'catalog:product_list',\n        'catalog:product_detail',\n    ]\n\nNote that if a namespace is included in this list, all the underlying URLs will be made available to\nthe client side through the generated Javascript helper. Django-js-routes is safe by design in the\nsense that *only* the URLs that you configure in this inclusion list will be publicly exposed on the\nclient side.\n\nOnce the list of URLs to expose is configured, you can add the ``{% js_routes %}`` tag to your base\ntemplate in order to ensure that the Javascript helper is available to you when you need it:\n\n.. code-block:: html\n\n    {% load js_routes_tags %}\n    \u003chtml\u003e\n        \u003chead\u003e\n        \u003c/head\u003e\n        \u003cbody\u003e\n            \u003c!-- At the bottom of the document's body... --\u003e\n            {% js_routes %}\n        \u003c/body\u003e\n    \u003c/html\u003e\n\nUsage\n=====\n\nThe URL patterns you configured through the ``JS_ROUTES_INCLUSION_LIST`` setting can then be\nreversed using the generated ``window.reverseUrl`` function, which can be used pretty much the\n\"same\" way you'd use `reverse \u003chttps://docs.djangoproject.com/en/dev/ref/urlresolvers/#reverse\u003e`_ on\nthe Django side:\n\n.. code-block:: javascript\n\n    window.reverseUrl('home');\n    window.reverseUrl('catalog:product_list');\n    window.reverseUrl('catalog:product_detail', productId);\n    window.reverseUrl('catalog:product_detail', { pk: productId });\n\nSettings\n========\n\nJS_ROUTES_INCLUSION_LIST\n------------------------\n\nDefault: ``[]``\n\nThe ``JS_ROUTES_INCLUSION_LIST`` setting allows to define the URL patterns and URL namespaces that\nshould be exposed to the client side through the generated Javascript helper.\n\nAdvanced features\n=================\n\nInserting only the serialized URLs in Django templates\n------------------------------------------------------\n\nBy default, the ``{% js_routes %}`` template tag only allows to trigger the generation of the\nserialized URLs (which are stored in a Javascript object on the ``window`` object) and to include a\nJavascript URL resolver function in your HTML using the Django's\n`static \u003chttps://docs.djangoproject.com/en/dev/ref/templates/builtins/#static\u003e`_ template tag.\nActually, a standard use of the ``{% js_routes %}`` statement is equivalent to:\n\n.. code-block:: html\n\n    {% js_routes routes_only=True %}\n    \u003cscript src=\"{% static 'js/routes/resolver.js' %}\"\u003e\u003c/script\u003e\n\nThe ``routes_only`` option allows to only include the serialized URLs in the output of\n``{% js_routes %}``. It gives you the ability to include the Javascript URL resolver that comes with\nDjango-js-routes using another ``static`` statement. This also allows you to cache the output of the\n``{% js_routes routes_only=True %}`` statement if you want (so that serialized URLs are not\ngenerated for every request).\n\nDumping the Javascript routes resolver\n--------------------------------------\n\nAs explained earlier, the ``{% js_routes %}`` template tag triggers the generation of the serialized\nURLs and includes a client-side URL resolver in the final HTML. One downside of this behaviour is\nthat the serialized URLs need to be generated every time your HTML template is rendered.\n\nInstead it is possible to just dump the whole list of serialized URLs AND the URL resolver function\ninto a single Javascript module file. This can be achieved using the ``dump_routes_resolver``\ncommand, which can be used as follows:\n\n.. code-block:: shell\n\n    $ python manage.py dump_routes_resolver --format=default --output=my_exported_resolver.js\n\nThe ``--output`` option allows to specify to which file the serialized routes and resolver function\nshould be saved while the ``--format`` option allows to specify the Javascript format to use.\n\n``--format`` accepts the following values:\n\n* ``default`` includes the routes as an object that is associated to the ``window`` object while the\n  URL resolver is available through the ``window.reverseUrl`` function (this corresponds to the\n  behaviour provided by a standard use of the ``{% js_routes %}`` template tag)\n* ``es6`` allows to save the routes and the URL resolver as an ES6 module where the ``reverseUrl``\n  function is the default export\n\nLicense\n=======\n\nMIT. See ``LICENSE`` for more details.\n\n.. _pip: https://github.com/pypa/pip\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellmetha%2Fdjango-js-routes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fellmetha%2Fdjango-js-routes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellmetha%2Fdjango-js-routes/lists"}