Explore documentation

Set up a project with the CLI

Generate a Quickstart, configure a test organization, and verify the connection.

Run the setup

Use Node.js 22 or later and run this from the project directory. New Astro starters require Node.js 22.23.4 or later. New SvelteKit starters require Node.js 22.17 or later.

npx @esushealth/cli init

In an empty directory, choose Next.js 15 App Router, Astro, SvelteKit, Node.js, or a static HTML demo. In an existing package, the CLI recognizes Next.js 15 App Router, Astro, and SvelteKit. Other projects get the Node.js guide and server example.

For a live integration, pick npm, pnpm, Yarn, or Bun for a new app. In an existing package, the CLI reads its declared package manager or lockfile. It uses npm when neither is present. It installs dependencies after you confirm the file changes. Use --package-manager pnpm to select a manager explicitly or --no-install to install them yourself.

Choose API key or SMART, one organization or separate staging and production organizations, and the FHIR resources you want to use. With an API key, you can verify the credential in the prompt. The CLI does not save the key you enter there.

Configure and verify

For a live integration, copy .env.esus.example to the server-side .env.local. For a single organization with an API key, set ESUS_DEFAULT_API_KEY to the complete Client ID:Secret. If the key belongs to an app, use that app’s ID in the profile or ESUS_DEFAULT_APP_ID. Keep .env.local out of version control.

npx @esushealth/cli doctor

For staging and production profiles, set ESUS_PROFILE in .env.local and use the matching variable prefix from the generated example. To check staging explicitly, run npx @esushealth/cli doctor --profile staging. The API-key check confirms the organization and reports grants for the selected resources.

ProjectWhere to continue
Next.js 15 App RouterStart your dev server and open /esus. API-key routes require the host authorization hook in app/esus/authorize.ts or src/app/esus/authorize.ts. Open /esus/authorization for guidance. For SMART, configure the registered callback and authorize from /esus.
Astro or SvelteKitStart your dev server and open /esus/index.html. Run the generated server example.
Node.jsOpen esus/index.html and run node esus.example.mjs. With Yarn, use yarn node esus.example.mjs.
Static HTMLOpen esus/index.html. The demo uses fictional data and needs neither dependencies nor credentials.

For SMART in the portable guides, supply an access token from your own SMART sign-in flow using the variable in .env.esus.example.

Add resources or update the Quickstart

npx @esushealth/cli resources
npx @esushealth/cli add Observation
npx @esushealth/cli upgrade --dry-run

Use npx @esushealth/cli capabilities to list optional integrations. Their templates are for the Next.js Quickstart. To apply an upgrade after reviewing it, run npx @esushealth/cli upgrade. Edited generated files are flagged for manual review.

If installation is interrupted, rerun init in the same directory. The CLI can resume from the previous choices or retry dependency setup if the files are already in place. For calls from your own server code, continue to the SDK guide.