Skip to content

kaveeshapasan2002/City_Pet_AHMS

Repository files navigation

๐Ÿพ Pet Hospital Management System

A comprehensive full-stack web application for managing pet hospital operations, including patient records, appointments, inventory, billing, and real-time communication.

Live Demo GitHub

๐Ÿš€ Features

For Pet Owners

  • ๐Ÿ” Secure Authentication - Register and login with OTP verification
  • ๐Ÿ• Pet Records Management - Add, view, and manage pet profiles
  • ๐Ÿ“… Appointment Booking - Schedule appointments with veterinarians
  • ๐Ÿ’ฌ Real-time Messaging - Chat with hospital staff
  • ๐Ÿค– AI Chatbot - Get instant answers to common questions
  • ๐Ÿ“„ Medical History - Access complete medical records and prescriptions
  • ๐Ÿ’ฐ Invoice Management - View and download invoices

For Hospital Staff

  • ๐Ÿ‘ฅ User Management - Manage pet owners and staff accounts
  • ๐Ÿฅ Appointment Management - View and manage all appointments
  • ๐Ÿ“‹ Medical Records - Create and update pet medical records
  • ๐Ÿ’Š Inventory Tracking - Monitor medicine and supplies
  • ๐Ÿ“Š Analytics Dashboard - View hospital statistics and insights
  • ๐Ÿ›’ Purchase Requests - Handle supplier orders
  • ๐Ÿ’ณ Billing System - Generate invoices and track payments

Admin Features

  • ๐Ÿ‘ฎ Role-Based Access Control - Assign roles and permissions
  • ๐Ÿ” Security Logs - Monitor user activities
  • ๐Ÿ“ˆ Advanced Analytics - Chatbot analytics, user stats
  • โš™๏ธ System Configuration - Manage FAQs and chatbot knowledge base

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React 19.0.0 - UI library
  • React Router - Client-side routing
  • Axios - HTTP client
  • Socket.IO Client - Real-time communication
  • TailwindCSS - Styling
  • Recharts - Data visualization
  • React Icons - Icon library
  • jsPDF - PDF generation
  • React Toastify - Notifications

Backend

  • Node.js - Runtime environment
  • Express - Web framework
  • MongoDB - Database
  • Mongoose - ODM
  • Socket.IO - WebSocket server
  • JWT - Authentication
  • bcryptjs - Password hashing
  • Nodemailer - Email service
  • Twilio - SMS service
  • OpenAI - AI chatbot integration

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local or Atlas)
  • npm or yarn

Local Development Setup

  1. Clone the repository
git clone https://github.com/YOUR-USERNAME/pet-hospital-system.git
cd pet-hospital-system
  1. Install dependencies
npm run install-all

Or manually:

# Root dependencies
npm install

# Backend dependencies
cd backend
npm install

# Frontend dependencies
cd ../frontend
npm install
  1. Configure environment variables

Backend (backend/.env):

PORT=5001
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_app_password
FRONTEND_URL=http://localhost:3000
NODE_ENV=development

Frontend (frontend/.env.development):

REACT_APP_API_URL=http://localhost:5001
  1. Run the application

Option 1 - Run both servers:

npm run dev

Option 2 - Run separately:

# Terminal 1 - Backend
cd backend
npm start

# Terminal 2 - Frontend
cd frontend
npm start
  1. Access the application

๐ŸŒ Deployment

See the detailed DEPLOYMENT.md guide for step-by-step instructions to deploy to production.

Quick Deploy

  • Frontend: Vercel (recommended)
  • Backend: Render (recommended)
  • Database: MongoDB Atlas

๐Ÿ“ฑ API Documentation

Authentication Endpoints

POST   /api/auth/register        - Register new user
POST   /api/auth/verify-otp      - Verify OTP
POST   /api/auth/login           - User login
GET    /api/auth/me              - Get current user

Pet Records

GET    /pets                     - Get all pets
POST   /pets                     - Create pet record
GET    /pets/:id                 - Get pet by ID
PUT    /pets/:id                 - Update pet
DELETE /pets/:id                 - Delete pet

Appointments

GET    /appointments             - Get all appointments
POST   /appointments             - Create appointment
PUT    /appointments/:nic        - Update appointment
DELETE /appointments/:nic        - Delete appointment

Medical Records

GET    /medies/:petid            - Get medical records by pet ID
POST   /medies                   - Create medical record
PUT    /medies/:index            - Update medical record
DELETE /medies/:index            - Delete medical record

See full API documentation

๐Ÿ”’ Security Features

  • JWT-based authentication
  • Password hashing with bcryptjs
  • OTP verification for registration
  • Role-based access control (RBAC)
  • Protected routes
  • CORS configuration
  • Input validation
  • SQL injection prevention
  • XSS protection

๐Ÿงช Testing

# Backend tests
cd backend
npm test

# Frontend tests
cd frontend
npm test

๐Ÿ“Š Project Structure

pet-hospital-system/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ config/          # Database config
โ”‚   โ”œโ”€โ”€ controllers/     # Route controllers
โ”‚   โ”œโ”€โ”€ middlewares/     # Auth & admin middlewares
โ”‚   โ”œโ”€โ”€ models/          # Mongoose models
โ”‚   โ”œโ”€โ”€ routes/          # API routes
โ”‚   โ”œโ”€โ”€ services/        # Business logic
โ”‚   โ”œโ”€โ”€ utils/           # Helper functions
โ”‚   โ””โ”€โ”€ server.js        # Entry point
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ public/          # Static files
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ api/         # API calls
โ”‚       โ”œโ”€โ”€ components/  # React components
โ”‚       โ”œโ”€โ”€ context/     # Context providers
โ”‚       โ”œโ”€โ”€ pages/       # Page components
โ”‚       โ”œโ”€โ”€ services/    # Frontend services
โ”‚       โ””โ”€โ”€ utils/       # Helper functions
โ”œโ”€โ”€ DEPLOYMENT.md        # Deployment guide
โ””โ”€โ”€ README.md           # This file

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Kaveesha Athukorala

๐Ÿ™ Acknowledgments

  • Built with React, Node.js, Express, and MongoDB
  • Real-time features powered by Socket.IO
  • AI chatbot integration with OpenAI
  • UI components styled with TailwindCSS
  • Icons from React Icons

๐Ÿ“ž Support

For support, email kaveeshatech@gmail.com or create an issue in the repository.


โญ If you find this project useful, please consider giving it a star on GitHub!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages