Skip to content

j2devs/clinicbook

Repository files navigation

✚ ClinicBook — Klinik Otomasyon Sistemi (v3.1)

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.

🚀 Teknoloji Stack'i

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


🛠 Kurulum

0. Gerekenler

  • Node.js ≥ 20
  • PostgreSQL ≥ 14 (lokal veya Docker)

1. Backend

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 dev

Backend http://localhost:3000 üzerinde çalışır.

2. Frontend

cd clinicbook-frontend
cp .env.example .env
npm install
npm run dev

Frontend http://localhost:5173 üzerinde çalışır.

3. Demo Giriş (seed sonrası)

  • E-posta: demo@clinicbook.com
  • Şifre: password123
  • Booking URL: http://localhost:5173/booking/ahmet-kaya

📂 Proje Yapısı

Backend (/src)

  • 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

Frontend (/src)

  • 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

🔑 İş Akışları

  1. Multi-tenancy — Her kayıt = bir Klinik; tüm sorgular userId ile izole.
  2. Slug Sistemi — Klinisyene benzersiz slug (ahmet-kaya). Public booking URL: /booking/{slug}.
  3. JWT Refresh Rotation — Access (15dk) + Refresh (7gün, DB'de + rotation). 401'de axios otomatik refresh dener.
  4. Otomasyon — Randevu oluştur/iptal/anket olaylarında Activepieces webhook'u tetiklenir.
  5. 24h / 2h Hatırlatma — Scheduler cron'u onaylanmış randevular için bayraklı (idempotent) gönderim yapar.
  6. Tek Kullanımlık Anket LinkisurveyToken ile public POST doğrulanır.
  7. Şifre Sıfırlama — Token tabanlı (1 saat TTL), şifre değişince tüm session'lar revoke edilir.

🛡 Güvenlik Notları

  • JWT_ACCESS_SECRET, JWT_REFRESH_SECRET, DATABASE_URL zorunlu — 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 surveyToken ile yanıtlanabilir.

🧪 Yararlı Komutlar

# 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 lint

📌 Yol Haritası

Detaylı 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages