{"id":20141255,"url":"https://github.com/alekcz/fire","last_synced_at":"2025-06-23T21:39:46.662Z","repository":{"id":44604151,"uuid":"256700559","full_name":"alekcz/fire","owner":"alekcz","description":"A lightweight clojure client for Firebase based on the REST API. Basically Charmander 2.0","archived":false,"fork":false,"pushed_at":"2024-05-18T19:09:50.000Z","size":398,"stargazers_count":28,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-28T12:41:35.382Z","etag":null,"topics":["client","clojure","firebase","rest"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alekcz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-04-18T08:07:11.000Z","updated_at":"2024-05-30T00:43:32.421Z","dependencies_parsed_at":"2024-05-30T00:43:29.452Z","dependency_job_id":"6faf8330-6474-471b-8060-ab6a92a01649","html_url":"https://github.com/alekcz/fire","commit_stats":{"total_commits":139,"total_committers":2,"mean_commits":69.5,"dds":0.007194244604316502,"last_synced_commit":"b172a16eb9fb8ac14024c90f024cdf68f0591de2"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Ffire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Ffire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Ffire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alekcz%2Ffire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alekcz","download_url":"https://codeload.github.com/alekcz/fire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247428385,"owners_count":20937466,"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":["client","clojure","firebase","rest"],"created_at":"2024-11-13T21:56:51.568Z","updated_at":"2025-04-09T18:41:01.519Z","avatar_url":"https://github.com/alekcz.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fire\n\nA lightweight clojure client for Firebase based on the REST API. Basically [Charmander](https://github.com/alekcz/charmander) 2.0  \n\n# Status\n\n![master](https://github.com/alekcz/fire/workflows/master/badge.svg) [![codecov](https://codecov.io/gh/alekcz/fire/branch/master/graph/badge.svg?token=ahELyNhNVg)](https://codecov.io/gh/alekcz/fire) [![Dependencies Status](https://versions.deps.co/alekcz/fire/status.svg)](https://versions.deps.co/alekcz/fire) [![Clojars Project](https://img.shields.io/clojars/v/alekcz/fire.svg)](https://clojars.org/alekcz/fire)      \n\n## Prerequisites\n\nFor fire you will need to create a Realtime Database on Firebase and retrieve the service account credentials.\n\n1. Get the json file containing your service account creditials by following the instruction here https://cloud.google.com/docs/authentication/getting-started\n2. Copy the contents of your .json into the `GOOGLE_APPLICATION_CREDENTIALS` environment variable. In your `~/.bash_profile` and in Travis CI you should escape your credentials using singe quotes (').\n\n## Usage\n\n`[alekcz/fire \"0.5.0\"]`\n\n### Interacting with Realtime Database\n\nCreating your auth token\n\n```clojure\n(require  '[fire.core :as fire]\n          '[fire.auth :as auth])\n(def auth (auth/create-token \"GOOGLE_APPLICATION_CREDENTIALS\"))\n```\n\nWrite to the specified location (will overwrite any existing data):\n\n```clojure\n    (fire/write! \"protected-db-name\" \"/path\" {:map \"with data\"} auth)\n    (fire/write! \"public-db-name\" \"/path\" {:map \"with data\"} nil)\n    ; =\u003e {:map \"with data\"}\n```\n\nRead data from the specified location:\n\n```clojure\n    (fire/read \"protected-db-name\" \"/path\" auth)\n    (fire/read \"public-db-name\" \"/path\" nil)\n    ; =\u003e {:map \"with data\"}\n```\n \n Update data at the specified location (only updates the specified fields):\n \n```clojure\n     (fire/update! \"protected-db-name\" \"/path\" {:more \"data\"} auth)\n     (fire/update! \"public-db-name\" \"/path\" {:more \"data\"} nil)\n     ; =\u003e {:map \"with data\" :more \"data\"}\n```\n \nAdd data at the specified location with an automatically generated key:\n\n```clojure\n     (fire/push! \"protected-db-name\" \"/path\" {:map \"with data\"} auth)\n     (fire/push! \"public-db-name\" \"/path\" {:map \"with data\"} nil)\n     ; =\u003e {\"name\" \"-IoZ3DZlTTQIkR0c7iVK\"}\n```\n      \nDelete at the specified locations:\n\n```clojure\n    (fire/delete! \"protected-db-name\" \"/path\" auth)\n    (fire/delete! \"public-db-name\" \"/path\" nil)\n    ; =\u003e nil\n```\n\nQuery data at the specified locations:\nNote that if the child key is not indexed firebase will respond with error 400. Also `:orderBy` is required for all queries. \nSee the Firebase [query docs](https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-filtering) for more info.\n```clojure\n    (fire/read \"protected-db-name\" \"/path\" auth {:query {:orderBy \"child-key\" :startAt 10 :endAt 50}})\n    (fire/read \"protected-db-name\" \"/path\" auth {:query {:orderBy \"child-key\" :equalTo 10}})\n    (fire/read \"public-db-name\" \"/path\" nil {:query {:orderBy \"child-key\" :limitToFirst 10}})\n    (fire/read \"public-db-name\" \"/path\" nil {:query {:orderBy \"child-key\" :limitToLast 3}})\n    \n    ; =\u003e nil\n```\n\n### Interacting with Firebase Storage\n\nCreating your auth token\n\n```clojure\n(require  '[fire.storage :as storage]\n          '[fire.auth :as auth])\n(def auth (auth/create-token \"GOOGLE_APPLICATION_CREDENTIALS\"))\n```\n\nUpload data or a file to Firebase Storage\n\n```clojure\n(spit \"path/on/firebase.txt\" \"this is fire\")\n(storage/upload! \"path/on/firebase.txt\" \"path/on/disk/storage.txt\" \"text/plain\" auth)\n(storage/upload! \"path/on/firebase.txt\" non-string-data-in-memory  \"text/plain\" auth)\n```\n \nDownload data to memory or a file from Firebase Storage\n \n```clojure\n(store/download \"path/on/firebase.txt\" auth) ;=\u003e \"this is fire\"\n(store/download-to-file \"path/on/firebase.txt\" \"downloads/storage.txt\" auth)\n(slurp \"downloads/storage.txt\") ;=\u003e \"this is fire\"\n\n```\n \nAdd data at the specified location with an automatically generated key:\n\n```clojure\n(store/delete! \"path/on/firebase.txt\" auth) \n```\n\n\n## Thanks \nSpecial thanks to: \n- [@sgrove](https://github.com/sgrove)\n\n## License\n\nCopyright © 2020 Alexander Oloo\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekcz%2Ffire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falekcz%2Ffire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falekcz%2Ffire/lists"}