{"id":29894195,"url":"https://github.com/juxt/modular.co-dependency","last_synced_at":"2025-08-01T04:45:46.571Z","repository":{"id":28993186,"uuid":"32519978","full_name":"juxt/modular.co-dependency","owner":"juxt","description":"Co-dependency support for com.stuartsierra.component","archived":false,"fork":false,"pushed_at":"2015-12-18T10:48:08.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-29T14:45:00.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juxt.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}},"created_at":"2015-03-19T12:29:10.000Z","updated_at":"2020-04-13T12:11:06.000Z","dependencies_parsed_at":"2022-08-02T17:15:49.429Z","dependency_job_id":null,"html_url":"https://github.com/juxt/modular.co-dependency","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/juxt/modular.co-dependency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fmodular.co-dependency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fmodular.co-dependency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fmodular.co-dependency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fmodular.co-dependency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juxt","download_url":"https://codeload.github.com/juxt/modular.co-dependency/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fmodular.co-dependency/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268171719,"owners_count":24207417,"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-08-01T02:00:08.611Z","response_time":67,"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":[],"created_at":"2025-08-01T04:45:37.702Z","updated_at":"2025-08-01T04:45:46.548Z","avatar_url":"https://github.com/juxt.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# juxt.modular/co-dependency\n\n## Releases and Dependency Information\n\n```clojure\n[juxt.modular/co-dependency \"0.2.0\"]\n```\n\n## Usage\n\n#### Add co-dependency to your project dependencies\n\n```clojure\n\n(defproject your-project \"your-version\"\n   ...\n   :dependencies [[juxt.modular/co-dependency \"0.2.0\"]]\n   ...\n   )\n\n```\n\n\n#### Add component and co-dependency to your ns:\n\n```clojure\n\n(ns your-app-ns\n  (:require [com.stuartsierra.component :refer (using)]\n            [modular.component.co-dependency :refer (co-using)]))\n\n\n```\n\n#### Define your system\n\n[Same as you do](https://github.com/stuartsierra/component/blob/master/test/com/stuartsierra/component_test.clj#L114-L121) with stuartsierra/component lib but adding co-dependencies with co-dependency/co-using fn\n**In this case :b depends on :a and :a co-depends on :b**\n\n```clojure\n(defn system-1 []\n  (map-\u003eSystem1 {:a (-\u003e (component-a)\n                        (co-using [:b]))\n                 :b (-\u003e (component-b)\n                        (using [:a]))\n                 :c (-\u003e (component-c)\n                        (using [:a :b]))\n                 :d (-\u003e (component-d)\n                        (using {:b :b :c :c}))\n                 :e (component-e)})\n\n```\n\n#### Start your system\n```clojure\n(def system-started-with-co-deps (co-dependency/start-system (system-1)))\n```\n\n#### Retrieving co-dependencies values\n```clojure\n(def a (-\u003e system-started-with-co-deps :a))\n(def a-from-b (:a @(-\u003e system-started-with-co-deps :a :b)))\n;; checking identity equality\n(assert (= a a-from-b))\n```\n\n#### Using stuartsierra reloaded workflow\n\nIf you use stuartsierra [\"reloaded\" workflow](http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded) then update original stuartsierra dev/start function by:\n```clojure\n(defn start\n  \"Starts the current development system.\"\n  []\n  (alter-var-root #'system co-dependency/start-system))\n```\n\n#### Do you need more help?\nFollow the test provided to learn how to use it :)\n\n\n## Drawbacks\nIn contrast with normal dependencies that you get using clojure map functions\n\n```clojure\n(:dependency-key component)\n;;=\u003e dependency\n```\n\nwhen you want to retrieve a co-dependency you need to deref the co-dependency value\n\n```clojure\n@(:co-dependency-key component)\n;;=\u003e co-dependency\n```\n\n### Co-dependencies are NOT bound during a component's start phase.\n\nCo-dependencies are bound _after_ a component's start phase. Therefore,\na component's co-dependencies will not be accessible, even via a\ndereference of the co-dependency, during a component's start.\n\nRe-read that last paragraph until you understand that you _cannot_ make\nuse of a co-dependency's data until after the `start` phase of a given\ncomponent. You _can_ make use of a co-dependency's data _after_ the\ncomponent has been fully started, which usually means in a function\n(such as a Ring handler).\n\nThe penalty for not understanding this point is days spent figuring out\nwhy you can't see a co-dependency's data. It's because you're still\ntrying to access this data within the `start` phase of your\ncomponent. Don't do this. Defer the lookup until after the entire start\nphase of your system has completed.\n\n## License\n\nCopyright © 2014 Juan Antonio Ruz (juxt.pro)\n\nDistributed under the Eclipse Public License, the same as Clojure\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Fmodular.co-dependency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuxt%2Fmodular.co-dependency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Fmodular.co-dependency/lists"}