@clinikapi/react package gives you nine production-ready clinical UI widgets you can embed directly in your React application. Every widget communicates with ClinikAPI through a backend proxy you control — your secret API key never touches the browser. Install the package, expose one API route per widget, and you have a full clinical interface in minutes.
Installation
The proxy pattern
Widgets run in the browser and cannot use the@clinikapi/sdk directly — doing so would expose your secret API key to anyone who inspects network traffic. Instead, each widget accepts a proxyUrl prop pointing to an API route on your own backend. Your backend holds the key, calls ClinikAPI, and returns the data.
Setting up a backend proxy
The following example shows a Next.js App Router API route that powers thePatientDashboard widget. The pattern is the same for every other widget — the only thing that changes is which SDK method you call.
Using a widget
Once your proxy route is in place, import the widget and pass it the proxy URL:Available widgets
| Widget | Description |
|---|---|
| PatientDashboard | Full patient overview with encounters, vitals, and medications |
| AppointmentScheduler | Book and manage patient appointments |
| PrescriptionForm | Create and edit medication prescriptions |
| NoteEditor | Rich clinical note editor with note type selection |
| IntakeForm | Dynamic patient intake questionnaire |
| ConsentManager | Consent document signing and management |
| VitalsWidget | Vital signs display with trend charts |
| LabResultsWidget | Lab report viewer with result interpretation |
| PrescriptionWidget | Prescription list and detail viewer |
Common props
Every widget accepts the following props:The URL of your backend proxy endpoint. The widget sends all requests to this URL. Must be a same-origin path (e.g.
/api/clinik/patients/123) to prevent open redirect attacks.A CSS class name applied to the widget’s root element. Use this to control sizing, spacing, or theming.
A callback invoked when the widget encounters an error fetching or submitting data. Use this to display error toasts, log to your error tracker, or redirect the user.
Security
The proxy pattern enforces a strict security boundary:- No key exposure: Widgets never receive or store your ClinikAPI API key.
- You control access: Your proxy can verify the logged-in user’s session before forwarding any request to ClinikAPI.
- Open redirect protection: The
proxyUrlprop is validated to be a same-origin path — widgets will not follow redirects to external hosts. - Tenant isolation: ClinikAPI automatically tags every resource with your organization’s tenant ID, so data from other tenants is never returned regardless of what your proxy requests.
ClinikAPI does not handle end-user authentication. Your backend is responsible for authenticating the user before your proxy calls ClinikAPI. See Authentication for the full auth model.