How keval2609/hospital-apointment-api works
Hospital Appointment API is a FastAPI service for JWT authentication and role-controlled user, doctor, and patient profile management; the README does not describe appointment-booking endpoints. Requests enter the versioned API, pass through route handlers and business services, then access PostgreSQL through repositories and SQLAlchemy. Authentication also uses password/JWT security utilities and a token blacklist. The README documents pagination, filtering, validation, structured errors, and request logging. Service and route source was not sampled, so detailed per-operation wiring is intentionally omitted.
Main entry points: router.py v1 router · user_repository.py User repository · main.py FastAPI app · schemas Request and response schemas
Components 23
Application runtime
- FastAPI app
app/main.py - Request middleware
app/middleware.py - Exception handlers
app/exception_handlers.py - Dependency wiring
app/dependencies.py
HTTP API
- v1 router
app/api/v1/router.py - Auth routes
app/api/v1/auth.py - User routes
app/api/v1/users.py - Doctor routes
app/api/v1/doctors.py - Patient routes
app/api/v1/patients.py - Request and response schemas
app/schemas
Business services
- Authentication service
app/services/auth_service.py - User service
app/services/user_service.py - Doctor service
app/services/doctor_service.py - Patient service
app/services/patient_service.py
Persistence
- User repository
app/repositories/user_repository.py - Doctor repository
app/repositories/doctor_repository.py - Patient repository
app/repositories/patient_repository.py - Token blacklist repository
app/repositories/token_blacklist_repository.py - ORM models
app/models - Async database sessions
app/database.py
Security and responses
- JWT and password security
app/core/security.py
Other components
- API client
- PostgreSQL
Connections 25
- API client → FastAPI app: sends requests
- FastAPI app → Request middleware: registers
- FastAPI app → Exception handlers: registers
- FastAPI app → v1 router: includes
- v1 router → Auth routes: dispatches
- v1 router → User routes: dispatches
- v1 router → Doctor routes: dispatches
- v1 router → Patient routes: dispatches
- Auth routes → Request and response schemas: validates with
- User routes → Request and response schemas: validates with
- Doctor routes → Request and response schemas: validates with
- Patient routes → Request and response schemas: validates with
- Authentication service → User repository: uses
- Authentication service → Token blacklist repository: uses
- Authentication service → JWT and password security: creates and verifies tokens
- Doctor service → Doctor repository: uses
- Doctor service → User repository: checks users
- Patient service → Patient repository: uses
- Patient service → User repository: checks users
- User service → User repository: uses
- User repository → ORM models: queries
- Doctor repository → ORM models: queries
- Patient repository → ORM models: queries
- Token blacklist repository → ORM models: queries
- Async database sessions → PostgreSQL: opens sessions