{"id":25803212,"url":"https://github.com/brenimcode/product-api-spring-boot","last_synced_at":"2025-10-10T03:13:36.111Z","repository":{"id":253352923,"uuid":"843242678","full_name":"brenimcode/product-api-spring-boot","owner":"brenimcode","description":"RESTful API Java using the Spring Framework, features such as Spring Security, Swagger, Spring Data JPA, Spring HATEOAS, validation with JWT tokens, testing, creating a scalable and efficient application.","archived":false,"fork":false,"pushed_at":"2024-12-19T14:08:23.000Z","size":511,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-19T05:05:44.794Z","etag":null,"topics":["java","junit","jwt","postgresql","spring-boot","spring-security","sql"],"latest_commit_sha":null,"homepage":"https://product-api-spring-boot.onrender.com/swagger-ui/index.html","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brenimcode.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-16T04:51:21.000Z","updated_at":"2024-12-19T14:08:26.000Z","dependencies_parsed_at":"2024-08-19T05:29:27.156Z","dependency_job_id":"89cf11a2-4785-4959-b94c-fbe2b6206ef3","html_url":"https://github.com/brenimcode/product-api-spring-boot","commit_stats":null,"previous_names":["brenimcode/product-api-spring-boot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brenimcode/product-api-spring-boot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenimcode%2Fproduct-api-spring-boot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenimcode%2Fproduct-api-spring-boot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenimcode%2Fproduct-api-spring-boot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenimcode%2Fproduct-api-spring-boot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brenimcode","download_url":"https://codeload.github.com/brenimcode/product-api-spring-boot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brenimcode%2Fproduct-api-spring-boot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267616582,"owners_count":24116155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","junit","jwt","postgresql","spring-boot","spring-security","sql"],"created_at":"2025-02-27T17:44:30.881Z","updated_at":"2025-10-10T03:13:31.036Z","avatar_url":"https://github.com/brenimcode.png","language":"Java","readme":"# RESTful Java API | **Product Management |** Spring Boot\n\n![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge\u0026logo=openjdk\u0026logoColor=white) ![Spring Boot](https://img.shields.io/badge/spring--boot-%236DB33F.svg?style=for-the-badge\u0026logo=springboot\u0026logoColor=white) ![Maven](https://img.shields.io/badge/ApacheMaven-C71A36?logo=apachemaven\u0026logoColor=white\u0026style=for-the-badge) ![PostgreSQL](https://img.shields.io/badge/postgresql-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white) ![Hibernate](https://img.shields.io/badge/Hibernate-59666C.svg?style=for-the-badge\u0026logo=hibernate\u0026logoColor=white)\n![Swagger](https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge\u0026logo=swagger\u0026logoColor=black) ![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge\u0026logo=JSON%20web%20tokens) ![JUnit](https://img.shields.io/badge/JUnit-25A162.svg?style=for-the-badge\u0026logo=JUnit\u0026logoColor=white)\n![Postman](https://img.shields.io/badge/Postman-FF6C37?style=for-the-badge\u0026logo=postman\u0026logoColor=white)\n![Spring Security](https://img.shields.io/badge/Spring%20Security-6DB33F?style=for-the-badge\u0026logo=spring-security\u0026logoColor=white) ![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n\n## Description\n\nThis project is a **RESTful API** built with **Spring Boot**, designed for product management, offering full **CRUD** (Create, Read, Update, Delete) functionalities and other useful features. It was developed through self-learning by combining YouTube tutorials, documentation, articles, and consulting AI for quick questions and repetitive task optimization.\n\n### Key Features:\n\n- **Data Persistence**:\n    - The API uses **Spring Data JPA** for database access abstraction, enabling the use of **JpaRepository** for predefined CRUD operations and queries.\n    - The product entity is modeled with annotations such as `@Entity` and `@Table`, and the primary key is auto-generated with `@GeneratedValue(strategy = GenerationType.AUTO)`.\n    - Unique global IDs are generated using **UUID.**\n    - Configured to use a PostgreSQL database.\n- **Input Validation**:\n    - Validation is handled using **Bean Validation** annotations (e.g., `@NotNull`, `@Size`, etc.), ensuring the integrity of received data.\n    - A custom **GlobalExceptionHandler** centralizes error and exception handling.\n- **Resource Navigation**:\n    - Implements hypermedia support with **Spring HATEOAS**, adding navigational links to API resources.\n- **Authentication and Security**:\n    - **Spring Security** manages authentication and authorization, using **JWT (JSON Web Tokens)** for stateless endpoint protection.\n    - Permissions are defined in a dedicated class (`SecurityConfiguration`) with roles (`ROLE_ADMIN` and `ROLE_USER`) and token validation through a dedicated filter (`SecurityFilter`).\n    - Password hashing is implemented with **BCrypt** for secure credential storage.\n    - Only users with the **ADMIN** role can perform PUT/POST/DELETE operations.\n- **Documentation**:\n    - **Springdoc-OpenAPI**: Automatically generates OpenAPI 3.0 documentation, integrated with **Swagger UI** for interactive visualization and testing in the browser.\n- **Deployment:**\n    \n    The application is deployed on **Render**, a platform providing free web app hosting. Configured for the server and PostgreSQL database with environment variables.\n\n    - Deployed on **Render**, with PostgreSQL database and proper environment variables.\n    - **Docker Container** configured for portability and efficient execution.\n    \n    **URLs:**\n    \n    - **API Base URL:** https://product-api-spring-boot.onrender.com\n    - **Swagger UI:** https://product-api-spring-boot.onrender.com/swagger-ui/index.html\n\n### **Project Architecture:**\n\nThe project follows a **Layered Architecture**, adhering to best practices for modularity and separation of concerns:\n\n- **Controller/Resource Layer**: Manages HTTP requests and sends responses to clients.\n- **Service Layer**: Centralizes business logic for better reusability and cohesion.\n- **Repository Layer**: Handles database access using the DAO pattern with Spring Data JPA.\n- **Model and DTO Layer**: Organizes data, separating domain logic from transfer objects.\n- **Security Layer**: Implements authentication and access control using Spring Security.\n- **Exception Layer**: Centrally manages errors, providing standardized and clear responses.\n\n### **Installation and Local Execution**\n\n1. **Clone the repository:**\n    \n    ```bash\n    git clone \u003crepo-url\u003e\n    ```\n    \n2. **Set up environment variables:**\n    1. {DATASOURCE_URL}\n    2. {DATASOURCE_USERNAME}\n    3. {DATASOURCE_PASSWORD}\n3. **Run the project:**\n    \n    ```bash\n    ./mvnw spring-boot:run\n    ```\n    \n4. **Run with Docker:**\n    - Build the Docker image:\n        \n        ```bash\n        docker build -t product-api .\n        ```\n        \n    - Run the container:\n        \n        ```bash\n        docker run -p 8080:8080 product-api\n        ```\n### Visual Diagram of the Application\n\u003cp align=\"center\"\u003e\n\u003cimg \n    src=\"./diagrama_visual.png\"\n/\u003e\n\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenimcode%2Fproduct-api-spring-boot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrenimcode%2Fproduct-api-spring-boot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrenimcode%2Fproduct-api-spring-boot/lists"}