Building Neo4j Applications with TypeScript
Learn to use Neo4j with TypeScript: install the JavaScript driver, run Cypher queries, read and write graph data, and type-check results with generics.
In this 2-hour course, you will learn
TypeScript and Neo4j work together through the official Neo4j JavaScript driver, and this course teaches you how to combine them. You will install the driver, create a driver instance, execute Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. queries from TypeScript code, read and write data, and use TypeScript interfaces and generics to type-check every value the database returns.
The driver is the supported, first-party way to communicate with Neo4j from a Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties..js application, and it ships with TypeScript type definitions out of the box. That means the compile-time safety you rely on everywhere else in your codebase can extend all the way to your database results: TypeScript can tell you before you run your application that a Full definition for property (opens in a new tab)A named value stored on a node or a relationship. is missing from a node, that a key does not appear in a record, or that a value is not the type you expected.
Driver Life Cycle
Understand how the Neo4j JavaScript driver is initialised, reused across requests, and closed cleanly to avoid connection leaks in long-running TypeScript applications.
Installing and Instantiation
Install the Neo4j JavaScript driver via npm, configure a typed driver instance with credentials, and verify connectivity before executing any queries.
Read and Write Transactions
Write explicit read and write transactions using the driver session API, ensuring correct routing in a clustered environment and safe retry behaviour on transient errors.
Best Practices
Apply TypeScript generics to type Cypher query results, handle errors gracefully, and structure driver code so it integrates cleanly with the rest of your application.
Who this course is for
TypeScript developers who want to add a graph database to their applications: backend developers building APIs with frameworks such as Express, NestJS, or Fastify, full-stack developers who want connected data behind their web applications, and JavaScript developers who want compile-time guarantees on their Neo4j queries. You should be comfortable writing TypeScript and using npm, and be familiar with the basics of Neo4j and Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. first — the prerequisite courses are listed beside this overview. No previous experience with the driver itself is needed; the course starts with installation and builds up one concept at a time.
What you'll build and do
This is a hands-on course built around short lessons followed by challenges that verify your code against a live movie recommendations database. You will install the
neo4j-driverpackage with npm, create a driver instance using aneo4j+s://connection string, then execute Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it. statements withdriver.executeQuery(). You will read data withRoutingControl.READ, write data through the cluster leader, and unpack theEagerResultthat comes back — its records, its keys, and the summary metadata.The final lessons focus on what makes the TypeScript experience distinct. You will learn how Cypher values map to JavaScript types, including the special handling that integers, temporal values, and spatial points require, then define interfaces that describe your query results, type your Full definition for node (opens in a new tab)A vertex in a graph. In a property graph it can carry labels and properties. and Full definition for relationship (opens in a new tab)A named, directed connection between two nodes. Every relationship has a type, a start node and an end node. with the
NodeandRelationshipgenerics, and pass those interfaces to your queries so the compiler catches mistakes during development rather than in production.Where to go next
If you want to keep building in TypeScript, Building GraphRAG TypeScript MCP tools uses the same driver skills to expose your graph to AI agents through a custom MCP server, and Introduction to Neo4j & GraphQL puts a typed API in front of your data. To sharpen your Full definition for Cypher (opens in a new tab)Neo4j's implementation of GQL, the ISO standard query language for graph databases. It is declarative: you describe the pattern to find, and the database decides how to find it., take Intermediate Cypher Queries. This course also counts toward your preparation for the Neo4j Certified Professional exam, which validates your knowledge of Neo4j fundamentals, Cypher, and application Full definition for pattern (opens in a new tab)A graph structure written in Cypher, such as a node joined to another node by a relationship. like the ones you practice here.