Human Connection
1.0.0
1.0.0
  • Introduction
  • Edit this Documentation
  • Installation
  • Neo4J
  • Backend
    • GraphQL
    • neo4j-graphql-js
  • Webapp
    • Components
    • HTML
    • SCSS
    • Vue
  • Testing Guide
    • End-to-end tests
    • Frontend tests
    • Backend tests
  • Contributing
  • Kubernetes Deployment
    • Minikube
    • Digital Ocean
      • Kubernetes Dashboard
      • HTTPS
    • Human Connection
      • Error Reporting
      • Mailserver
      • Maintenance
    • Volumes
      • Neo4J Offline-Backups
      • Neo4J Online-Backups
      • Volume Snapshots
      • Reclaim Policy
      • Velero
    • Metrics
    • Legacy Migration
  • Feature Specification
  • Code of conduct
  • License
Powered by GitBook
On this page
  • Backend
  • Installation with Docker
  • Installation without Docker
  • Testing

Was this helpful?

Backend

PreviousNeo4JNextGraphQL

Last updated 5 years ago

Was this helpful?

Backend

Installation with Docker

Run the following command to install everything through docker.

The installation takes a bit longer on the first pass or on rebuild ...

$ docker-compose up

# rebuild the containers for a cleanup
$ docker-compose up --build

Wait a little until your backend is up and running at .

Installation without Docker

For the local installation you need a recent version of (>= v10.12.0).

Install node dependencies with :

$ cd backend
$ yarn install

Copy Environment Variables:

# in backend/
$ cp .env.template .env

Start the backend for development with:

$ yarn run dev

or start the backend in production environment with:

yarn run start

For e-mail delivery, please configure at least SMTP_HOST and SMTP_PORT in your .env configuration file.

Database Indices and Constraints

Database indices and constraints need to be created when the database and the backend is running:

docker-compose exec backend yarn run db:migrate init
# in folder backend/
# make sure your database is running on http://localhost:7474/browser/
yarn run db:migrate init

Seed Database

If you want your backend to return anything else than an empty response, you need to seed your database:

In another terminal run:

$ docker-compose exec backend yarn run db:seed

To reset the database run:

$ docker-compose exec backend yarn run db:reset
# you could also wipe out your neo4j database and delete all volumes with:
$ docker-compose down -v
# if container is not running, run this command to set up your database indeces and contstraints
$ docker-compose run backend yarn run db:migrate init

Run:

$ yarn run db:seed

To reset the database run:

$ yarn run db:reset

Data migrations

Although Neo4J is schema-less,you might find yourself in a situation in which you have to migrate your data e.g. because your data modeling has changed.

Generate a data migration file:

$ docker-compose exec backend yarn run db:migrate:create your_data_migration
# Edit the file in ./src/db/migrations/

To run the migration:

$ docker-compose exec backend yarn run db:migrate up

Generate a data migration file:

$ yarn run db:migrate:create your_data_migration
# Edit the file in ./src/db/migrations/

To run the migration:

$ yarn run db:migrate up

Testing

Beware: We have no multiple database setup at the moment. We clean the database after each test, running the tests will wipe out all your data!

Run the jest tests:

$ docker-compose exec backend yarn run test:jest

Run the cucumber features:

$ docker-compose exec backend yarn run test:cucumber

Run the jest tests:

$ yarn run test:jest

Run the cucumber features:

$ yarn run test:cucumber

Configure the new file according to your needs and your local setup. Make sure a instance is up and running.

Your backend is up and running at This will start the GraphQL service (by default on localhost:4000) where you can issue GraphQL requests or access GraphQL Playground in the browser.

http://localhost:4000/
node
yarn
local Neo4J
http://localhost:4000/
GraphQL Playground