How prj-foody/foody-back works
Project type and purpose
• This is a full-stack monolithic web application: a food shopping mall named “Foody.”
• Backend: Java 11, Spring Boot, MVC pattern with Controllers → Services → Repositories.
• Frontend: server-side rendered Thymeleaf templates plus static assets (CSS/SCSS, JS, images).
• Database: H2 (TCP mode).
Key architectural layers and top-level directories
• src/main/java/com/prjfoody/foody/config → configuration (MVC, QueryDSL).
• src/main/java/com/prjfoody/foody/controller → HTTP request handlers (BasketController, ProductController, etc.).
• src/main/java/com/prjfoody/foody/service → business logic services.
• src/main/java/com/prjfoody/foody/repository → data access interfaces (Spring Data/JPA/QueryDSL).
• src/main/java/com/prjfoody/foody/domain → JPA entities and value types.
• src/main/resources/templates & static → Thymeleaf HTML templates and CSS/JS assets.
• Client / Web Browser (User)
• Embedded Web Server (Spring Boot on Tomcat)
• MVC Layers:
– Controllers
– Service Layer
– Repository Layer
– Domain Model (Entities)
• Template Engine (Thymeleaf) & Static Asset Handler
• Database (H2 TCP server)
• H2 Console (admin tool)
1. User → HTTP Request → Controllers
2. Controllers → invoke Service Layer → business rules
3. Service Layer → calls Repository Layer → CRUD on H2 DB
4. Repository returns Entity objects → Service → Controller
5. Controller → selects Thymeleaf template or JSON view → renders HTML + static assets → User
6. Admin Ad Hoc: Spring Boot serves H2 Console via web UI
c. Architectural patterns:
• Layered MVC (presentation, business, persistence)
• Dependency Injection (Spring @Autowired)
• Template-based rendering (Thymeleaf)
• Configuration separation (application.yml, MvcConfiguration, QueryDslConfig)
d. Major technologies on each component:
• Spring Boot (embedded Tomcat, Spring MVC)
• Thymeleaf templates
• SCSS/CSS/JavaScript (static resources)
• H2 Database (JDBC URL: tcp://localhost/~/test_foody)
• QueryDSL for type-safe queries
Final recommendations
• Cross-cutting concerns such as exception handling (ExceptionHandlerControllerAdvice) and initialization routines (InitSampleDB).
• Review with stakeholders to ensure all critical interactions (e.g., user → basket → order workflow) are covered.