You're reading the documentation for a development version. For the latest released version, please have a look at 1.1.1.

Prerequisites

Note

A whole tutorial referenced here is available in the following Postman collection: https://documenter.getpostman.com/view/1515623/2sAYdimoej

Note

Alternatively to setting up a local instance of openFHIR, you can also use https://sandbox.open-fhir.com (as used in the referenced postman collection above)

If you have a license (or trial license), below is an example of a docker compose file that sets up openFHIR locally. Alternatively, if you’d like to test it out on a public sandbox, you can invoke all APIs referenced in this tutorial on the https://sandbox.open-fhir.com (see postman collection). In this case, you need to use Basic auth in all your requests. Username being a unique UUID (for example: Basic OTE0NjZkNzE6OTE0NjZkNzE=)

Run the following docker compose (or configure it to your liking, i.e. change to Postgres if required):

services:
  openfhir:
    image: openfhir/openfhir:latest
    container_name: openfhir
    ports:
      - "8080:8080"
    volumes:
      - "/home/user/Documents/openFHIR/license.json:/app/openfhir-license.json"
      - "/home/user/Documents/openFHIR/openfhir-bootstrap/:/app/bootstrap/"
    environment:
        SPRING_DATA_MONGODB_URI: "mongodb://openfhir:openfhir@localhost:27017/openfhir"
        LICENSE: "/app/openfhir-license.json" # could also be left out, as this is the default
        BOOTSTRAP_DIR: "/app/bootstrap/" # could also be left out, as this is the default

  mongodb:
    image: mongo:latest
    container_name: mongodb
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: "admin"
      MONGO_INITDB_ROOT_PASSWORD: "admin"
      MONGO_INITDB_DATABASE: "openfhir"
    volumes:
      - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro

File referenced under volumes in the mongodb service (init-mongo.js) could look as follows:

// Connect to the admin database to create a user for a specific database
db = db.getSiblingDB('openfhir');

// Create a new user with readWrite access to the 'openfhir' database
db.createUser({
    user: 'openfhir',
    pwd: 'openfhir',
    roles: [
        {
            role: 'readWrite',
            db: 'openfhir'
        }
    ]
});