Use Aidbox with React
Learn how to launch the sample app, add some sample data and query the data from a React app.
Intro
This quickstart guide demonstrates how to launch a PHR sample app on the Aidbox platform. The sample app has been developed using the official JavaScript SDK, incorporating Aidbox's best practices.
The guide helps you to explore the following Aidbox features:
REST Console: execute and debug HTTP requests directly within Aidbox.
Access Control: manage fine-grained data access through the API.
Data Import endpoint: Efficiently load FHIR data into Aidbox.
JavaScript SDK: Streamline JS app development on Aidbox effortlessly.
1. Run Aidbox and set up Access Control
Create your own Aidbox instance in the Aidbox User Portal.
Configure Access Control within the Aidbox UI using the integrated REST console. Utilize the provided code snippets to create the Client and Access Policy for the sample app.
Register Client for the sample app:
Add Access Policy for the sample app:
By default, Aidbox has a policy that locks down access to all data. You need to enable data sharing by adding Access Policies for Clients. Aidbox supports different ways to describe these policies, like JSON Schema, SQL, or Macho DSL. Learn more.
2. Import the sample data into Aidbox
Populate your Aidbox instance with some synthetic data from Synthea using the Import endpoint and the handy REST console. Just run the following request to create the data:
The $import endpoint is your go-to tool for loading FHIR data asynchronously into Aidbox. It effortlessly loads data from a public link specified in your HTTP request without performing any validation. Learn more.
3. Clone and Connect the sample app to Aidbox
Time to get your hands on the sample app! Simply clone it from GitHub at this link: https://github.com/Aidbox/aidbox-sdk-js/tree/main/personal-health-record
Next up, let's configure the web app environment variables. Grab the .env.tpl file, make a copy called .env, and modify the following variables according to the configuration you set up in Step 1:
4. Start the sample app
Start the app and navigate to http://localhost:5173 using your favorite browser.
Congratulations! You now have a fully functional application that is ready to be customized according to your needs. Explore the personal health record app sample from a technical perspective and uncover the wonders of working with Aidbox through the SDK.
Next Steps
Explore the Aidbox JavaScript SDK for advanced features.
Unlock additional capabilities of Aidbox UI.
Dive into the built-in Access Control module.
Play around with the $import endpoint to load FHIR data.
Last updated