Get Started with a Database

iCure Data Stack helps developers create connected apps for healthcare in no time. Let's give it a quick try by creating a node application that lets you store and access encrypted patients in a cloud data store.

First head to Register on our cloud platform and create a database and a user. You will need the username and password below.

Node 15 and Yarn are needed for this example.

mkdir patient-manager
cd patient-manager
yarn init -y
yarn add @icure/api

#if you are using node two other dependencies are needed
yarn add node-fetch node-localstorage

The @icure/apiis the JS library used to simplify access to the iCure application server and to abstract the complexity of the cryptographic layer.

Node 15 is required because it includes the crypto compatibility layer

Now create a file name index.mjs

How to use
import {Api, hex2ua, Patient} from '@icure/api'
import {crypto} from '@icure/api/node-compat.js'

const host = '';
const {
} = Api(host, 'esmith', 'mypassword', crypto)

const loggedUser = await userApi.getCurrentUser();
const loggedHcp = await healthcarePartyApi.getCurrentHealthcareParty()

await cryptoApi.loadKeyPairsAsTextInBrowserLocalStorage(

const patient = await patientApi.createPatientWithUser(loggedUser,
	await patientApi.newInstance(
		new Patient({
			firstName: 'Gustave',
			lastName: 'Eiffel',
			profession: 'Architect & Engineer',
			dateOfBirth: 19731012,
			note: 'A very private information'
const fetchedPatient = await patientApi.getPatientWithUser(loggedUser,
console.log(JSON.stringify(fetchedPatient, null, ' '))

Replace 'demo' / 'demo' by your username and password. If you are writing code for the browser, omit to importcrypto and callApiwith just 3 arguments.

$ node index.mjs

Last updated