{"id":34619084,"url":"https://github.com/bilalvdemir/product-management","last_synced_at":"2026-04-20T08:31:57.985Z","repository":{"id":318848008,"uuid":"1076086709","full_name":"bilalvdemir/product-management","owner":"bilalvdemir","description":"Product Management Service built with Spring Boot and structured using Layered Architecture with Domain-Driven Design (DDD) concepts. Provides REST APIs for creating, updating, and retrieving different product types.","archived":false,"fork":false,"pushed_at":"2025-10-15T08:26:54.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-15T23:07:16.831Z","etag":null,"topics":["ddd-architecture","factory-pattern","hibernate-jpa","java","layered-architecture","micrometer","prometheus","resillience4j","spring-boot","unit-test","validation"],"latest_commit_sha":null,"homepage":"","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/bilalvdemir.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-14T11:39:58.000Z","updated_at":"2025-10-15T08:26:57.000Z","dependencies_parsed_at":"2025-10-16T18:49:40.212Z","dependency_job_id":"d0a48727-6787-41ff-8b16-a9fa65c36c36","html_url":"https://github.com/bilalvdemir/product-management","commit_stats":null,"previous_names":["bilalvdemir/product-management"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bilalvdemir/product-management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilalvdemir%2Fproduct-management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilalvdemir%2Fproduct-management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilalvdemir%2Fproduct-management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilalvdemir%2Fproduct-management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bilalvdemir","download_url":"https://codeload.github.com/bilalvdemir/product-management/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bilalvdemir%2Fproduct-management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32039971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["ddd-architecture","factory-pattern","hibernate-jpa","java","layered-architecture","micrometer","prometheus","resillience4j","spring-boot","unit-test","validation"],"created_at":"2025-12-24T14:58:30.444Z","updated_at":"2026-04-20T08:31:57.972Z","avatar_url":"https://github.com/bilalvdemir.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Product Management Service\n\nThis project is a small Java Spring Boot application for managing products.  \nUsers can add, update, delete, and get products using REST API.  \nThe system can handle different product types like **Books**, **Courses**, and **Magazines**.\n\n---\n\n## Features\n\n- **Product Management**  \n  Create, read, update, and delete products with Rest API.\n\n- **Product Types**\n    - Book\n    - Course\n    - Magazine\n\n- **Search and Filter**  \n  Find products by title or keyword, and apply pagination or sorting for refined results.\n\n- **Validation and Error Handling**  \n  All inputs are validated before saving.  \n  Errors return clear messages to the client.\n\n---\n\n## Architecture and Design Choices\n\nThis project is built using **Layered Architecture** with **Domain-Driven Design (DDD)** principles.  \nIt is not a full **Hexagonal Architecture**, but it follows a similar idea.  \nLayers are separated and communicate through clear interfaces (ports).  \nThis helps keep the codebase clean, easy to maintain, and extend in the future.\n\n### Main Technologies and Concepts\n\n- **Spring Boot 3 \u0026 Java 21**  \n  Used as the main framework for creating REST APIs, managing dependencies, and application lifecycle.\n\n- **Layered Architecture (DDD Style)**  \n  The application is structured into four layers:\n    - **Presentation Layer** → REST Controllers and DTO Mappers.\n    - **Application Layer** → Services and Ports for business use cases.\n    - **Domain Layer** → Core business logic, Entities, Factories, and Repositories.\n    - **Infrastructure Layer** → JPA entities, repository adapters, and mappers.\n\n- **Domain-Driven Design (DDD)**  \n  Business logic stays in the domain layer.  \n  The domain defines entities like `Product`, `Book`, `Course`, and `Magazine`,  \n  and uses value objects such as `ProductData`.\n\n- **Factory Pattern**  \n  Each product type has its own factory (`BookFactory`, `CourseFactory`, `MagazineFactory`) to create and update products.  \n  Factories are managed by `ProductFactoryRegistry`, which selects the correct one based on product type.\n\n- **Caching**  \n  Frequently accessed products are cached using **Spring Cache**, improving performance for read operations.\n\n- **H2 Database**  \n  The project uses an **in-memory H2 database** for development and testing.  \n  It’s lightweight, fast, and does not require external setup.\n\n- **Spring Data JPA**  \n  Used for persistence layer implementation.  \n  Repositories are defined as interfaces, while `ProductRepositoryAdapter` acts as an adapter to connect the domain with JPA.\n\n- **Spring Validation (Jakarta Validation)**  \n  Used for validating DTO fields like price, title, and stock.\n\n- **Springdoc OpenAPI / Swagger**  \n  Provides auto-generated API documentation and interactive UI for testing endpoints.\n\n- **Resilience4j**  \n  Used for rate limiting in the REST controller to control request flow and protect the system.\n\n- **Micrometer**  \n  Used for metrics and performance monitoring (e.g., timing product creation and fetching).\n\n- **Spring Cache**  \n  Integrated caching layer to store frequently used data like products by ID.\n\n- **Lombok**  \n  Reduces boilerplate code (getters, setters, builders, constructors, logging).\n\n- **Testcontainers**  \n  Used for integration testing with real containers.\n\n- **JUnit 5 \u0026 Mockito**  \n  Used for unit testing services, factories, and repositories.\n\n- **Slf4j**  \n  Logging framework integrated with Spring Boot for clean structured logs.\n\n---\n\n## Scalability and Future Improvements\n\nRight now, the system uses **Layered Architecture**, but it can evolve into **Hexagonal Architecture** if needed.  \nFor larger systems:\n- PostgreSQL can replace H2 for persistent data storage.\n- Elasticsearch can be added for fast searching.\n- Kafka or Debezium can synchronize data between services.\n\nThis would allow better scalability for read-heavy workloads while keeping the application modular.\n\n---\n\n## How to Run the Application\n\nFollow these steps to run the application:\n\n1. Clone the repository.\n2. Make sure **Java 21**, **Maven**, and optionally **Docker** are installed.\n3. Open the terminal and navigate to the project directory:\n\n   ```bash\n   cd product-management-service/\n\n4. To run with Maven directly:\n   ```bash\n   ./mvnw spring-boot:run\n\nThe app will start on http://localhost:8080 and use the in-memory H2 database.\n\nIf you prefer Docker:\n1. Make sure Docker is running.\n2. Build docker image command:\n   ```bash\n   docker build -t product-management:latest .\n3. Start docker compose with the following command:\n\n   ```bash\n   docker-compose up\n\nThis will start the Product Management Service container and H2 in memory DB.\n\n## API Documentation\n\nThe API is documented with **OpenAPI (Swagger)**.  \nTo open the Swagger UI:\n\n1. Start the application.\n2. Open your browser and go to:  \n   [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)\n3. You can view and test all API endpoints from this interface.\n4. H2 Web UI [http://localhost:8080/h2-console](http://localhost:8080/h2-console)\n5. JDBC Url: [jdbc:h2:mem:product]()\n---\n\n## Testing\n\nThe project includes both **unit tests** and **integration tests**.  \nTests cover the following areas:\n\n- Domain validation and business rules.\n- Factory creation and update logic.\n- Repository persistence behavior.\n- Controller endpoint tests with mock requests.\n\nTo run all tests, execute the following command:\n\n```bash\n  ./mvnw clean verify\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilalvdemir%2Fproduct-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbilalvdemir%2Fproduct-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilalvdemir%2Fproduct-management/lists"}