How dilansriyantha/clinic-management-system works
Project Type & Purpose
• This is a full-stack, desktop-enabled Clinic Management System (CMS) comprising:
• A React/TypeScript frontend (in “frontend/”) wrapped in Electron (root index.html, main.js, preload.js)
• A Spring Boot Java backend (“backend/”) exposing REST endpoints
• A MySQL database (“database/” + docker-compose.yml)
• Supporting utilities as separate packages: InvoiceGenerator, PrintJobHandler, BackupScheduler
High-Level File Structure & Architectural Patterns
• Top-level:
• InvoiceFiles/ folder for storing generated PDF invoices
• backend/: Spring Boot monolith following layered (Controller → Service → Repository → Model) MVC
• database/: Dockerfile + init SQL
• docker-compose.yml: orchestrates backend + database (and can include other services)
• frontend/: Vite-powered React app + Electron bootstrap
• packages/: three auxiliary tools (Java jar, .NET executables, Node wrappers)
• Patterns:
• Monolithic backend exposing REST + JWT security
• Frontend-backend separation via HTTP/S API
• Electron for desktop shell
• External “micro-tools” invoked via Node scripts or CLI
README Insights
• Core modules: Patients, Appointments, Clinics, Prescriptions, Invoices, Pharmacy stock, Schedules, Users, Dashboards
• Tech stack: Java 17+, Spring Boot, MySQL, React/TypeScript, Electron, .NET, Java CLI tools, Node wrappers
• Key non-functional: Role-based access, local backup scheduling, PDF invoice generation, print job handling
Main Components
a. Desktop Client (Electron)
• Shell (main.js, preload.js)
• React SPA (served from /frontend)
• Local IPC / HTTP bridge to backend and utilities
b. API Layer (Spring Boot)
• Controllers (e.g., AuthController, AppointmentController, etc.)
• Services (business logic)
• Repositories → MySQL DB
• Security (JwtAuthFilter, SecurityConfig)
c. Database
• MySQL container (init.sql)
d. File Storage
• InvoiceFiles/ directory for PDFs
e. External Tools
• InvoiceGenerator (Java JAR + Node API wrapper)
• PrintJobHandler (C# executable + Node API wrapper)
• BackupScheduler (.NET console app)
f. Docker Compose
• Orchestration of backend, database (and potentially other micro-tools)
Interactions & Data Flows
• User clicks in Electron UI → React → HTTP(S) to Spring Boot REST endpoints
• Spring Boot → CRUD on MySQL (via JPA Repositories)
• For invoice creation: Backend calls the InvoiceGenerator API (local microservice or CLI) → writes PDF to InvoiceFiles/
• For printing: Backend or Electron UI invokes PrintJobHandler → sends PDF to printer
• BackupScheduler runs on schedule → dumps DB → pushes to cloud/local backup
• JWT issued by AuthService → sent in HTTP header for protected endpoints
Architectural Patterns & Principles
• Layered architecture in backend (Controller → Service → Repository → Model)
• Separation of concerns: UI vs. API vs. Persistence vs. Utilities
• Use of JWT for stateless authentication
• Electron for desktop bundling of web UI
• Docker Compose for environment consistency
• CLI-based micro-tools orchestrated via Node wrappers