Skip to main content

Local setup

Use cases:

  • You are building a patient experience
  • You would like to develop integrations

Install Docker

Easiest solution is to install Docker Desktop for Mac or Docker Desktop for Windows.

Prepare a Docker Compose file

Create a file: docker-compose.yml with the following contents:

version: '3'
services:
admin:
image: healthblocks/admin:dev
environment:
PORT: 22228
# API
HEALTHBLOCKS_API_EXTERNAL: http://localhost:22221
HEALTHBLOCKS_API_INTERNAL: http://api:3000
# Auth
NEXTAUTH_URL: http://localhost:22228
NEXTAUTH_URL_INTERNAL: http://localhost:3000
NEXTAUTH_SECRET: aaaabbbbccccdddd
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres?connect_timeout=30
ports:
- '22228:22228'
depends_on:
- api
restart: always
api:
image: healthblocks/platform:dev
environment:
# Initial setup
INITIAL_SETUP: 1
SERVER_SIGNUP: open
TENANCY: multi
# API
NODE_ENV: production
ORIGIN: http://localhost:22221
ALLOWED_ORIGINS: http://localhost:22221,http://localhost:22228,http://localhost:20072
# Admin panel
ADMIN_URL: http://localhost:22228
# Auth
APP_SECRET: 444a45b38193572dd7d3c0d691d806b487dbdfe1
# Database
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres?connect_timeout=30
DATABASE_MIGRATE: auto # manual|auto
# Sentry
SENTRY_DSN: false
DEPLOYMENT_ENV: local
ports:
- '22221:3000'
depends_on:
postgres:
condition: service_healthy
restart: always
healthcheck:
test: curl --fail http://localhost:3000 || exit 1
interval: 10s
timeout: 5s
retries: 5
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# ports:
# - '5432:5432'
volumes:
- healthblocks-postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5
volumes:
healthblocks-postgres-data:

Start Docker Compose

This will create a postgres container with 2 databases. One for the API and one for the admin UI.

docker compose up -d

Open the API endpoint

It could take a couple minutes to download the containers and start postgres. Once it's ready, the API should be available at http://localhost:22221.

There are three steps:

  1. Choose an authenticator method. Credentials is the easiest one as it doesn't require an external service. OAuth2 is recommended though, on the one hand for security and on the other hand as it is faster than typing in a username and password every time!
  2. (only when using oAuth) configure the given redirect URI for your oAuth2 provider.
  3. (recommended) Disable the INITIAL_SETUP environment variable. As long as it is enabled, anyone can run the initial setup. This is fine when developing locally, but must definitely be disabled in production!

Now visit the dashboard.

Sign in on the dashboard

There should be a sign in screen using the chosen authenticator. Anyone can use it to make an account. Let's do this. This sign in screen is meant for users (typically administrators) that may interact with multiple projects.

When signed in you can manage the server. There is not much more to do than to create a project or accept invites to other projects.

Note the suggestions, these should guide you further in the setup of your project.