Skip to content

neo4j-examples/nestjs-neo4j-realworld-example

Repository files navigation

RealWorld Example App

Neo4j & Typescript (using Nest.js) codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with a Neo4j database backed Nest.js application including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Neo4j and Nest.js community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

Neo4j is a Graph Database, a database designed to hold the connections between data (known as relationships) as important as the data itself. A Neo4j database consists of Nodes connected together with Relationships. Both nodes and relationships can contain one or more properties, which are key/value pairs.

For more information on how Neo4j compares to other databases, you can check the following links:

Data Model

Data Model

The data model diagram has been created with Arrows. You can edit the model by clicking the Export Markup button in Arrows, copying the contents of arrows.html into the text box and clicking Save at the bottom of the modal.

Dependencies

Modules, Controllers, Services

The application contains two modules. Modules are a way to group functionality (think domains and subdomains in DDD) and a convenient way to register functionality with the main app. These modules are registered in the AppModule.

  • user - This module provides functionality based around User nodes. This includes user profiles, follow/unfollow functionality and all authentication functionality.
  • article - All functionality based around Article and Tag nodes

Validation Errors

Validation errors are returned with the HTTP 400 Bad Request. The UnprocessibleEntityValidationPipe extends Nest.js's out-of-the-box ValidationPipe, providing an exceptionFactory function that instead returns an UnprocessableEntityException error containing the error messages required by the UI.

Further Reading

This example was built as part of a series of Live Streams on the Neo4j Twitch Channel. You can watch the videos back on the Building Applications with Neo4j and Typescript playlist on the [Neo4j Youtube Channel].

Getting started

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Questions, Comments, Support

If you have any questions or comments, please feel free to reach out on the Neo4j Community Forum or create an Issue. If you spot any bugs or missing features, feel free to submit a Pull Request.

About

A Neo4j, Typescript and Nest.js clone of the Realworld.io App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages