{"id":29016504,"url":"https://github.com/memgraph/nodemgclient","last_synced_at":"2025-06-25T22:30:30.727Z","repository":{"id":42626574,"uuid":"258789113","full_name":"memgraph/nodemgclient","owner":"memgraph","description":"Node.js Memgraph Client","archived":false,"fork":false,"pushed_at":"2023-07-19T03:45:24.000Z","size":556,"stargazers_count":21,"open_issues_count":3,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-22T07:49:50.570Z","etag":null,"topics":["client","memgraph","node-addon-api","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@memgraph/client","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/memgraph.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-04-25T13:59:19.000Z","updated_at":"2024-10-15T16:05:50.000Z","dependencies_parsed_at":"2023-02-06T21:32:14.301Z","dependency_job_id":null,"html_url":"https://github.com/memgraph/nodemgclient","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/memgraph/nodemgclient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memgraph%2Fnodemgclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memgraph%2Fnodemgclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memgraph%2Fnodemgclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memgraph%2Fnodemgclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/memgraph","download_url":"https://codeload.github.com/memgraph/nodemgclient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/memgraph%2Fnodemgclient/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261962050,"owners_count":23236859,"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","memgraph","node-addon-api","nodejs"],"created_at":"2025-06-25T22:30:29.814Z","updated_at":"2025-06-25T22:30:30.694Z","avatar_url":"https://github.com/memgraph.png","language":"C++","readme":"[![Actions Status](https://github.com/memgraph/nodemgclient/workflows/CI/badge.svg)](https://github.com/memgraph/nodemgclient/actions)\n[![status: experimental](https://github.com/GIScience/badges/raw/master/status/experimental.svg)](https://www.npmjs.com/package/@memgraph/client)\n\n# nodemgclient - Node.js Memgraph Client\n\n`nodemgclient` a Node.js binding for\n[mgclient](https://github.com/memgraph/mgclient) used to interact with\n[Memgraph](https://memgraph.com).\n\n## Installation\n\nAs usual the package could be downloaded from npm by executing:\n```\nnpm install @memgraph/client\n```\nAt the moment only Linux shared library is shipped inside the package. For any\nother operating system or incompatible library version, please proceed with\nbuilding from source as explained below.\n\nOnce the package is properly installed, you can run a simple example:\n```\nconst memgraph = require('@memgraph/client');\n\n(async () =\u003e {\n  try {\n    const connection = await memgraph.Connect({\n      host: 'localhost',\n      port: 7687,\n    });\n    await connection.ExecuteAndFetchAll(\"CREATE (:Graphs)-[:ARE]-\u003e(:Powerful);\");\n    console.log(await connection.ExecuteAndFetchAll(\n      \"MATCH (n)-[r]-\u003e(m) RETURN n, r, m;\"));\n  } catch (e) {\n    console.log(e);\n  }\n})();\n```\n\n## Build from Source\n\nBelow you can find instruction for Linux, MacOS and Windows. You'll know if the\npackage was successfully build when there will be a file called\n`nodemgclient/Release/nodemgclient.node`, that's a shared library required to\nuse the client.\nOnce the library is in place you can pull it in your project just by running:\n```\nnpm install \u003cpath-to-the-repo\u003e\n```\n\n### Build from Source on Linux\n\nTo install `nodemgclient` from source you will need:\n\n* OpenSSL \u003e= 1.0.2\n* A CMake \u003e= 3.10\n* A Clang compiler supporting C11 and C++17 standard\n* Node.js \u003e= 12\n\nFirst install the prerequisites:\n\n* On Debian/Ubuntu:\n\n```bash\nsudo apt install -y npm nodejs cmake make gcc g++ clang libssl-dev\n```\n\n* On RedHat/CentOS:\n\n```bash\nsudo yum install -y npm nodejs cmake3 make gcc gcc-c++ clang openssl-devel\n```\n\nOnce prerequisites are in place, you can build `nodemgclient` by running:\n\n```bash\nnpm ci\nnpm run build:release\n```\n\nTo test ([Docker](https://docs.docker.com/engine/install) is required) run:\n\n```bash\nnpm run test\n```\n\n### Build from Source on Windows\n\n#### Build on Windows using Visual Studio\n\nSince `cmake-js` is used, compiling for Windows is very similar to compiling\nfor Linux:\n```bash\nnpm ci\nnpm run build:release\n```\n\nIf installing OpenSSL package from\nhttps://slproweb.com/products/Win32OpenSSL.html, make sure to use the full one\nbecause of the header files.\n\nNOTE: Compilation does NOT work yet under MinGW.\n\n### Build from Source on MacOS\n\nTo build on MacOS it's required to install the `openssl` package, e.g.:\n```\nbrew install openssl\n```\nOnce the package is in place, please set the `OPENSSL_ROOT_DIR` environment variable:\n```\nexport OPENSSL_ROOT_DIR=\"$(brew --prefix openssl)\"\n```\nOnce OpenSSL is in place, please run:\n```\nnpm ci\nnpm run build:release\n```\n\nNOTE: For more adventurous folks, since `cmake-js` is used, it's also possible to set\nthe OpenSSL path via the following commend:\n```\nnpx cmake-js compile --CDOPENSSL_ROOT_DIR=\"$(brew --prefix openssl)\"\n```\n\n## Implementation and Interface Notes\n\n### Temporal Types\n\nSuitable JS type to store Memgrpah temporal types don't exist. In particular,\nit's impossible to convert `mg_duration` and `mg_local_time` to the `Date`\ntype. Since [the temporal\nspecification](https://github.com/tc39/proposal-temporal) is not yet widely\nsupported, the decision was to expose plain JS objects (dict) with the exact\nfields `mgclient` is providing (for more details, please take a look under\n`mgclient`\n[header](https://github.com/memgraph/mgclient/blob/master/include/mgclient.h)\nand [source](https://github.com/memgraph/mgclient/blob/master/src/mgclient.c)\nfiles). In addition, when possible (`mg_date` and `mg_local_date_time`), are\nconverted into objects which have `date` property,\nwhich in fact, is the JS `Date` representation of these types. Keep in mind the\nloss of precision because JS `Date` time fields can only store up to\nmilliseconds precision. However, Memgraph supports microsecond precision for\nthe local time and therefore any use of the `date` property (JS `Date` object)\ncan potentially cause loss of information.\n\nModule exposes `create` functions, e.g. `createMgDate`, which simplify creation\nof temporal object interpretable by Memgraph. For more details take a look\nunder the API docs under [index.js](./index.js) file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemgraph%2Fnodemgclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmemgraph%2Fnodemgclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmemgraph%2Fnodemgclient/lists"}