nusretzinkli/AppointmentGuard
Hastane Randevu Sistemi - .NET 8 Web API & SQL (Concurrency Control)
🏥 AppointmentGuard - N-Layer Architecture Appointment System
🌐 English
AppointmentGuard is a secure and scalable appointment management system developed using enterprise-standard N-Layer Architecture.
Vision: This project is not just a working application; it's a backend engineering study that implements Concurrency, Unit Testing, Containerization, and Clean Architecture principles.
📸 Project Preview (Demo)
1. Appointment Flow & SweetAlert2 Integration
User-friendly interface with dynamic time management and instant notifications.
| Feature | Preview |
|---|---|
| System Login | ![]() |
| Registration | ![]() |
| Create Appointment | ![]() |
| Cancel Appointment | ![]() |
| Race Condition | ![]() |
🏗 Architecture Structure (N-Layer Architecture)
The project is divided into layers according to the Separation of Concerns (SoC) principle.
- 🧱 Core Layer: Entities, DTOs, and Interfaces. No external dependencies.
- 💾 Data Layer: Database operations, Migrations, and Repository Pattern implementation.
- ⚙️ Service Layer: Business Logic, Validations (FluentValidation), and Mapping (AutoMapper).
- 🌐 API Layer: RESTful services.
- 💻 Web Layer (MVC): User interface.
🚀 Technical Features and Solutions
🔒 1. Security & Authentication
System security is configured according to industry standards.
- Authentication: Secure session management with ASP.NET Core Cookie Authentication mechanism.
- Password Hashing: User passwords are not stored as plain-text in the database; they are hashed and protected using the BCrypt algorithm.
- Authorization: Role-Based authorization infrastructure is available.
🔒 2. Race Condition Solution
When two users try to book an appointment with the same doctor simultaneously (within milliseconds), the system maintains data integrity.
- Solution: In addition to the validation layer, data consistency is guaranteed through Double-Check Locking and Try-Catch mechanism at the database commit time (
CommitAsync).
⚡ 3. Performance and Scalability
- Async/Await: All I/O operations (Database access) are made asynchronous to prevent thread blocking, providing high concurrent request capacity.
- Optimized LINQ: Database queries are optimized over
IQueryableto ensure only necessary data is fetched from the server.
🧪 4. Unit Testing
Critical business logic of the project has been tested using xUnit and Moq.
- ✅ Collision scenario verified with
RaceCondition_ShouldThrowUserFriendlyExceptiontest.
🛠 Installation and Running
You can choose one of two methods to run the project.
Option A: Quick Setup with Docker (Recommended) 🐳
You can launch the project with a single command without dealing with SQL Server installation.
- Clone the project and navigate to the main directory.
- Run this command in the terminal:
docker-compose up --build
- The application will start at http://localhost:5000.
Option B: Manual Setup (Visual Studio) 🛠
- Clone the project.
- Edit the Connection String in the
appsettings.jsonfile according to your SQL Server information. - Create the database via Package Manager Console:
Update-Database -Project AppointmentGuard.Data -StartupProject AppointmentGuard.API
- Start the project. Seed Data will be loaded automatically.
👤 Test Users (Admin/User)
The following users are pre-defined for quick testing:
| User | Password | |
|---|---|---|
| User 1 (Merve) | merve@test.com |
123456 |
| User 2 (Cemal) | cemal@test.com |
123456 |
📞 Contact & Links
🤝 Contributing
If you'd like to contribute to the project:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: Add amazing feature') - Push your branch (
git push origin feature/amazing-feature) - Create a Pull Request
⭐ Don't forget to star the project if you like it!
🇹🇷 Türkçe
AppointmentGuard, kurumsal standartlara uygun N-Katmanlı Mimari (N-Layer Architecture) kullanılarak geliştirilmiş, güvenli ve ölçeklenebilir bir randevu yönetim sistemidir.
Vizyon: Bu proje, sadece çalışan bir uygulama değil; Concurrency (Eşzamanlılık), Unit Testing, Containerization ve Clean Architecture prensiplerini uygulayan bir Backend mühendislik çalışmasıdır.
📸 Proje Önizlemesi (Demo)
1. Randevu Alma Akışı & SweetAlert2 Entegrasyonu
Kullanıcı dostu arayüz ile dinamik saat yönetimi ve anlık bildirimler.
| Özellik | Önizleme |
|---|---|
| Sisteme Giriş | ![]() |
| Kayıt Olma | ![]() |
| Randevu Alma | ![]() |
| Randevu İptali | ![]() |
| Race Condition | ![]() |
🏗 Mimari Yapı (N-Layer Architecture)
Proje, Sorumlulukların Ayrılığı (SoC) prensibine uygun olarak katmanlara ayrılmıştır.
- 🧱 Core Layer: Entity'ler, DTO'lar ve Arayüzler (Interfaces). Dışa bağımlılığı yoktur.
- 💾 Data Layer: Veritabanı işlemleri, Migrations ve Repository Pattern implementasyonu.
- ⚙️ Service Layer: İş mantığı (Business Logic), Validasyonlar (FluentValidation) ve Mapping (AutoMapper).
- 🌐 API Layer: RESTful servisler.
- 💻 Web Layer (MVC): Kullanıcı arayüzü.
🚀 Teknik Özellikler ve Çözümler
🔒 1. Güvenlik (Security & Auth)
Sistem güvenliği endüstri standartlarına uygun olarak yapılandırılmıştır.
- Authentication: ASP.NET Core Cookie Authentication mekanizması ile güvenli oturum yönetimi.
- Password Hashing: Kullanıcı şifreleri veritabanında düz metin (plain-text) olarak saklanmaz; BCrypt algoritması ile hash'lenerek korunur.
- Authorization: Role-Based (Rol Bazlı) yetkilendirme altyapısı mevcuttur.
🔒 2. Race Condition (Yarış Durumu) Çözümü
Aynı anda (milisaniyeler içinde) aynı doktora randevu almaya çalışan iki kullanıcı olduğunda, sistem veri bütünlüğünü korur.
- Çözüm: Validasyon katmanına ek olarak, veritabanı kayıt anında (
CommitAsync) Double-Check Locking ve Try-Catch mekanizması ile veri tutarlılığı garanti edilir.
⚡ 3. Performans ve Ölçeklenebilirlik
- Async/Await: Tüm I/O operasyonları (Veritabanı erişimi) asenkron yapılarak thread bloklanması önlenmiş, yüksek eşzamanlı istek kapasitesi sağlanmıştır.
- Optimized LINQ: Veritabanı sorguları
IQueryableüzerinden optimize edilerek sunucuya sadece gerekli verilerin çekilmesi sağlanmıştır.
🧪 4. Unit Testing (Birim Testleri)
Projenin kritik iş mantıkları xUnit ve Moq kullanılarak test edilmiştir.
- ✅
RaceCondition_ShouldThrowUserFriendlyExceptiontesti ile çakışma senaryosu doğrulanmıştır.
🛠 Kurulum ve Çalıştırma
Projeyi çalıştırmak için iki yöntemden birini seçebilirsiniz.
Seçenek A: Docker ile Hızlı Kurulum (Önerilen) 🐳
SQL Server kurulumuyla uğraşmadan tek komutla projeyi ayağa kaldırabilirsiniz.
- Projeyi klonlayın ve ana dizine gidin.
- Terminalde şu komutu çalıştırın:
docker-compose up --build
- Uygulama http://localhost:5000 adresinde yayına başlayacaktır.
Seçenek B: Manuel Kurulum (Visual Studio) 🛠
- Projeyi klonlayın.
appsettings.jsondosyasındaki Connection String'i kendi SQL Server bilginize göre düzenleyin.- Package Manager Console üzerinden veritabanını oluşturun:
Update-Database -Project AppointmentGuard.Data -StartupProject AppointmentGuard.API
- Projeyi başlatın. Seed Data otomatik yüklenecektir.
👤 Test Kullanıcısı (Admin/User)
Hızlı test için aşağıdaki kullanıcılar tanımlı gelmektedir:
| Kullanıcı | Şifre | |
|---|---|---|
| User 1 (Merve) | merve@test.com |
123456 |
| User 2 (Cemal) | cemal@test.com |
123456 |
📞 İletişim & Bağlantılar
🤝 Katkıda Bulunma
Projeye katkıda bulunmak isterseniz:
- Repository'yi fork edin
- Yeni bir branch oluşturun (
git checkout -b feature/amazing-feature) - Değişikliklerinizi commit edin (
git commit -m 'feat: Add amazing feature') - Branch'inizi push edin (
git push origin feature/amazing-feature) - Pull Request oluşturun
⭐ Projeyi beğendiyseniz yıldız vermeyi unutmayın!





