★ 2stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/kanji8210/dimp_back/archive/refs/heads/main.zipDIMP Kenya API (WordPress plugin)
Headless REST API for the DIMP Kenya (Doctor in My Pocket) Next.js frontend.
Exposes routes under the dimp/v1 namespace so they resolve at
/wp-json/dimp/v1/<route> — matching NEXT_PUBLIC_WP_PLUGIN_NAMESPACE.
Install
- Copy the
dimp-api/folder into your WordPresswp-content/plugins/directory. - In wp-admin → Plugins, activate DIMP Kenya API.
- On activation it registers the custom post types, seeds 4 demo doctors, and flushes rewrite rules.
Endpoints
| Method | Route | Auth | Returns |
|---|---|---|---|
| GET | /wp-json/dimp/v1/ping |
Public | Health/status object |
| GET | /wp-json/dimp/v1/doctors |
Public | Array of doctors |
| GET | /wp-json/dimp/v1/patients/me/appointments |
Logged-in user | Array of the current user's appointments |
Response shapes
/doctors returns objects matching the frontend DoctorItem:
{
"id": "DOC-12",
"name": "Dr. Achieng Otieno",
"specialty": "General Practice",
"county": "Nairobi",
"rating": 4.9,
"language": ["English", "Kiswahili", "Dholuo"],
"feeKes": 1800,
"nextSlot": "Today 17:00",
"bio": "Primary care physician..."
}
/patients/me/appointments returns objects matching the frontend AppointmentItem:
{
"id": "APT-34",
"doctorName": "Dr. Achieng Otieno",
"specialty": "General Practice",
"date": "2026-06-14",
"time": "09:30",
"status": "confirmed"
}
Connecting the frontend
Set these env vars in the Next.js app (.env.local and Vercel):
NEXT_PUBLIC_WP_API_BASE_URL=http://localhost:8080
NEXT_PUBLIC_WP_PLUGIN_NAMESPACE=dimp/v1
The Next.js API routes (/api/patient/doctors, /api/patient/appointments,
/api/health/wp) call these endpoints and fall back to bundled mock data when
the backend is unreachable.
Notes
appointmentsrequires an authenticated WordPress user. The current frontend fetch is unauthenticated server-side, so until login (cookie/nonce or JWT) is wired, that route returns401and the frontend uses its fallback data — by design./doctorsand/pingwork immediately.- Doctors and appointments are stored as custom post types (
dimp_doctor,dimp_appointment) and are editable from wp-admin.
Data model
- Doctor (
dimp_doctor): title = name; meta =specialty,county,rating,languages(comma-separated),fee_kes,next_slot,bio. - Appointment (
dimp_appointment): meta =doctor_name,specialty,appt_date,appt_time,status,patient_id(WP user ID).