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 http://localhost:4000/.
For the local installation you need a recent version of
node (>= v10.12.0
). We are using
12.19.0
and therefore we recommend to use the same version
(see
some known problems with more recent node versions). You can use the
node version manager to switch
between different local node versions.
Install node dependencies with yarn:
$ cd backend
$ yarn install
Copy Environment Variables:
# in backend/
$ cp .env.template .env
Configure the new file according to your needs and your local setup. Make sure a local Neo4J instance is up and running.
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.
Your backend is up and running at http://localhost:4000/ This will start the GraphQL service (by default on localhost:4000) where you can issue GraphQL requests or access GraphQL Playground in the browser.
Database indices and constraints need to be created when the database and the backend is running:
{% tabs %} {% tab title="Docker" %}
$ docker-compose exec backend yarn run db:migrate init
{% endtab %} {% tab title="Without Docker" %}
# in folder backend/
# make sure your database is running on http://localhost:7474/browser/
yarn run db:migrate init
{% endtab %} {% endtabs %}
If you want your backend to return anything else than an empty response, you need to seed your database:
{% tabs %} {% tab title="Docker" %}
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 exec backend yarn run db:migrate init
{% endtab %} {% tab title="Without Docker" %}
Run:
$ yarn run db:seed
To reset the database run:
$ yarn run db:reset
{% endtab %} {% endtabs %}
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.
{% tabs %} {% tab title="Docker" %}
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
{% endtab %} {% tab title="Without Docker" %}
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
{% endtab %} {% endtabs %}
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!
{% tabs %} {% tab title="Docker" %}
Run the unit tests:
$ docker-compose exec backend yarn run test
{% endtab %}
{% tab title="Without Docker" %}
Run the unit tests:
$ yarn run test
{% endtab %} {% endtabs %}