<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl" -->

---
title: Thinking in Relationships: Practical Graph Database...
description: A Java/Kotlin developer and Neo4j user shares a practical framework for modeling graph databases, using a recipe-and-ingredients domain as a running example....
canonical: https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst | daily.dev
og:description: A Java/Kotlin developer and Neo4j user shares a practical framework for modeling graph databases, using a recipe-and-ingredients domain as a running example....
og:url: https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl
og:image: https://api.daily.dev/og/posts/TT4Icwopl.png
og:image:alt: Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst

**[Spring I/O](https://daily.dev/sources/springio)** · 50 min read · 0 upvotes · 0 comments

## Summary

A Java/Kotlin developer and Neo4j user shares a practical framework for modeling graph databases, using a recipe-and-ingredients domain as a running example. The talk covers core graph concepts (nodes, relationships, properties), Cypher query basics, and common modeling pitfalls like overly generic relationship names and highly connected 'bottleneck' nodes. It emphasizes writing down domain questions before modeling, involving business stakeholders, and iterating on the graph shape based on query performance. A live demo shows a Spring Boot + Kotlin application using Spring Data Neo4j repositories, custom Cypher queries, and projections. The talk closes with lessons learned from client projects, including avoiding over-engineering for future requirements and maintaining an ETL process for remodeling flexibility.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=ImdfQzopSkg>

## Questions this post answers

### How do I avoid highly connected 'bottleneck' nodes when modeling a graph in Neo4j?

Avoid nodes that many other nodes connect to identically, such as a generic 'bread' or 'salad' ingredient shared across millions of recipes, since the query planner must traverse through them, making queries expensive. Instead, make nodes more specific (e.g., separate labels for vegetables, spreads, breads) while using secondary labels to still group them under a common type like 'ingredient' for flexible querying.

_daily.dev surfaces practical graph modeling lessons for developers tuning Neo4j query performance._

### How do you integrate Neo4j with a Spring Boot application?

Neo4j integrates via the Spring Boot starter, which auto-configures the connection using host, authentication, and password settings, and supports enabling debug logging to monitor generated queries. Domain entities are defined as Java or Kotlin classes annotated with @Node, with relationships modeled as separate relationship classes carrying type, direction, and properties, and queried through Spring Data Neo4j repositories or custom Cypher queries.

_Developers wiring Spring Boot to a graph database can track integration patterns like these on daily.dev._

### Should the direction of a relationship matter when modeling a Neo4j graph, like recipe to ingredient versus ingredient to recipe?

Yes, relationship direction affects read performance because the Neo4j query planner traverses from top to bottom. If an application mostly looks up ingredients for a given recipe, model the relationship from recipe to ingredient; if it mostly looks up recipes containing a given ingredient, model it the other way. Getting this wrong can produce poorly performing queries that appear to be Neo4j's fault rather than a modeling issue.

_daily.dev helps developers weighing graph schema trade-offs like relationship direction stay sharp on the topic._

## Similar posts on daily.dev

- [How to Build a Knowledge Graph with Python and Neo4j \[Full Handbook\]](https://daily.dev/posts/how-to-build-a-knowledge-graph-with-python-and-neo4j-full-handbook--drqcmnstt) · freeCodeCamp · 1 upvotes · 0 comments
- [Pattern Matching: Turning Connected Data Into Actionable Intelligence](https://daily.dev/posts/pattern-matching-turning-connected-data-into-actionable-intelligence-wnapd4cm1) · neo4j · 1 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#spring-boot](https://daily.dev/tags/spring-boot), [#neo4j](https://daily.dev/tags/neo4j)

[View this post on daily.dev](https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst","url":"https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl"},"datePublished":"2026-09-27T07:26:35.990Z","dateModified":"2026-09-27T07:53:30.205Z","description":"A Java/Kotlin developer and Neo4j user shares a practical framework for modeling graph databases, using a recipe-and-ingredients domain as a running example....","image":"https://i.ytimg.com/vi/ImdfQzopSkg/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/ImdfQzopSkg/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Spring I/O","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Spring I/O","logo":"https://media.daily.dev/image/upload/s--e-TcwM9B--/f_auto,q_auto/v1790493985/logos/springio?_a=BAMAMicg0","url":"https://daily.dev/sources/springio"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,spring-boot,neo4j","timeRequired":"PT50M","video":{"@type":"VideoObject","name":"Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst","description":"A Java/Kotlin developer and Neo4j user shares a practical framework for modeling graph databases, using a recipe-and-ingredients domain as a running example....","thumbnailUrl":"https://i.ytimg.com/vi/ImdfQzopSkg/sddefault.jpg","uploadDate":"2026-09-27T07:26:35.990Z","duration":"PT50M","url":"https://api.daily.dev/r/TT4Icwopl","embedUrl":"https://www.youtube.com/embed/ImdfQzopSkg"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Spring I/O","item":"https://daily.dev/sources/springio"},{"@type":"ListItem","position":3,"name":"Thinking in Relationships: Practical Graph Database Modelling in Java with Neo4j by Paulien van Alst"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/thinking-in-relationships-practical-graph-database-modelling-in-java-with-neo4j-by-paulien-van-alst-tt4icwopl#faq","mainEntity":[{"@type":"Question","name":"How do I avoid highly connected 'bottleneck' nodes when modeling a graph in Neo4j?","acceptedAnswer":{"@type":"Answer","text":"Avoid nodes that many other nodes connect to identically, such as a generic 'bread' or 'salad' ingredient shared across millions of recipes, since the query planner must traverse through them, making queries expensive. Instead, make nodes more specific (e.g., separate labels for vegetables, spreads, breads) while using secondary labels to still group them under a common type like 'ingredient' for flexible querying. daily.dev surfaces practical graph modeling lessons for developers tuning Neo4j query performance."}},{"@type":"Question","name":"How do you integrate Neo4j with a Spring Boot application?","acceptedAnswer":{"@type":"Answer","text":"Neo4j integrates via the Spring Boot starter, which auto-configures the connection using host, authentication, and password settings, and supports enabling debug logging to monitor generated queries. Domain entities are defined as Java or Kotlin classes annotated with @Node, with relationships modeled as separate relationship classes carrying type, direction, and properties, and queried through Spring Data Neo4j repositories or custom Cypher queries. Developers wiring Spring Boot to a graph database can track integration patterns like these on daily.dev."}},{"@type":"Question","name":"Should the direction of a relationship matter when modeling a Neo4j graph, like recipe to ingredient versus ingredient to recipe?","acceptedAnswer":{"@type":"Answer","text":"Yes, relationship direction affects read performance because the Neo4j query planner traverses from top to bottom. If an application mostly looks up ingredients for a given recipe, model the relationship from recipe to ingredient; if it mostly looks up recipes containing a given ingredient, model it the other way. Getting this wrong can produce poorly performing queries that appear to be Neo4j's fault rather than a modeling issue. daily.dev helps developers weighing graph schema trade-offs like relationship direction stay sharp on the topic."}}]}
```

