A TypeScript-based, fluent query builder for Neo4j, designed for type-safe and intuitive Cypher query construction.
OTHER License
Seraph is an open-source, TypeScript-based query builder for Neo4j that simplifies the construction of Cypher queries through a fluent API. Designed with Domain-Driven Design (DDD) principles, Seraph offers a type-safe and intuitive way to build queries, making it easier for developers to work with Neo4j.
To install Seraph, you can use npm:
npm install seraph4j
Or with yarn:
yarn add seraph4j
Here is a basic example of how to use Seraph to create a simple query:
import { QueryBuilder, Node } from 'seraph4j';
const personNode = new Node('Person', { name: 'Alice', age: 30 });
const query = new QueryBuilder()
.createNode(personNode)
.build();
console.log(query);
// Outputs: CREATE (n:Person {name: Alice, age: 30})
import { QueryBuilder, Relationship } from 'seraph4j';
const relationship = new Relationship('FRIEND', 'n', 'm');
const query = new QueryBuilder()
.createRelationship(relationship)
.build();
console.log(query);
// Outputs: CREATE (n)-[:FRIEND]->(m)
The project follows Domain-Driven Design principles, structured as follows:
src/core/
: Core application logic (query builders).src/domain/
: Domain models like Nodes and Relationships.src/infrastructure/
: Infrastructure-specific code, such as database interactions.src/types/
: TypeScript types and interfaces.src/utils/
: Utility functions.tests/
: Unit and integration tests.Seraph uses Jest for testing. To run tests, use the following command:
npm test
This will execute all unit and integration tests, ensuring the integrity of the core functionality.
Contributions are welcome! Here’s how you can contribute:
git checkout -b feature/your-feature-name
).git commit -m 'Add your feature'
).git push origin feature/your-feature-name
).Please read the Code of Conduct to understand the expectations for participants' behavior in the community.
Please read CONTRIBUTING.md for details on the process for submitting pull requests and the coding style we use.
This project is licensed under the MIT License - see the LICENSE file for details.