How arun9123/capgemini_sprint_bookstore works
This repository is split into two separate Spring Boot applications: a backend API in BookStore/ and a server-rendered UI in BookStore-UI/. The backend owns the domain model, persistence, and REST endpoints; the UI is a thin client that renders pages and calls the backend over HTTP.
1. Backend core is a layered REST service
- com.capgemini.BookStore contains controllers, service/service.impl, repository, model, dto, and exception.
- Request flow is conventional: controller → service → repository → database, with DTOs used to shape API responses and inputs.
2. Domain model centers on bookstore entities
- The main persisted entities are Book, Author, Category, Publisher, State, Reviewer, Inventory, BookCondition, BookReview, PermRole, User, PurchaseLog, and ShoppingCart.
- The README’s class diagram matches the backend model and shows the key relationships, including book-category, book-publisher, publisher-state, book-author, book-review, inventory-book-condition, user-role, and purchase/cart associations.
3. Join entities and composite IDs matter
- Several many-to-many or transaction-style relationships are modeled explicitly with composite IDs: BookAuthor, BookReview, PurchaseLog, and ShoppingCart.
- These are important architecture boundaries because they represent link tables and business events rather than simple master data.
4. Service layer encapsulates business rules
- Each domain area has a dedicated service interface and implementation pair, such as BookServiceImpl, InventoryServiceImpl, PurchaseLogServiceImpl, and ShoppingCartServiceImpl.
- Exceptions like DuplicateResourceException, ResourceNotFoundException, and InventoryNotAvailableException indicate business-rule enforcement in the service layer, not just CRUD passthrough.
5. Persistence is repository-driven
- Repositories such as BookRepo, AuthorRepo, InventoryRepo, UserRepo, and others suggest Spring Data JPA-style persistence.
- The model/id package shows explicit composite key classes, which is a strong indicator that the database schema includes join tables and composite primary keys.
6. DTOs are used heavily for API contracts
- The backend has a large dto package with many specialized response shapes like BookWithAuthorsDTO, BookWithInventoryDTO, PublisherRatingDTO, CategoryReviewCountDTO, and ReviewerRatingDTO.
- This means controllers likely do not expose entities directly for most endpoints; instead they project domain data into use-case-specific payloads.
7. Controllers are organized by business capability
- There are separate controllers for authors, books, book-author links, book conditions, reviews, categories, inventory, publishers, purchase logs, reviewers, shopping carts, states, users, roles, and health checks.
- This suggests a resource-oriented API surface rather than a single monolithic endpoint layer.
8. Cross-cutting backend configuration is limited but important
- CorsConfig and MapperConfig indicate frontend/backend cross-origin access and object mapping configuration.
- Multiple environment files (application-dev.properties, application-prod.properties, application-remote.properties, and test properties) show the backend is deployed in different runtime profiles.
9. UI is a separate Spring Boot web app
- BookStore-UI has its own pom.xml, boot application class, controller, config, model, registry, and templates/static folders.
- It is likely a Thymeleaf-based server-side rendered app, since HTML templates are present and there is no SPA framework in the tree.
10. UI acts as a client to the backend API
- ApiClient is the key integration point: UI controllers send requests to backend endpoints and then render the returned data.
- ApiEndpoint, Member, and MemberRegistry suggest the UI also maintains a small local model/registry for browsing available APIs or sample members.
11. UI page flow is presentation-first
- Templates such as members.html, member-apis.html, api-input.html, and api-result.html indicate the UI is meant for interactive API exploration or admin-style browsing rather than full domain editing.
- Static assets are minimal, with CSS and images supporting the rendered pages.
12. Testing is broad and mirrors the backend structure
- The backend includes controller, service, and integration tests for nearly every major domain area.
- This is useful architecturally because it confirms the primary boundaries: controller tests for HTTP behavior, service tests for business logic, and integration tests for end-to-end persistence/API behavior.
13. Operational entry points
- Both applications have their own main Spring Boot entry classes: BookStoreApplication and BookStoreUiApplication.
- Postman resources and globals in .postman/ and postman/ support direct API validation against the backend, independent of the UI.
For an architecture diagram, the most important flow is: browser → UI Spring MVC controller → API client → backend REST controller → service layer → repository/JPA → database, with DTOs and exceptions shaping the contract between layers.
Main entry points: BookController.java REST controllers · BookService.java Services · TeamController.java Page controller · BookRepo.java Repositories
Components 18
Backend API
Spring Boot REST service owning bookstore domain, persistence, and API contracts.
- API app · Bootstraps the backend application.
BookStore/src/main/java/com/capgemini/BookStore/BookStoreApplication.java - Config · CORS and object-mapping configuration for the backend.
BookStore/src/main/java/com/capgemini/BookStore/config/CorsConfig.java - REST controllers · Resource-oriented endpoints for books, authors, inventory, reviews, carts, users, and health.
BookStore/src/main/java/com/capgemini/BookStore/controllers/BookController.java - Services · Domain services and implementations that enforce business rules and orchestration.
BookStore/src/main/java/com/capgemini/BookStore/service/BookService.java - Repositories · Spring Data repositories for bookstore entities and link tables.
BookStore/src/main/java/com/capgemini/BookStore/repository/BookRepo.java - Domain model · Persisted bookstore entities plus composite ID classes for join and transaction records.
BookStore/src/main/java/com/capgemini/BookStore/model/Book.java - DTOs · Specialized request/response shapes used to project domain data for APIs.
BookStore/src/main/java/com/capgemini/BookStore/dto/BookDTO.java - Exceptions · Domain and API error types plus global exception mapping.
BookStore/src/main/java/com/capgemini/BookStore/exception/GlobalExceptionHandler.java - Database · Relational backing store accessed through JPA repositories.
- Postman assets · Shared Postman resources and globals for direct backend testing.
postman/globals/workspace.globals.yaml
UI App
Separate Spring Boot server-rendered frontend that calls the backend over HTTP.
- UI app · Bootstraps the server-rendered frontend application.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/BookStoreUiApplication.java - Page controller · Drives browser-facing page flow for member and API browsing.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/controller/TeamController.java - API client · Calls backend REST endpoints and passes results back to the UI layer.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/client/ApiClient.java - Templates · Thymeleaf-style HTML pages for browsing members, APIs, and results.
BookStore-UI/src/main/resources/templates/members.html - UI model · Local UI data structures for endpoints and members.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/model/ApiEndpoint.java - Registry · Holds available members and API metadata for page rendering.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/registry/MemberRegistry.java - UI config · Frontend-specific application configuration.
BookStore-UI/src/main/java/com/capgemini/BookStoreUI/config/AppConfig.java - Static assets · Minimal CSS and images used by the rendered pages.
BookStore-UI/src/main/resources/static/css/style.css
Connections 19
- API app → REST controllers: starts · Application exposes REST endpoints through controllers.
- REST controllers → Services: delegates · Controllers hand off request handling to services.
- Services → Repositories: queries · Services use repositories for persistence operations.
- Repositories → Domain model: maps · Repositories persist entity and composite-key models.
- Repositories → Database: stores · JPA repositories read and write the database.
- Services → DTOs: projects · Services shape responses through DTOs.
- REST controllers → DTOs: accepts/returns · HTTP layer uses DTOs for API contracts.
- Services → Exceptions: raises · Business rules surface as domain exceptions.
- Exceptions → REST controllers: maps errors · Global handler turns exceptions into API responses.
- Config → REST controllers: enables · Cross-origin and mapping configuration support the API layer.
- UI app → Page controller: starts · UI bootstraps its MVC controllers.
- Page controller → API client: calls · Page controllers invoke the backend API client.
- Page controller → Templates: renders · Controllers select server-side templates.
- API client → REST controllers: HTTP API · UI talks to the backend REST layer over HTTP.
- Page controller → UI model: uses · Controllers populate local view models.
- UI model → Registry: catalogs · Registry organizes the available members and API metadata.
- UI config → API client: configures · UI app wiring supports backend client usage.
- Templates → Static assets: styled by · Templates are paired with minimal static assets.
- Postman assets → REST controllers: validates · Postman resources exercise backend endpoints directly.