{"id":22485448,"url":"https://github.com/fluree/fluree-nodejs-server","last_synced_at":"2026-01-28T14:12:50.292Z","repository":{"id":42919510,"uuid":"238701339","full_name":"fluree/fluree-nodejs-server","owner":"fluree","description":"Bare-bones node.js application using the Fluree node.js library to access a downloaded Fluree instance","archived":false,"fork":false,"pushed_at":"2023-03-04T06:32:27.000Z","size":5460,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":13,"default_branch":"main","last_synced_at":"2023-03-05T20:53:06.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/fluree.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":"2020-02-06T13:58:35.000Z","updated_at":"2023-03-05T20:53:06.994Z","dependencies_parsed_at":"2023-01-27T14:01:35.031Z","dependency_job_id":null,"html_url":"https://github.com/fluree/fluree-nodejs-server","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluree%2Ffluree-nodejs-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluree%2Ffluree-nodejs-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluree%2Ffluree-nodejs-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluree%2Ffluree-nodejs-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluree","download_url":"https://codeload.github.com/fluree/fluree-nodejs-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228499954,"owners_count":17929989,"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-12-06T17:12:37.289Z","updated_at":"2026-01-28T14:12:49.156Z","avatar_url":"https://github.com/fluree.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Fluree NodeJS Example\n\nThis mini-application uses the [Fluree NodeJS library](https://docs.flur.ee/library/nodejs/overview) to stand-up a Fluree query peer along-side a *downloaded* Fluree instance.  \n\n## Get Started\n\n### 1. Start Fluree\n\nDownload and unzip the latest version of [Fluree](https://fluree-releases-public.s3.amazonaws.com/fluree-latest.zip#).\n\nNavigate to the folder where unzipped Fluree, and run `./fluree_start.sh`. If you have Java 8+ installed, this should launch Fluree.  The Admin UI for the instance is available at `http://localhost:8080`. \n\n\u0026nbsp;\n\n### 2. Start Fluree NodeJS Query Peer\n\nIf not already installed, [download NodeJS](https://nodejs.org/en/download/) for your environment.  \n\nExecute the following commands to download and run the project:\n\n```all\ngit clone https://github.com/fluree/fluree-nodejs-server.git\n```\n\n```all\ncd fluree-nodejs-server\nnpm install\nnpm start\n```\n\nThe Fluree NodeJS Query Peer should immediately start-up and connect to the local Fluree instance.  The Fluree NodeJS Server application is accessible at http://localhost:3000/. \n\n```all\nFluree NodeJs Library v0.13.0 BETA\nExpress server currently running on port 3000\n```\n\n\u0026nbsp;\n\n### 3. Try out a few commands\n\nThe following endpoints are wired-up in this Fluree NodeJS Server application.  You can validate the commands using [Postman](https://www.postman.com/) or curl.  \n\nAction | Command | Explanation \n-- | -- | --\nNew Ledger | `new_ledger` | Submits a request to creates a new ledger to the *downloaded* Fluree instance.\nDelete Ledger | `delete_ledger` | Deletes a ledger. The request is submitted to the *downloaded* Fluree instance.\nQuery | `query` | Query in FlureeQL syntax.\nBlock | `block_query` | Block queries in FlureeQL syntax.\nHistory |  `history_query`| History queries in FlureeQL syntax.\nMulti-Query | `multi_query` | Multi-Queries in FlureeQL syntax.\nGraphQL | `graphql` | Queries or transactions in GraphQL syntax, as a string.\nSPARQL | `sparql` | Queries in SPARQL syntax, as a string.\nTransact | `transact` | Submits a transaction for a ledger to the *downloaded* Fluree instance.\n---\n\n\u0026nbsp;\n\n#### `new_ledger`\nCreates a new ledger from the specified \"network/id\".  The request is submitted to the *downloaded* Fluree instance.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/new_ledger\nHeader: 'Content-Type: application/json'\nBody: None\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/new_ledger' \\\n--header 'Content-Type: application/json'\n```\n---\n#### `delete_ledger`\nDeletes a ledger identified by the \"network/id\".  The request is submitted to the *downloaded* Fluree instance.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/delete_ledger\nHeader: 'Content-Type: application/json'\nBody: None\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/delete_ledger' \\\n--header 'Content-Type: application/json'\n```\n---\n#### `query`\nExecutes a query against the specified ledger.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/query\nHeader: 'Content-Type: application/json'\nBody: {\"query\": {\"select\":[\"*\"],\"from\":\"_collection\"}}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/query' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\": {\"select\":[\"*\"],\"from\":\"_collection\"}}'\n```\n---\n#### `block_query`\nExecutes a block query in FlureeQL syntax against the specified ledger.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/block_query\nHeader: 'Content-Type: application/json'\nBody: {\"query\": { \"block\": [2,2], \"pretty-print\": true}}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/block_query' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\": { \"block\": [2,2], \"pretty-print\": true}}\n'\n```\n---\n#### `history_query`\nExecutes a history query in FlureeQL syntax against the specified ledger.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/history_query\nHeader: 'Content-Type: application/json'\nBody: {\"query\": { \"history\": [\"_collection/name\", \"_predicate\"]}}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/history' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\": { \"history\": [\"_collection/name\", \"_predicate\"]}}\n'\n```\n---\n#### `multi_query`\nExecutes a history query in FlureeQL syntax against the specified ledger.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/multi_query\nHeader: 'Content-Type: application/json'\nBody: {\"query\": { \"collections\": { \"select\": [\"*\"], \"from\": \"_collection\"},\n            \"users\": { \"select\": [\"*\"], \"from\": \"_user\"}}}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/multi_query' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\": { \"collections\": { \"select\": [\"*\"], \"from\": \"_collection\"},\n            \"users\": { \"select\": [\"*\"], \"from\": \"_user\"}}}'\n```\n---\n#### `graphql`\nExecutes queries or transactions in GraphQL syntax, as a string.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/graphql\nHeader: 'Content-Type: application/json'\nBody: {\"graphql\": { \"query\": \"{graph {_collection {_id name }}}\",\n  \"variables\": null,\n  \"operationName\": null\n}}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/graphql' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"graphql\": { \"query\": \"{graph {_collection {_id name }}}\",\n  \"variables\": null,\n  \"operationName\": null\n}}'\n```\n---\n#### `sparql`\nExecutes queries in SPARQL syntax, as a string.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/sparql\nHeader: 'Content-Type: application/json'\nBody: {\"query\": \"SELECT ?collection WHERE {  ?collectionID fdb:_collection/name ?collection. }\"}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/chat/sparql' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\"query\": \"SELECT ?collection WHERE {  ?collectionID fdb:_collection/name ?collection. }\"}\n'\n```\n---\n#### `transact`\nSubmits a transaction for a ledger to the *downloaded* Fluree instance.\n\n```all\nAction: POST\nEndpoint: http://localhost:3000/api/db/test/chat/sparql\nHeader: 'Content-Type: application/json'\nBody: { \"txn\": [ {  \"_id\": \"_collection\",  \"name\": \"eateries\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/zip\",  \"doc\": \"jurisdiction or mail code\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/notes\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/avgrating\",  \"doc\": \"Average rating from reporting clientele\",  \"type\": \"int\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/age\",  \"doc\": \"Age of the establishment, not the owners\",  \"type\": \"int\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/country\",  \"doc\": \"Country, if Earth; planet otherwise\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/state\",  \"doc\": \"State or government jurisdiction area\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/city\",  \"doc\": \"City in which establishment exists\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/address-line-2\",  \"doc\": \"Ancillary information, such as suite or PO Box\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/address-line-1\",  \"doc\": \"Street address of establishment\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/name\",  \"doc\": \"Name of the establishment\",  \"type\": \"string\",  \"unique\": true,  \"index\": true }], \"opts\": { \"timeout\": 10000 }}\n\ncurl --location --request POST 'http://localhost:3000/api/db/test/directory/transact' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \"txn\": [ {  \"_id\": \"_collection\",  \"name\": \"eateries\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/zip\",  \"doc\": \"jurisdiction or mail code\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/notes\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/avgrating\",  \"doc\": \"Average rating from reporting clientele\",  \"type\": \"int\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/age\",  \"doc\": \"Age of the establishment, not the owners\",  \"type\": \"int\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/country\",  \"doc\": \"Country, if Earth; planet otherwise\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/state\",  \"doc\": \"State or government jurisdiction area\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/city\",  \"doc\": \"City in which establishment exists\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/address-line-2\",  \"doc\": \"Ancillary information, such as suite or PO Box\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/address-line-1\",  \"doc\": \"Street address of establishment\",  \"type\": \"string\" }, {  \"_id\": \"_predicate\",  \"name\": \"eateries/name\",  \"doc\": \"Name of the establishment\",  \"type\": \"string\",  \"unique\": true,  \"index\": true }], \"opts\": { \"timeout\": 10000 }}'\n```\n\n\n\n\u0026nbsp;\n## License\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluree%2Ffluree-nodejs-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluree%2Ffluree-nodejs-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluree%2Ffluree-nodejs-server/lists"}