ClinicBook, klinisyenlerin (doktorlar, fizyoterapistler, psikologlar vb.) randevularını, hastalarını ve klinik performanslarını yönetebilecekleri, Activepieces tabanlı otomasyon desteğine sahip modern bir yönetim panelidir.
Backend — Fastify 5 · Prisma 5 · PostgreSQL · JWT (access + refresh rotation) · node-cron · Zod Frontend — React 19 (Vite) · Zustand · React Router 7 · Recharts · date-fns · Lucide · react-hot-toast
- Node.js ≥ 20
- PostgreSQL ≥ 14 (lokal veya Docker)
cd clinicbook-backend
cp .env.example .env
# .env içindeki DATABASE_URL ve JWT secret'larını doldur
npm install
npx prisma generate
npx prisma migrate dev --name init # ilk kurulum
npm run db:seed # demo kullanıcı (opsiyonel)
npm run devBackend http://localhost:3000 üzerinde çalışır.
cd clinicbook-frontend
cp .env.example .env
npm install
npm run devFrontend http://localhost:5173 üzerinde çalışır.
- E-posta:
demo@clinicbook.com - Şifre:
password123 - Booking URL:
http://localhost:5173/booking/ahmet-kaya
- controllers/ — Auth, Appointment, Patient, Booking, SessionNote, Survey, Clinic, Settings, Webhook
- routes/ — Tek dosya, manuel Zod parse → controller
- middleware/auth.ts — JWT verify
- services/
scheduler.ts— 24h/2h hatırlatma + 30dk anket tetikleyici cron'larıactivepieces.ts— Otomasyon flow webhook gönderici
- prisma/schema.prisma — User, RefreshToken, PasswordResetToken, Patient, Appointment, SessionNote, Survey, WorkingHours, BlockedDate, BookingSettings, NotificationSettings
- pages/ —
auth/(login, register, forgot, reset),dashboard/,calendar/,patients/,analytics/,settings/,booking/ - store/ — Zustand (auth, appointment, patient, theme)
- services/ —
api.ts(interceptor + otomatik refresh), domain servisler - styles/theme.css — CSS değişkenleri ile light/dark tema
- Multi-tenancy — Her kayıt = bir Klinik; tüm sorgular
userIdile izole. - Slug Sistemi — Klinisyene benzersiz slug (
ahmet-kaya). Public booking URL:/booking/{slug}. - JWT Refresh Rotation — Access (15dk) + Refresh (7gün, DB'de + rotation). 401'de axios otomatik refresh dener.
- Otomasyon — Randevu oluştur/iptal/anket olaylarında Activepieces webhook'u tetiklenir.
- 24h / 2h Hatırlatma — Scheduler cron'u onaylanmış randevular için bayraklı (idempotent) gönderim yapar.
- Tek Kullanımlık Anket Linki —
surveyTokenile public POST doğrulanır. - Şifre Sıfırlama — Token tabanlı (1 saat TTL), şifre değişince tüm session'lar revoke edilir.
JWT_ACCESS_SECRET,JWT_REFRESH_SECRET,DATABASE_URLzorunlu — yoksa server başlamaz (fail-fast).- Helmet CSP aktif (style/font için CDN whitelist'i var).
- Auth endpoint'lerine sıkı rate limit: login/register 10/dk, forgot/reset 3/15dk.
- Logo upload: mimetype whitelist + 5 MB limit.
- Survey public endpoint: yalnızca scheduler'ın ürettiği
surveyTokenile yanıtlanabilir.
# Backend
npm run dev # tsx watch
npm run build && npm start
npx prisma studio # DB tarayıcı
npx prisma migrate dev # şema değişince
npm run db:seed # demo veri
# Frontend
npm run dev
npm run build
npm run lintDetaylı satışa hazırlık planı için KlinikOtomasyon_PRD_v3.1.docx ve audit notlarına bakın. Faz 1 (stabilizasyon) bu commit'te tamamlandı; sonraki adımlar: SaaS plan + ödeme entegrasyonu, SMTP/SMS gerçek sağlayıcı, test paketi, Docker compose, CI/CD.