DoctorEverywhere Backend is an ASP.NET Core Web API backend for a location-aware doctor/patient appointment platform. It exposes REST endpoints for authentication, doctor/patient profiles, availability, appointments, reviews, and analytics.
- Register as a Patient or Doctor in a single request (creates both Identity user + domain profile atomically)
- JWT Bearer tokens with role claims (
Patient,Doctor,Manager) - Tokens expire after 30 minutes;
- Search doctors by medical specialty (10 specialties supported)
- View full doctor profiles including office location (name, address, city, coordinates)
- Doctors define weekly working schedules (day-of-week + shift start/end times)
- Patients query available hour slots for any given doctor on a specific date
- Patients request appointments against a doctor's available slot
- Appointment status workflow:
Pending → Confirmed / Rejected / Cancelled - Role-enforced state transitions (patients can only cancel; doctors cannot cancel)
- Appointment creation publishes a RabbitMQ message to a doctor-specific queue
- Doctors receive the queued notification alongside their appointment list
- Patients leave a rating + comment for a doctor (one review per patient/doctor pair — enforced by unique DB index)
- Viewable by Doctors, Patients, and Managers
- Summary report: appointments by status count, demand by specialty, doctor review statistics
- Deleting a patient account: appointment records auto-cancelled, review names replaced with
"Deleted Patient" - Deleting a doctor account: their pending appointments auto-rejected
- Doctors and Patients use a global query filter on
IsActivefor soft-delete
| Name |
|---|
| Maria-Eleni Kosma |
| Dimitrios Loukrezis |
| Periklis Tsaousis |
| Marios Tzanos |
| Layer | Technology |
|---|---|
| Framework | ASP.NET Core 10.0 Web API + Controllers |
| ORM | Entity Framework Core 10.0 (Code-First) |
| Database | Microsoft SQL Server 2022 |
| Identity | ASP.NET Core Identity + Roles |
| Auth | JWT Bearer (Microsoft.AspNetCore.Authentication.JwtBearer) |
| Messaging | RabbitMQ 3.x (via RabbitMQ.Client 7.x) |
| API Docs | Scalar UI (OpenAPI v3) |
| Fake Data | Bogus (for development seeding) |
| Containers | Docker Compose |
DoctorEverywhere_Backend/
├── .github/ # GitHub Actions workflows
├── DoctorEverywhere/ # Main ASP.NET Core project
│ ├── Controllers/ # HTTP API surface — routing, auth attributes, status codes
│ │ ├── AuthController.cs # Register patient/doctor, login
│ │ ├── DoctorController.cs # Doctor profile & search
│ │ ├── PatientController.cs # Patient profile management
│ │ ├── AppointmentController.cs# Full appointment lifecycle + RabbitMQ integration
│ │ ├── AvailabilityController.cs # Working schedule management
│ │ ├── ReviewController.cs # Doctor reviews
│ │ └── AnalyticsController.cs # Manager analytics summary
│ │
│ ├── Services/ # Business logic layer
│ │ ├── Interfaces/ # Service contracts (registered in DI)
│ │ ├── AuthService.cs
│ │ ├── DoctorService.cs
│ │ ├── PatientService.cs
│ │ ├── AppointmentService.cs
│ │ ├── AvailabilityService.cs
│ │ ├── ReviewService.cs
│ │ └── AnalyticsService.cs
│ │
│ ├── Domain/ # EF Core entity models
│ │ ├── ApplicationUser.cs # ASP.NET Identity user (links to domain profiles)
│ │ ├── Doctor.cs
│ │ ├── Patient.cs
│ │ ├── Manager.cs
│ │ ├── Office.cs # Doctor's clinic/office details + coordinates
│ │ ├── Appointment.cs
│ │ ├── Review.cs
│ │ ├── WorkingSchedule.cs # Doctor's weekly shift schedule
│ │ └── Message.cs # RabbitMQ-persisted notification messages
│ │
│ ├── DTOs/ # API request/response data transfer objects
│ ├── Enums/ # Specialty, AppointmentStatus, DayOfWeekOption
│ ├── Mappings/ # Entity → DTO extension methods (e.g., Doctor)
│ ├── Messaging/ # RabbitMQ infrastructure
│ │ ├── Configuration/ # RabbitMqSettings (bound from appsettings.json)
│ │ ├── DTOs/ # Messaging-specific DTOs
│ │ ├── Interfaces/ # IRabbitMqProducerService, IRabbitMqConsumerService
│ │ └── Services/ # Producer & Consumer implementations (singletons)
│ ├── Migrations/ # EF Core database migrations
│ ├── Exceptions/ # Custom exception types (e.g., EntityNotFoundException)
│ ├── Documentation/ # Developer reference docs
│ │ ├── api_endpoints.md # Full endpoint map with request/response examples
│ │ ├── api_schemas.md # Request/response payload schemas & enum tables
│ │ └── architectural_patterns.md # Patterns and conventions used in this codebase
│ ├── ApplicationDbContext.cs # EF Core DbContext with relationships & role seeding
│ ├── DbSeeder.cs # Seeds default Manager user on startup
│ ├── FakeDataSeeder.cs # Seeds fake Doctors & Patients (dev only, uses Bogus)
│ ├── Program.cs # App entry point: DI, middleware, pipeline
│ ├── appsettings.json # Connection strings, JWT config, RabbitMQ config
│ └── docker-compose.yml # SQL Server + RabbitMQ local services
└── README.md
| Tool | Version | Notes |
|---|---|---|
| .NET SDK | 10.0+ | Required to build and run the API |
| Docker Desktop | Any recent | For SQL Server + RabbitMQ containers |
| EF Core CLI | 10.0+ | For applying migrations (dotnet tool install -g dotnet-ef) |
git clone https://github.com/your-org/DoctorEverywhere_Backend.git
cd DoctorEverywhere_BackendCreate a .env file in the DoctorEverywhere/ directory (next to docker-compose.yml) with the following variables:
SQL_PASSWORD=YourStrong!Passw0rd
RABBIT_USER=admin
RABBIT_PASS=admin123Important
The SQL_PASSWORD must meet SQL Server's password complexity requirements (uppercase, lowercase, digit, special character, min 8 chars).
Then verify or update the connection string in appsettings.json if needed:
"ConnectionStrings": {
"DoctorEverywhere": "Server=localhost,1433;Initial Catalog=DoctorEverywhere;User=sa;Password=YourStrong!Passw0rd;Trust Server Certificate=true;"
}JWT and RabbitMQ settings are also configured in appsettings.json:
"Jwt": {
"Key": "<your-256-bit-secret>",
"Issuer": "DoctorEverywhereAPI",
"Audience": "DoctorEverywhereClients",
"ExpiresInMinutes": 30
},
"RabbitMq": {
"HostName": "localhost",
"Port": 5672,
"UserName": "admin",
"Password": "admin123",
"VirtualHost": "/",
"QueueName": "appointments"
}From the DoctorEverywhere/ directory (where docker-compose.yml lives):
docker compose up -dThis starts:
- SQL Server 2022 →
localhost:1433 - RabbitMQ → AMQP on
localhost:5672, Management UI onhttp://localhost:15672
From the DoctorEverywhere/ directory:
# Restore dependencies
dotnet restore
# Apply database migrations
dotnet ef database update
# Start the API
dotnet runThe API will be available at https://localhost:{port}. In Development mode, the interactive Scalar UI is served at:
https://localhost:{port}/scalar/v1
Tip
On first startup, DbSeeder and FakeDataSeeder automatically create a default Manager user and a set of sample Doctors and Patients so you can explore the API immediately.
| Command | Description |
|---|---|
dotnet restore |
Restore NuGet packages |
dotnet build |
Compile the project |
dotnet run |
Start the development server |
dotnet ef database update |
Apply pending EF Core migrations |
dotnet ef migrations add <Name> |
Create a new migration |
| Method | Route | Role | Description |
|---|---|---|---|
POST |
/api/auth/register/patient |
Public | Register a new patient |
POST |
/api/auth/register/doctor |
Public | Register a new doctor |
POST |
/api/auth/login |
Public | Login and receive JWT token |
GET |
/api/doctor/{id} |
Doctor, Patient | Get doctor profile by ID |
GET |
/api/doctor/search?specialty={int} |
Patient | Search doctors by specialty |
GET |
/api/doctor/me |
Doctor | Get own doctor profile |
DELETE |
/api/doctor/delete |
Doctor | Delete own account |
GET |
/api/patient |
Patient | List all patients |
GET |
/api/patient/{id} |
Patient | Get patient by ID |
GET |
/api/patient/my |
Patient | Get own patient profile |
DELETE |
/api/patient/delete |
Patient | Delete own account |
POST |
/api/appointment/request?doctorId={int} |
Patient | Request an appointment |
GET |
/api/appointment/my |
Doctor, Patient | Get own appointments (+ RabbitMQ notification for doctors) |
GET |
/api/appointment/{id} |
Doctor, Patient | Get appointment by ID |
PATCH |
/api/appointment/{id}/status |
Doctor, Patient | Update appointment status |
POST |
/api/availability/slots |
Doctor | Create availability slot |
GET |
/api/availability/slots |
Doctor | Get own availability slots |
GET |
/api/availability/doctor/{id}?date={DateTime} |
Patient | Get available hours for a doctor |
POST |
/api/review/{doctorId} |
Patient | Leave a review for a doctor |
GET |
/api/review/{doctorId} |
Doctor, Patient, Manager | Get reviews for a doctor |
GET |
/api/analytics/summary |
Manager | Get analytics summary |