{"id":31871588,"url":"https://github.com/themetalfleece/neogma","last_synced_at":"2025-10-12T20:27:32.539Z","repository":{"id":40588054,"uuid":"197253614","full_name":"themetalfleece/neogma","owner":"themetalfleece","description":"Object-Graph-Mapping neo4j framework, Fully-typed with TypeScript, for easy and flexible node and relationship operations","archived":false,"fork":false,"pushed_at":"2025-10-12T16:14:48.000Z","size":1493,"stargazers_count":146,"open_issues_count":15,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-12T20:27:31.276Z","etag":null,"topics":["cypher","neo4j","neo4j-driver","neo4j-ogm","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://themetalfleece.github.io/neogma/","language":"TypeScript","has_issues":true,"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/themetalfleece.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-16T19:14:59.000Z","updated_at":"2025-10-12T16:12:46.000Z","dependencies_parsed_at":"2023-12-09T22:23:49.270Z","dependency_job_id":"348c5efd-caad-45f7-994b-c786555e7cce","html_url":"https://github.com/themetalfleece/neogma","commit_stats":{"total_commits":337,"total_committers":8,"mean_commits":42.125,"dds":0.0801186943620178,"last_synced_commit":"1a9c4282633af95bf21853b36d0f52fa46609973"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/themetalfleece/neogma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themetalfleece%2Fneogma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themetalfleece%2Fneogma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themetalfleece%2Fneogma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themetalfleece%2Fneogma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themetalfleece","download_url":"https://codeload.github.com/themetalfleece/neogma/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themetalfleece%2Fneogma/sbom","scorecard":{"id":879242,"data":{"date":"2025-08-11","repo":{"name":"github.com/themetalfleece/neogma","commit":"d6f528b3d83639040e0369eda847f458fa06a0e2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 5/28 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run-tests.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/run-tests.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/run-tests.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/themetalfleece/neogma/run-tests.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:48","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   1 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/run-tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-3wc5-fcw2-2329","Warn: Project is vulnerable to: GHSA-64fm-8hw2-v72w","Warn: Project is vulnerable to: GHSA-f98w-7cxr-ff2h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T07:24:25.174Z","repository_id":40588054,"created_at":"2025-08-24T07:24:25.174Z","updated_at":"2025-08-24T07:24:25.174Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012809,"owners_count":26085187,"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-10-12T02:00:06.719Z","response_time":53,"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":["cypher","neo4j","neo4j-driver","neo4j-ogm","nodejs","typescript"],"created_at":"2025-10-12T20:27:27.558Z","updated_at":"2025-10-12T20:27:32.534Z","avatar_url":"https://github.com/themetalfleece.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![neogma logo](https://themetalfleece.github.io/neogma/assets/logo-text-horizontal.svg)\n\n\u003ch3 align=\"center\"\u003eA powerful Neo4j OGM for Node.js \u0026 TypeScript\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  Build graph applications with ease using type-safe models, flexible query builders, and automatic relationship management\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/neogma\"\u003e\u003cimg src=\"https://badgen.net/npm/v/neogma\" alt=\"npm version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/neogma\"\u003e\u003cimg src=\"https://badgen.net/npm/dm/neogma\" alt=\"npm downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.typescriptlang.org/\"\u003e\u003cimg src=\"https://badgen.net/npm/types/tslib\" alt=\"TypeScript\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/themetalfleece/neogma/blob/master/LICENSE\"\u003e\u003cimg src=\"https://badgen.net/github/license/themetalfleece/neogma\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/themetalfleece/neogma/actions/workflows/run-tests.yml\"\u003e\u003cimg src=\"https://github.com/themetalfleece/neogma/actions/workflows/run-tests.yml/badge.svg?branch=master\" alt=\"Tests\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Why Neogma?\n\n- 🔷 **Fully Type-Safe** - Built-in TypeScript support with complete type inference\n- ⚡ **Flexible** - Use Models, Query Builders, or raw Cypher queries\n- 🔗 **Automatic Relationships** - Create and manage complex graph structures effortlessly  \n- ✅ **Validation** - Built-in schema validation for your data models\n- 🚀 **Production Ready** - Battle-tested with comprehensive test coverage\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm i neogma\n# or\nyarn add neogma\n# or\npnpm i neogma\n```\n\n### Basic Example\n\n```js\nconst { Neogma, ModelFactory } = require('neogma');\n\n// Connect to Neo4j\nconst neogma = new Neogma({\n  url: 'bolt://localhost:7687',\n  username: 'neo4j',\n  password: 'password',\n});\n\n// Define a model\nconst User = ModelFactory({\n  label: 'User',\n  schema: {\n    name: { type: 'string', required: true },\n    email: { type: 'string', required: true },\n  },\n}, neogma);\n\n// Create and query\nconst user = await User.createOne({\n  name: 'Alice',\n  email: 'alice@example.com',\n});\n\nconst found = await User.findOne({ where: { email: 'alice@example.com' } });\n```\n\n**[View full documentation →](https://themetalfleece.github.io/neogma)**\n\n---\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [Features](#features)\n- [Examples](#examples)\n- [Documentation](#documentation)\n- [Development](#development)\n- [Acknowledgements](#acknowledgements)\n\n---\n\n## Documentation\n\nFull documentation is available at **[themetalfleece.github.io/neogma](https://themetalfleece.github.io/neogma)**\n\n---\n\n## Examples\n\n### Creating and Updating Nodes\n\n```js\nconst { Neogma, ModelFactory } = require('neogma');\n\n// create a neogma instance and database connection\nconst neogma = new Neogma(\n    {\n        // use your connection details\n        url: 'bolt://localhost',\n        username: 'neo4j',\n        password: 'password',\n    },\n    {\n        logger: console.log,\n    },\n);\n\n// create a Users model\nconst Users = ModelFactory(\n    {\n        label: 'User',\n        schema: {\n            name: {\n                type: 'string',\n                minLength: 3,\n                required: true,\n            },\n            age: {\n                type: 'number',\n                minimum: 0,\n            },\n            id: {\n                type: 'string',\n                required: true,\n            },\n        },\n        primaryKeyField: 'id',\n        relationshipCreationKeys: {},\n    },\n    neogma,\n);\n\nconst createAndUpdateUser = async () =\u003e {\n    // creates a new Users node\n    const user = await Users.createOne({\n        id: '1',\n        name: 'John',\n        age: 38,\n    });\n\n    console.log(user.name); // 'John'\n\n    user.name = 'Alex';\n    // updates the node's name in the database\n    await user.save();\n    console.log(user.name); // 'Alex'\n\n    await neogma.getDriver().close();\n};\n\ncreateAndUpdateUser();\n```\n\nThe Cypher which runs in `createAndUpdateUser` is the following:\n\n```sql\nStatement: UNWIND {bulkCreateOptions} as bulkCreateData CREATE (bulkCreateNodes:`User`) SET bulkCreateNodes += bulkCreateData\nParameters: { bulkCreateOptions: [ { name: 'John', age: 38, id: '1' } ] }\n\nStatement: MATCH (node:`User`) WHERE node.id = $id SET node.name = $name\nParameters: { id: '1', name: 'Jack' }\n```\n\nAnother feature is to associate the created nodes with other nodes, which will either be created now or by matched by a where clause. This supports infinite nesting for maximum flexibility.\n\n```js\nawait Users.createMany([\n    {\n        id: '1',\n        name: 'John',\n        age: 38,\n        // assuming we're created an Orders Model and alias\n        Orders: {\n            attributes: [\n                {\n                    // creates a new Order node with the following properties, and associates it with John\n                    id: '1',\n                    status: 'confirmed',\n                },\n            ],\n            where: {\n                params: {\n                    // matches an Order node with the following id and associates it with John\n                    id: '2',\n                },\n            },\n        },\n    },\n]);\n\n// find the Order node which is created in the above operation\nconst order = await Orders.findOne({\n    where: {\n        id: '1',\n    },\n});\n\nconsole.log(order.status); // confirmed\n```\n\nThe cypher which runs in `Users.createMany` is the following:\n\n```sql\nStatement: CREATE (node:`User`) SET node += $data CREATE (node__aaaa:`Order`) SET node__aaaa += $data__aaaa CREATE (node)-[:CREATES]-\u003e(node__aaaa) WITH DISTINCT node MATCH (targetNode:`Order`) WHERE targetNode.id = $id CREATE (node)-[r:CREATES]-\u003e(targetNode)\n\nParameters: {\n  data: { name: 'John', age: 38, id: '1' },\n  data__aaaa: { id: '1', status: 'confirmed' },\n  id: '2'\n}\n```\n\n![John Creates Order graph](https://i.imgur.com/gK3d74h.png)\n\nAll of the above run in a single statement for max performance.\n\nAll the user-specified values are automatically used in the query with bind parameters. Neogma also offers helpers to easily create your own queries with generated where clauses and bind parameters.\n\n---\n\n## Development\n\n### Prerequisites\n\n- [nvm](https://github.com/nvm-sh/nvm), which will install node.js\n- [Docker](https://www.docker.com/) and Docker Compose\n\n### Setting up Node.js and Yarn\n\n**Activate the project's Node.js version:**\n\n```bash\nnvm use\n```\n\nThis will automatically use the Node.js version specified in `.nvmrc`.\n\n**Enable Yarn via Corepack:**\n\n```bash\ncorepack enable yarn\n```\n\n### Setting up Neo4j\n\nNeogma requires a running Neo4j instance for unit tests. The easiest way to get started is using Docker Compose.\n\n#### Using Docker Compose (Recommended)\n\n**Start Neo4j:**\n\n```bash\ndocker compose up -d\n```\n\nThis will start a Neo4j 5.x Enterprise instance with:\n- HTTP interface on http://localhost:7474\n- Bolt protocol on bolt://localhost:7687\n- Default credentials: `neo4j/password`\n\n**Note:** Enterprise Edition is required for temporary database support used in tests.\n\n**Verify Neo4j is running:**\n\nOpen http://localhost:7474 in your browser and login with username `neo4j` and password `password`.\n\n**Configure environment variables:**\n\n```bash\ncp .env.example .env\n```\n\nThe `.env` file contains the connection details. You can modify them if you changed the Docker Compose configuration.\n\n**Stop Neo4j:**\n\n```bash\ndocker compose down\n```\n\nTo also remove the data volumes:\n\n```bash\ndocker compose down -v\n```\n\n#### Manual Neo4j Installation\n\nIf you prefer not to use Docker:\n\n1. Download and install [Neo4j Desktop](https://neo4j.com/download/) or [Neo4j Community Edition](https://neo4j.com/deployment-center/)\n2. Create a new database with username `neo4j` and password `password`\n3. Start the database\n4. Copy `.env.example` to `.env` and update the connection details if needed\n\n### Running Tests\n\n1. **Install dependencies:**\n   ```bash\n   yarn\n   ```\n\n2. **Ensure Neo4j is running** (see above)\n\n3. **Configure environment variables:**\n   Make sure you have a `.env` file with the Neo4j connection details (see `.env.example`)\n\n4. **Run the tests:**\n   ```bash\n   yarn test\n   ```\n\n   The tests will automatically create temporary databases for each test suite to avoid conflicts.\n\n### Development Workflow\n\n**Build TypeScript:**\n```bash\nyarn build\n```\n\n**Lint code:**\n```bash\nyarn lint\n```\n\n**Format code:**\n```bash\nyarn format\n```\n\n**Run tests in watch mode:**\n```bash\nyarn test --watch\n```\n\n---\n\n## Acknowledgements\n\n- Neogma logo created by [Greg Magkos](https://github.com/grigmag)\n- Development was made possible thanks to the open source libraries which can be found in package.json.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemetalfleece%2Fneogma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemetalfleece%2Fneogma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemetalfleece%2Fneogma/lists"}