A full-stack web application for managing patient records, appointments, and real-time notifications in a hospital setting. Built with PostgreSQL, Node.js (Express), and React, the project features schema validation with Zod, sleek UI components via shadcn/ui, and real-time updates using Socket.IO.
- Features
- Tech Stack
- Prerequisites
- Installation
- Environment Variables
- Running the Application
- API Endpoints
- Real-Time Notifications
- Form Validation & State Management
- Contributing
- License
- Patient Management: Create, view, edit, and delete patient profiles, including demographics, contact information, medical history, and next of kin.
- Appointment Scheduling: Full CRUD support for appointments, with filters for active, past, and upcoming bookings.
- Real-Time Notifications: Get instant updates via WebSockets (Socket.IO) whenever a new appointment is created.
- Responsive and Accessible UI: Designed with Tailwind CSS and shadcn/ui components for a seamless user experience.
- Form Validation: Enhanced form handling with React Hook Form and Zod, providing robust client-side validation.
- State Management: Powerful centralized data stores (via Context API) for patients, doctors, and appointments with optimized re-rendering.
-
Frontend:
- React (v18+)
- React Router v6
- React Hook Form
- Zod +
@hookform/resolvers/zod - shadcn/ui
- Tailwind CSS
-
Backend:
- Node.js + Express
- PostgreSQL
pg(node-postgres)- Socket.IO
-
Utilities & Tools:
- Axios (HTTP client)
- Sonner (toast notifications)
- date-fns (date formatting)
- dotenv (environment configuration)
- Node.js ≥ 16.0
- PostgreSQL ≥ 12.0
- npm (comes with Node.js)
- Git
-
Clone the repository
git clone https://github.com/d3uceY/Lifeville-Hospital-management-system.git cd lifeville -
Install dependencies
# Backend cd server npm install # Frontend cd ../ npm install
Create a .env file inside the server/ directory with:
VITE_API_URL=http://localhost:3000Add any additional variables as needed (e.g., database URL, JWT secrets).
-
Backend
cd server npm start -
Frontend
npm run dev
Visit http://localhost:5173 (or the port Vite displays in your terminal) to use the application.
- Backend: The server publishes
newAppointmentevents viaSocket.IO, utilizing PostgreSQL triggers or direct emission after insertion. - Frontend:
- Connects to the WebSocket server (
socket.io-client) when the app initializes. - A notifications feature displays a bell icon with unread appointment count and opens a dropdown with details when clicked.
- Connects to the WebSocket server (
- Uses
React Hook FormwithzodResolverfor schemas defined in Zod. - Nested and controlled components utilize
FormProvideranduseFormContext()for seamless form data flow. - Controlled inputs (e.g., Select dropdowns) are managed via
Controller. - Prefilling form data after fetches is handled using
reset()insideuseEffect.
We welcome contributions! To collaborate:
- Fork the repository
- Create a feature branch (
git checkout -b feature-name) - Make your changes
- Submit a pull request explaining what you changed and why
Distributed under the MIT License. See LICENSE for full details.