Skip to content

Development setup

The development setup provides everything except Core itself, which you run from your IDE or Maven.

Prerequisites

  • JDK 24 and Maven
  • Docker, for the local infrastructure and for the integration tests

Start the infrastructure

cd utils/devSetup
docker compose up -d                     # Keycloak + PostgreSQL + demo data
docker compose --profile neo4j up -d     # additionally Neo4j
Service Address Credentials
Keycloak http://localhost:9001 Realm marmotgraph; see below
PostgreSQL localhost:9002 marmotgraph_pg_usr / marmotgraph_pg_pwd
Neo4j browser / Bolt http://localhost:9004 / localhost:7687 neo4j / marmotgraph_neo4j_pwd

Users in the realm (all with the password helloMarmotGraph):

User Role
admin Global administrator (group marmotgraph-admins)
demo_editor EDITOR in demo
demo_reviewer REVIEWER in demo
demo_consumer CONSUMER in demo

The service account demo-data-uploader (secret demoDataUpload) is a global administrator too. The interactive client is kg.

Danger

These credentials are for local development only.

The demo-data-upload container waits until Core is reachable, then loads the sample data, role definitions, validation schemas and scopes from utils/devSetup/demodata. It uses the Python SDK from sdks/python.

Run Core

The environment is in utils/devSetup/dev.env.

Run org.marmotgraph.core.MarmotGraphCore with the variables from utils/devSetup/dev.env.

env $(xargs < utils/devSetup/dev.env) mvn spring-boot:run

Core starts at http://localhost:8000, with the Swagger UI at http://localhost:8000/swagger-ui/index.html.

The default profile is nograph, which doesn't need a graph database. To use Neo4j, set SPRING_PROFILES_ACTIVE=neo4j and start the matching compose profile.

Build and test

mvn clean package                 # build
mvn test                          # all tests
mvn test -Dtest=ClassName         # one class
mvn test -Dtest=ClassName#method  # one method

See Test overview for details.

Build this documentation

docker run --rm -it --user "$(id -u):$(id -g)" -p 8001:8000 -v "$PWD":/docs zensical/zensical
pip install -r docs/requirements.txt
zensical serve -a localhost:8001

The documentation is then available at http://localhost:8001. zensical build --strict writes the static site to site/ and fails on broken links and anchors. zensical serve doesn't support strict mode, so it won't fail on them. Configuration is in zensical.toml, and diagrams are written in Mermaid.

Bundle it into the application

The docs Maven profile builds the documentation and adds it to the jar, where it's served at /docs:

pip install -r docs/requirements.txt
mvn clean package -Pdocs

A broken link or anchor fails the build. If zensical isn't on the PATH, pass it with -Dzensical.executable=<path>. Without the profile, neither Python nor Zensical is needed and the application has no documentation at /docs.