VirtualPet is the final assignment of a bootcamp held at the IT Academy of Barcelona Activa. The goal of the project was to develop a full-stack application divided into two parts: a backend built with Spring Boot and a frontend created using an AI selected to meet the project's needs and characteristics. You can find the frontend repository here. The application combines technical knowledge and creativity to deliver an interactive experience.
VirtualPet is a web application that allows users to manage and play with virtual pets. The backend handles key functionalities such as JWT-based authentication, pet management, and specific features like weapon changes tailored to pets of "StarWars" and "LordRings" types. Users can perform a variety of actions, including:
- Registering and logging into their accounts.
- Creating, updating, and deleting virtual pets.
- Viewing and managing their pet's attributes.
- Changing weapons for specific pets based on predefined rules.
The backend ensures secure user management and provides robust APIs for seamless integration with the frontend.
- Authentication and authorization with JWT.
- User management.
- Creation, update, and deletion of virtual pets.
- Weapon changes for pets with specific rules based on their type.
- Global exception handling.
- Java 17 or higher
- Maven 3.8.0 or higher
- MySQL 8.0 or higher
-
Clone the repository:
git clone https://github.com/paumaneja/5.2-Spring_Framework_Advanced.VirtualPet_with_FrontEnd.git cd VirtualPet
-
Configure the database:
- Create a MySQL database named
virtualpetdb
. - Update the
src/main/resources/application.properties
file with your MySQL credentials:spring.datasource.url=jdbc:mysql://localhost:3306/virtualpetdb spring.datasource.username=your_user spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update
- Create a MySQL database named
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Access the backend: The application will be available at
http://localhost:8080
.
- POST /auth/register: Register a new user.
- POST /auth/login: Log in and obtain a JWT token.
- POST /create: Crear una nova mascota.
- GET /getPetsByOwner: Obtenir totes les mascotes d'un propietari.
- GET /getAllPets: Obtenir totes les mascotes.
- GET /getPet/{id}: Obtenir els detalls d'una mascota específica.
- PUT /{id}: Actualitzar la informació d'una mascota.
- DELETE /{id}: Eliminar una mascota.
src/main/java
: Contains the main source code.controller
: Handles HTTP requests.service
: Implements business logic.repository
: Interacts with the database.model
: Contains the entities.config
: Application configurations (security, CORS, etc.).auth
: Authentication-related classes.exception
: Custom error handling.
src/main/resources
: Includes configuration files.
If you want to contribute to the project:
- Fork the repository.
- Create a branch for your feature or bug fix.
- Submit a pull request with a detailed description.