{"id":30892340,"url":"https://github.com/funcool/bide","last_synced_at":"2025-09-08T19:44:08.310Z","repository":{"id":52290895,"uuid":"66701793","full_name":"funcool/bide","owner":"funcool","description":"A simple routing library for ClojureScript","archived":false,"fork":false,"pushed_at":"2021-05-02T19:23:41.000Z","size":127,"stargazers_count":132,"open_issues_count":5,"forks_count":20,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-03T22:41:35.461Z","etag":null,"topics":["clojurescript","html5","html5-history","routing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funcool.png","metadata":{"files":{"readme":"README.adoc","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-27T07:22:37.000Z","updated_at":"2025-04-01T21:58:09.000Z","dependencies_parsed_at":"2022-09-07T05:12:36.251Z","dependency_job_id":null,"html_url":"https://github.com/funcool/bide","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/funcool/bide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funcool%2Fbide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funcool%2Fbide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funcool%2Fbide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funcool%2Fbide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funcool","download_url":"https://codeload.github.com/funcool/bide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funcool%2Fbide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231432,"owners_count":25245585,"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-09-08T02:00:09.813Z","response_time":121,"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":["clojurescript","html5","html5-history","routing"],"created_at":"2025-09-08T19:43:58.750Z","updated_at":"2025-09-08T19:44:08.285Z","avatar_url":"https://github.com/funcool.png","language":"JavaScript","readme":"= bide\n:sectlinks:\n\nimage:http://clojars.org/funcool/bide/latest-version.svg[\"Clojars Project\", link=\"http://clojars.org/funcool/bide\"]\n\n\n== Introduction\n\nA simple routing library for ClojureScript that uses Express-like syntax.\n\n[quote, A Basque proverb.]\n____\nEgiak ez ditu bi bide\n____\n\nNOTE: **Looking for a maintainer.**\n\n\n== Install\n\nAdd the following dependency to your `project.clj` file:\n\n[source,clojure]\n----\n[funcool/bide \"1.7.0\"]\n----\n\n\n== User Guide\n\nJust import the core namespace and start building the router:\n\n[source, clojure]\n----\n(ns myapp.core\n  (:require [bide.core :as r]))\n\n(def router\n  (r/router [[\"/api/auth\" :myapp/auth]\n             [\"/api/users/:id\" :myapp/user-by-id]]))\n----\n\n\nNow, you can perform basic operations such as `match` and `resolve`:\n\n[source, clojure]\n----\n(r/match router \"/api/auth\")\n;; =\u003e [:myapp/auth nil nil]\n\n(r/match router \"/api/users/1\")\n;; =\u003e [:myapp/user-by-id {:id \"1\"} nil]\n\n(r/match router \"/api/users/1?foobar=1\")\n;; =\u003e [:myapp/user-by-id {:id \"1\"} {:foobar \"1\"}]\n\n(r/match router \"/api/other\")\n;; =\u003e nil\n\n(r/resolve router :myapp/auth)\n;; =\u003e \"/api/auth\"\n\n(r/resolve router :myapp/user-by-id {:id 2})\n;; =\u003e \"/api/users/2\"\n\n(r/resolve router :myapp/user-by-id {:id 2} {:foobar 1})\n;; =\u003e \"/api/users/2?foobar=1\"\n----\n\nIn addition, you can integrate it in your ClojureScript web application using\nthe provided builtin helpers. It uses `goog.History` API under the hood:\n\n[source, clojure]\n----\n(defn on-navigate\n  \"A function which will be called on each route change.\"\n  [name params query]\n  (println \"Route change to: \" name params query))\n\n(r/start! router {:default :myapp/auth\n                  :on-navigate on-navigate})\n----\n\nAlso, you can pass factory function that returns instance of\n`goog.history.Html5History` as value of `:html5history` key of second argument\nand `bide` would use it to manage history events, and/or pass `true` as value of\n`:html5?` key to stop using '#' in URLs.\n\nNote that when `:html5?` is `true`, the built-in instance of `Html5History` uses\na custom `goog.history.Html5History.TokenTransformer` to allow it to handle\nquery parameters. You can construct a transformer with `token-transformer`.\n\nFinally, you can force the navigation trigger by using the `navigate!` helper\nfunction:\n\n[source, clojure]\n----\n(r/navigate! router :myapp/user-by-id {:id 10})\n----\n\nOr if you don't want to add entry into history use `replace!` helper function\ninstead.\n\n\n== How to Contribute?\n\nJust open an issue or PR ;)\n\n\n== FAQ\n\n=== Why another routing library?\n\nExisting solutions out there are complex and generally bloated wih irrelevant\ndocumentation.\n\nMost libraries work with native Clojure data structures for representing the\nrouting configuration. It's a great idea, but it does not work very well once\nyour project scales. Things get out of hand pretty fast.\n\nAn example of this with link:https://github.com/juxt/bidi[bidi] routing library:\n\n[source, clojure]\n----\n(def routes\n  [\"/\" [[\"auth/login\" :auth/login]\n        [[\"auth/recovery/token/\" :token] :auth/recovery]\n        [\"workspace/\" [[[:project-uuid \"/\" :page-uuid] :workspace/page]]]]])\n----\n\nThe mental effort required to read and understand the configuration defined like this\nis considerable. Now, let's see an example using *bide*:\n\n[source, clojure]\n----\n(def routes\n  [[\"/auth/login\" :auth/login]\n   [\"/auth/recovery/token/:token\" :auth/recovery]\n   [\"/workspace/:project-uuid/:page-uuid\" :workspace/page]])\n----\n\nAs you can imagine, a simple library like *bide* does not offer all the features\nprovided by other solutions. New features will be added on-demand. However, we plan\nto stay as *small and simple* as possible.\n\n\n== How fast is *bide*?\n\nBefore talking about real performance comparisons and benchmarks, you\nshould know that *bide* design is very simple and maybe can be considered\nnaive. The worst case for the matching algorithm is *O(N)* and *O(1)*\nfor resolve operation.\n\nConsidering that having thousands of entries is very unlikely to happen,\nthe match algorithm works pretty well. This is a comparison against the\nsame operations with link:https://github.com/juxt/bidi[bidi]:\n\n[source, text]\n----\n$ node out/benchmarks.js\nop=resolve lib=bidi ops=10000\n\"Elapsed time: 90.989215 msecs\"\nop=resolve lib=bide ops=10000\n\"Elapsed time: 19.447844 msecs\"\nop=match lib=bidi ops=10000\n\"Elapsed time: 1070.330668 msecs\"\nop=match lib=bide ops=10000\n\"Elapsed time: 98.864120 msecs\"\n----\n\nI've been a _bidi_ user for quite some time, that's why I choose this library to\nrun the benchmarks.\n\n== License\n\n_bide_ is licensed under BSD (2-Clause) license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuncool%2Fbide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuncool%2Fbide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuncool%2Fbide/lists"}