{"id":30170836,"url":"https://github.com/avidee007/spring-modulith-library-app","last_synced_at":"2025-08-11T21:22:52.033Z","repository":{"id":308565040,"uuid":"1031987175","full_name":"avidee007/spring-modulith-library-app","owner":"avidee007","description":"Library management app  built using spring modulith project with spring boot.","archived":false,"fork":false,"pushed_at":"2025-08-06T15:30:58.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T17:28:09.111Z","etag":null,"topics":["domain-driven-design","modular","modules","spring-modulith"],"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/avidee007.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":"2025-08-04T16:20:23.000Z","updated_at":"2025-08-06T15:35:07.000Z","dependencies_parsed_at":"2025-08-06T17:41:27.039Z","dependency_job_id":null,"html_url":"https://github.com/avidee007/spring-modulith-library-app","commit_stats":null,"previous_names":["avidee007/spring-modulith-library-app"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/avidee007/spring-modulith-library-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avidee007%2Fspring-modulith-library-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avidee007%2Fspring-modulith-library-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avidee007%2Fspring-modulith-library-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avidee007%2Fspring-modulith-library-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avidee007","download_url":"https://codeload.github.com/avidee007/spring-modulith-library-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avidee007%2Fspring-modulith-library-app/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269959045,"owners_count":24503676,"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-08-11T02:00:10.019Z","response_time":75,"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":["domain-driven-design","modular","modules","spring-modulith"],"created_at":"2025-08-11T21:22:46.539Z","updated_at":"2025-08-11T21:22:52.013Z","avatar_url":"https://github.com/avidee007.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 Spring-Modulith Library App\n\n**Modular Monolith Library Management System**  \nBuilt using Spring Boot, Spring Modulith \u0026 Domain‑Driven Design  \nDomains: **Rental**, **Inventory**, **Notifications**\n\n---\n\n## Introduction\n\nThis repository contains a **sample Library Management System** built with **Spring Modulith**. It demonstrates how to structure a Spring Boot application into **modular components** with **clearly defined context boundaries**, adhering to **Domain-Driven Design (DDD)** principles.\n\n![components.svg](docs/components.svg)\n\n## Key characteristics of this architecture:\n\n- **Modular Design** – Each module encapsulates its own domain logic and data.\n- **Inter‑module Communication** – Modules interact either **synchronously** via exposed APIs or **asynchronously** using domain events.\n- **Loose Coupling** – Reduces dependencies between modules, improving maintainability and scalability.\n- **Microservice‑ready** – Clear boundaries simplify transitioning from a monolithic architecture to distributed **microservices** as the system evolves.\n\n---\n\n## 🔦 Why Spring Modulith?\n\n- **Modular Monolith Architecture**: Encapsulate functional domains into modules (rental, inventory, notifications), improving maintainability and clarity.\n- **Structural Verification**: Enforce module boundaries using `ApplicationModules.of(...).verify()` in tests, preventing illegal package dependencies.\n- **Event‑Driven Communication**: Modules interact via domain events instead of direct service injection, leading to loose coupling and high cohesion.\n- **Self‑Documenting Modules**: Automatically generate module documentation diagrams and artifacts via Spring Modulith tooling. [module-docs](docs)\n\n---\n\n## ⚙️ Workflow Overview\n\n1. **Rental API Call**\n    - `POST /api/rentals/rent` → RentalService persists rental and publishes `RentalEvent`.\n   \n    - `POST /api/rentals/return` → RentalService updates rental with return date time and publishes `ReturnEvent`.\n\n2. **Inventory Listener**\n    - Consumes `RentalEvent` → decrements available copies and publishes `RentalSuccessEvent`\n    - Consumes `ReturnEvent` → increments available copies and publishes `ReturnSuccessEvent`.\n\n3. **Notifications Listener**\n    - Listens to both `RentalSuccessEvent` and `ReturnSuccessEvent` events and logs notification metadata (bookId, userId, timestamps).\n\n---\n\n## 📦 Key Features\n\n- **Events driven side effects**: inventory updates and notifications handled asynchronously.\n- **Modular isolation**: each domain encapsulates its own model and logic.\n- **Automated architecture enforcement**: `module verify` tests catch coupling violations.\n\n---\n\n## 🧭 Benefits in Real–World Development\n1. **Clean Domain Separation** – Each module owns its model and operations.\n\n2. **Evolution‑Friendly Architecture** – Easy to add new modules or external integrations (e.g., Kafka, Email).\n\n3. **Independent Testing** – Modules can be tested individually using @ApplicationModuleTests.\n\n4. **Microservice Migration Ready** – Event-driven design simplifies extraction into microservices if needed.\n\n## 🧪 Getting Started\n\n### Prerequisites\n\n- Java 17+\n- Gradle (wrapper included) or Maven\n- Postgres Database\n\n### Clone \u0026 Run\n\n```\ngit clone https://github.com/avidee007/spring-modulith-library-app.git\ncd spring-modulith-library-app \n```\n#### Build application\n\n```bash\n  ./gradlew build\n```\n\n#### Run application\n```bash\n  ./gradlew bootRun\n```\n\n#### Run tests\n```bash\n  ./gradlew test\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favidee007%2Fspring-modulith-library-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favidee007%2Fspring-modulith-library-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favidee007%2Fspring-modulith-library-app/lists"}