Setting Up a Web Application
This tutorial will guide you through building a simple web application that interacts with the Haste Health FHIR server using our TypeScript SDK. By the end of this tutorial, you'll have a basic web app that can read and display patient data.
Set up the server
- Open the haste health admin application
- Go to your project (or create a project).
- Click ClientApplication from the left menu.
- Click Create Client Application with the following data:
{
"resourceType": "ClientApplication",
"name": "Web App",
"grantType": [
"refresh_token",
"authorization_code"
],
"responseTypes": "token",
"redirectUri": [
"http://localhost:5173"
],
"scope": "offline_access openid email profile fhirUser user/*.*"
}
- After saving the Client Application, copy the Client ID for later use.
- Go to Settings Copy the FHIR Base URL for later use.
- Copy your Tenant ID and Project ID.
Set up the web application
- Clone the following repository.
- Create a .env file with the following content (filled with values copied from the server setup):
VITE_TENANT_ID=your-tenant-id
VITE_PROJECT_ID=your-project-id
VITE_FHIR_BASE_URL=your-fhir-base-url
VITE_CLIENT_ID=your-client-id
- Run the following commands:
npm install
npm run dev
- Open your browser and navigate to
http://localhost:5173. - You should see a simple web application that allows you to authenticate and view patient data.