A real world adventure with Golang and Neo4j

Florent Biville
Neo4j Developer Blog
2 min readNov 30, 2020
RealWorld.io example application with Neo4j and the Golang driver

Pun intended.

This post summarizes my recent live-streams on the usage of the official Neo4j Golang Driver in a back-end based on the API specifications of realworld.io, a medium.com clone with a wide range of front- and back-end implementations. The resulting code can be found here.

Gopher artwork by Ashley McNamara

The first live-stream focuses on setting everything up, with the minimal amount of dependencies (the Golang driver, the Ginkgo / Gomega test libraries and testcontainers-go for the Docker-based integration tests).

As of November 2020, the 4.x version of the driver is not generally available yet but the beta version is already worth a try!

go mod init github.com/neo4j-examples/golang-neo4j-realworld-examplego get github.com/neo4j/neo4j-go-driver/v4@v4.0.0-beta2

The API specifications can be retrieved in the main realworld.io repository. They include a very convenient Postman collection file that can help you drive your implementation.

Beyond the setup, the first live-stream also covers the start of the implementation of the first endpoint, i.e. user registration. It briefly touches on how to write Docker-based integration tests with testcontainers-go, towards the end of the stream.

The second live-stream wraps up the user registration implementation, from the user repository up to the entry point main.go. Look at how simple it is to run a Neo4j Docker container with testcontainers-go:

testcontainers usage example in Golang

The next two streams (part 3 and part 4) focus on the login endpoint. Part 3 has, unfortunately, not been live-streamed but you can see the implementation progress in part 4.

The Golang Driver is very easy to use as you can see:

At the time of writing, a part 5 is planned but the realworld.io live-streams will end there. The work to complete the application will continue.

After part 5, I will start a new series, focused on the community Golang Object-Graph Mapper, also known as GoGM (pronounced [GO Gee M] or [Go Gum]).

I will be joined by one of the GoGM maintainers Eric Solender, founder and CTO of Mindstand, the startup company providing this integration.

Stay safe and stay tuned!

--

--