
Spring Data Neo4j
Model graph domains in Spring Data Neo4j with @Node entities, relationships, custom Cypher queries, and reactive or test harness patterns.
Overview
Spring Data Neo4j is an agent skill for the Build phase that provides comprehensive Spring Data Neo4j entity, relationship, custom query, reactive, and testing examples for graph-backed Java services.
Install
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill spring-data-neo4jWhat is this skill?
- Complete Movie Database @Node example with ACTED_IN and DIRECTED relationships
- Social network and e-commerce product catalog graph patterns
- Custom query examples beyond derived finder methods
- Reactive Neo4j repository variants for non-blocking stacks
- Testing examples aligned with Spring Data Neo4j test slices
- 6 major example sections in the skill table of contents
Adoption & trust: 1.2k installs on skills.sh; 271 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You picked Neo4j for connected data but Spring Data Neo4j relationship directions, custom queries, and reactive repos are easy to get wrong from memory.
Who is it for?
Indie developers building Spring Boot APIs on Neo4j who want copy-paste-correct @Node and @Relationship models.
Skip if: Greenfield projects that only need PostgreSQL with JSON, or teams not using Java/Spring.
When should I use this skill?
Implementing or extending Spring Data Neo4j models, repositories, or tests in a Java project.
What do I get? / Deliverables
You implement graph entities and repositories using proven movie, social, and catalog patterns plus test-ready configurations.
- @Node entity templates
- Repository and custom query examples
- Reactive and test configuration samples
Recommended Skills
Journey fit
Graph schema and repository code belong in the backend build phase when you choose Neo4j over relational stores for connected data. Backend covers entity mapping, relationship directions, and repository queries for movie, social, and catalog-style graph examples.
How it compares
Spring Data Neo4j recipe book—not a Neo4j Cypher-only reference or a frontend graph visualization skill.
Common Questions / FAQ
Who is spring-data-neo4j for?
Java and Spring Boot developers modeling graph data in Neo4j with Spring Data Neo4j repositories and tests.
When should I use spring-data-neo4j?
During Build/backend when defining nodes and relationships, writing custom @Query methods, or adding reactive Neo4j to a microservice.
Is spring-data-neo4j safe to install?
It supplies code patterns only; review the Security Audits panel on this page and scan generated code before connecting to production Neo4j instances.
SKILL.md
READMESKILL.md - Spring Data Neo4j
# Spring Data Neo4j - Examples This document provides comprehensive, real-world examples of Spring Data Neo4j patterns and implementations. ## Table of Contents 1. [Complete Movie Database Example](#complete-movie-database-example) 2. [Social Network Example](#social-network-example) 3. [E-Commerce Product Catalog](#e-commerce-product-catalog) 4. [Custom Query Examples](#custom-query-examples) 5. [Reactive Neo4j Examples](#reactive-neo4j-examples) 6. [Testing Examples](#testing-examples) ## Complete Movie Database Example ### Entity Classes ```java @Node("Movie") public class Movie { @Id private final String imdbId; private final String title; @Property("tagline") private final String description; private final Integer releaseYear; private final List<String> genres; @Relationship(type = "ACTED_IN", direction = Direction.INCOMING) private List<ActedIn> actors; @Relationship(type = "DIRECTED", direction = Direction.INCOMING) private List<Person> directors; public Movie(String imdbId, String title, String description, Integer releaseYear, List<String> genres) { this.imdbId = imdbId; this.title = title; this.description = description; this.releaseYear = releaseYear; this.genres = genres; this.actors = new ArrayList<>(); this.directors = new ArrayList<>(); } // Getters public String getImdbId() { return imdbId; } public String getTitle() { return title; } public String getDescription() { return description; } public Integer getReleaseYear() { return releaseYear; } public List<String> getGenres() { return genres; } public List<ActedIn> getActors() { return actors; } public List<Person> getDirectors() { return directors; } } @Node("Person") public class Person { @Id @GeneratedValue private Long id; private final String name; private final Integer birthYear; @Relationship(type = "ACTED_IN", direction = Direction.OUTGOING) private List<ActedIn> actedIn; @Relationship(type = "DIRECTED", direction = Direction.OUTGOING) private List<Movie> directed; public Person(String name, Integer birthYear) { this.name = name; this.birthYear = birthYear; this.actedIn = new ArrayList<>(); this.directed = new ArrayList<>(); } public Person withId(Long id) { if (this.id != null && this.id.equals(id)) { return this; } Person newPerson = new Person(this.name, this.birthYear); newPerson.id = id; return newPerson; } // Getters public Long getId() { return id; } public String getName() { return name; } public Integer getBirthYear() { return birthYear; } public List<ActedIn> getActedIn() { return actedIn; } public List<Movie> getDirected() { return directed; } } @RelationshipProperties public class ActedIn { @Id @GeneratedValue private Long id; @TargetNode private final Movie movie; private final List<String> roles; private final Integer screenTime; // in minutes public ActedIn(Movie movie, List<String> roles, Integer screenTime) { this.movie = movie; this.roles = roles; this.screenTime = screenTime; } // Getters public Long getId() { return id; } public Movie getMovie() { return movie; } public List<String> getRoles() { return roles; } public Integer getScreenTime() { return screenTime; } } ``` ### Repository Interfaces ```java @Repository public interface MovieRepository extends Neo4jRepository<Movie, String> { // Simple query derivation Optional<Movie> findByTitle(String title); List<Movie> findByReleaseYear(Integer year); List<Movie> findByReleaseYearBetween(Integer startYear, Integer endYear); List<Movie> find