Skip to main content

Minimum Implementation


Use this section to complete the required setup for the Doctor App SDK. This setup enables screen rendering, secure session context, and internal routing within your application.


Initialize the SDK Context

Wrap your application in the global DoctorAppProvider component. This component enables SDK-managed routing, authentication, and data flow across all Doctor App screens.

import { DoctorAppProvider } from 'dr-sdk';

function AppRoot() {
return (
<DoctorAppProvider apiKey="your-api-key">
<YourAppNavigation />
</DoctorAppProvider>
);
}

Mount DoctorAppProvider once at the top level of your app layout. Do not wrap it more than once.


Define the Screen Host

Render the DoctorScreenHost component at the location where Doctor App content should appear. The screen host listens to route changes and renders corresponding SDK views.

import { DoctorScreenHost } from 'dr-sdk';

function DoctorTab() {
return <DoctorScreenHost basePath="/doctor" />;
}

The basePath defines the root path for all SDK-controlled screens, such as /doctor/appointments/list and /doctor/profile/settings.


Configure Routing

Register a route that renders your screen host. This allows the SDK to control navigation and lifecycle behavior.

Example: React Router v6

<Route path="/doctor/*" element={<DoctorTab />} />

Use a wildcard path (*) to allow nested routes.


Enable Secure Session

Set the authenticated session after user login. This session must include the doctorId and a valid token. Without a session, SDK screens do not load protected content.

import { setDoctorSession } from 'dr-sdk';

setDoctorSession({
doctorId: 'abc-123',
token: 'your-jwt-token',
});

Call this function immediately after your login flow completes.


Load an Initial Screen

Use your app’s router to navigate to the first Doctor App screen. This could be triggered by login completion, user interaction, or deep links.

navigate('/doctor/appointments/list');

The screen host renders the appointment list when this path is active.