Care for Every Paw! Visit Website
HappyPaws is a full-stack web application developed using React and Spring Boot, based on the modern Spring PetClinic architecture. The project demonstrates real-world enterprise application development practices such as layered architecture, RESTful APIs, database persistence, and role-based security.
This project is submitted as a Final Year B.Tech project for the Computer Science & Machine Learning (CSM) program at SVCET, Chittoor.
–
The traditional Spring PetClinic application mainly focuses on backend concepts and does not reflect modern enterprise-level development. HappyPaws enhances this by integrating a React-based frontend with a Spring Boot backend, making it closer to a production-oriented full-stack application.
The system is designed to manage veterinary clinic operations including owners, pets, visits, and veterinarians through a centralized and structured platform.
The application follows a Client–Server Architecture model:
Project Report (PDF): Click here to open final year project pdf
Dr. Pet Online 🔗 Open Website
Supertails Clinic 🔗 Open Website
HappyPaws demonstrates a modern full-stack web application using React and Spring Boot. The project effectively bridges academic learning with industry-level development practices by showcasing clean architecture, structured design, and real-world application workflows.
Database Schema: clinic
Database Engine: MySQL 8.0+
Management Tool: MySQL Workbench
Before starting, ensure you have the following installed and ready:
3306)database/Dump folder is present in your project directory.
C:\Users\HP\Desktop\HappyPaws\database\DumpFollow these steps to restore the clinic database from the project dump files.
Local instance MySQL).🔘 Import from Dump Project Folder
... button and browse to your project’s dump folder:
.../HappyPaws/database/Dumpclinic.
clinic exists: Select it.clinic is MISSING:
clinic as the name.clinic is selected in the dropdown.clinic.To verify the database is set up correctly:
clinic $\rightarrow$ Tables.pets (or any table) $\rightarrow$ Select Rows - Limit 1000.If you make changes to the database and want to save a new backup:
clinic..../HappyPaws/database/Dump folder.| Error | Cause | Solution |
|---|---|---|
| ERROR 1049: Unknown database ‘clinic’ | The database schema has not been created yet. | See Step 3: Click the New… button to create the clinic schema first. |
| Dump file not found / Access Denied | The tool is looking for a single .sql file but you provided a folder. |
In Step 2, ensure you selected “Import from Dump Project Folder”. |
| Table ‘clinic.xyz’ doesn’t exist | You imported data but not the table structure. | Ensure Dump Structure and Data is selected in the dropdown menu. |
| Connection Refused | MySQL Server is not running. | Open Services (Windows) and start the MySQL80 service. |
Welcome to the backend API for HappyPaws PetClinic. This system is built with Spring Boot and features a secure, robust authentication system using Spring Security and JSON Web Tokens (JWT).
It serves as the foundation for the PetClinic application, managing Users (Admins, Vets, Owners), Pets, and medical history.
ADMIN, VET, OWNER).The API is secured by default. To interact with it, you must Login first to get a “Key” (Token), and then use that Key to access data.
Use these credentials to test the system immediately or create new Vets:
admin@happypaws.comadmin123 (or the password you set during registration)This step proves your identity and provides you with a JWT Token.
POST /api/auth/loginhttp://localhost:8082/api/auth/loginSteps:
{
"email": "admin@happypaws.com",
"password": "admin123"
}
eyJ... is your Token.Sample Response:
{
"role": "ROLE_ADMIN",
"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBoYXBweXBhd3MuY29tIiwiaWF0IjoxNzY3ODUwNTA5LCJleHAiOjE3Njc4ODY1MDl9.qtR15YjS4HgPA56mjWp56NRFcy3VVXzX6KoTm1EtVc8"
}
Once you have the token, you can access locked pages (like Pets, Owners, Vets).
GET /api/pets (or other protected routes like /api/owners/me)http://localhost:8082/api/petsSteps:
Note: If you get a
403 Forbiddenerror, your token may be missing, expired, or you don’t have the correct Role (e.g., trying to access Admin routes as an Owner).
We encountered and solved several real-world challenges while building this backend. Here is how we fixed them:
OWNER and ADMIN. However, Spring Security’s hasRole() method automatically adds a ROLE_ prefix, causing it to look for ROLE_OWNER. This caused valid users to get 403 Forbidden errors even with correct tokens.@PreAuthorize("hasRole('OWNER')") and ensured our token generation logic aligns with Spring’s expectations by issuing tokens that include the prefix (e.g., ROLE_OWNER).user_id foreign key to the owners and vets tables.findByUserId method in our Repositories.OwnerController and VetController to automatically link new profiles to the authenticated user’s email upon creation./api/owners/5), which allows users to guess other IDs and see private data./api/owners/me endpoint. Instead of asking for an ID, this endpoint looks at the Security Context of the logged-in user, extracts their ID securely, and returns only their own profile.This project follows a standard layered architecture:
config/SecurityConfig.java: The “Gatekeeper”. Defines which pages are public (Register/Login) and which are private. It also configures CORS and Session Management.controller/AuthController.java: Handles Login and Registration requests.controller/OwnerController.java & VetController.java: Protected endpoints that use PreAuthorize to enforce role checks.util/JwtUtils.java: The “Machine” that generates and validates tokens.filter/JwtAuthenticationFilter.java: The “Guard” that checks every single incoming request for a valid Bearer Token.service/CustomUserDetailsService.java: Loads user data from the database to verify passwords during login.Common errors you might face while testing:
| Error | Cause | Solution |
|---|---|---|
| 403 Forbidden (Login) | Wrong password or email. | Check your JSON body for typos. Register the user if they don’t exist. |
| 403 Forbidden (Data) | Role Mismatch or Missing Token. | Ensure you are using the correct Token (Admin vs Owner). Check SecurityConfig. |
| 405 Method Not Allowed | Wrong Request Type. | Check if you are using GET instead of POST (or vice versa). |
| 400 Bad Request | Missing fields or duplicates. | Check if the email is already registered. |
| ECONNREFUSED | Server is down. | Restart the Spring Boot application. |
application.properties with your MySQL database details.mvn spring-boot:run
http://localhost:8082##🖥️ How Your React Frontend Will Use This Now your React code becomes super simple:
Hypothetical React Code
handleLogin(response) {
localStorage.setItem('token', response.token); // Save the key
if (response.role === 'ROLE_ADMIN') {
navigate('/admin-dashboard'); // Redirect to secret Admin area
} else if (response.role === 'ROLE_VET') {
navigate('/vet-portal'); // Redirect to Vet area
} else {
navigate('/my-pets'); // Redirect to Owner area
}
}
This document describes how each frontend page connects to backend APIs and its purpose.
| Page Name | Who sees it? | API Used | Purpose |
|---|---|---|---|
| Landing Page | Everyone | None (Static) | Marketing, “Get Started” button, Clinic Info |
| Login / Register | Everyone | POST /auth/login | Authenticate users & get Token |
| Owner Dashboard | Owners | GET /owners/me, GET /pets | View My Profile and My Pets list |
| Pet Details | Owners | GET /pets/{id}, GET /visits | See specific pet’s medical history |
| Add Pet Form | Owners | POST /pets | Register a new pet |
| Admin Dashboard | Admins | GET /vets, POST /vets | Hire new Vets, View all Owners |
| Vet Dashboard | Vets | GET /visits | See upcoming appointments/patients |
This is the Machine Learning microservice for the HappyPaws Pet Care platform. It provides a real-time AI “Brain” that connects your React frontend to a custom-trained medical model.
Ensure you have Python 3.11 or higher installed.
Open your terminal in the ml_service directory and run:
pip install flask flask-cors pandas scikit-learn numpy
⚠️ Note : Team Update the process of running and importing as Guide to Help!.