How adelaveres/bookstore-spring-angular works
Main Components
• Frontend Client: Represented by the AngularJS app, static assets (JavaScript, CSS), and Freemarker templates (in the src/main/resources/templates folder). This covers the user interfaces for login, employee view, and admin view.
• Backend (Application Server): Based on Spring Boot, it includes controllers (AppController, RestApiController), service classes (BookService, EmployeeService, LoginService, and report generation mechanisms like PdfReport and CsvReport), and model classes (Book, Employee, LoginAccount, etc.).
• Service Layer: Encapsulated in the “services” package. It contains business logic (such as selling books, updating employee records, and generating reports) and acts as an intermediary between controllers and models.
• Data/Model Layer: Contained in the “model” package, which represents domain entities like books, employees, and login accounts.
• Integration/Utility Components: This includes utility classes (like CustomErrorType), configuration files (application.properties), and external libraries (such as the iText library for PDF generation).
Relationships and Interactions
• The Frontend client (AngularJS and Freemarker templates) sends user requests (like login, CRUD operations on books/employees) to the Backend.
• Controllers in the Spring Boot application receive these requests and delegate them to the corresponding Service Layer components.
• Services perform the necessary business logic (including validations, report generation, and data manipulation) and interact with domain models.
• Although there is no explicit database directory indicated, the domain model and possibly the application.properties file hint at data persistence (which may be in-memory or connected to an actual database).
• External libraries (e.g., com.lowagie.text for PDF generation) are used by services when creating reports.
Architectural Patterns to Highlight
• Layered (n-tier) architecture: With separate layers for presentation (frontend), business logic (service layer), and data (model layer).
• MVC Pattern: The controllers (in com.bookstore.controller) act as the intermediaries between the view (FTL templates and AngularJS-based UI) and the model.
• Dependency Injection: Employed by Spring Boot to wire together controllers, services, and utilities.
• Report Generation: Notable use of a Report Factory pattern for handling different report types (PDF and CSV), suggesting extensibility in the reporting mechanism.
Relevant Technologies, Frameworks, and Libraries
• Spring Boot for the backend application framework.
• AngularJS for the client-side dynamic scripting.
• Bootstrap and CSS for UI styling.
• Maven (pom.xml) for dependency management and build configuration.
• External libraries such as com.lowagie.text for PDF creation.
• Freemarker (ftl files) for dynamic webpage rendering.