# Project Knowledge Base ## Overview This project is a web application built using **Java**, **Spring Boot**, and **Thymeleaf**. It serves as the frontend layer for `sisvietnamvn`, currently rendering static-like pages with dynamic templating provided by Thymeleaf. The static assets seem to be heavily inspired by or imported from UMass Amherst website templates, integrated into a Spring Boot architecture. ## System Architecture * **Language:** Java 21 * **Framework:** Spring Boot (Version 4.0.6 as per `build.gradle`) * **Build Tool:** Gradle * **Application Type:** Spring Web MVC application * **Routing:** Basic MVC routing handled by `@Controller` classes. Currently, `HomeController.java` maps endpoints to Thymeleaf templates: * `/` -> `index.html` * `/about` -> `about.html` * `/flex-finish` -> `flex-finish.html` ## Directory Structure The structure strictly adheres to standard Maven/Gradle Spring Boot conventions: * `build.gradle` / `settings.gradle`: Gradle configuration files defining dependencies and build settings. * `src/main/java/com/sisvietnamvn/web/`: Contains Java source code. * `SisvietnamvnApplication.java`: Main Spring Boot entry point. * `controller/HomeController.java`: Web controller managing page routing. * `src/main/resources/`: Contains configuration and web assets. * `application.properties`: Spring Boot configuration properties. * `static/`: Stores all static assets (CSS, JS, Images). Assets are organized into subdirectories like `css/`, `images/`, `js/`, and specific page folders like `flex-finish/` and `UMass Amherst _ UMass Amherst_files/`. * `templates/`: Contains Thymeleaf `.html` view templates. * `fragments/`: Contains reusable Thymeleaf layout components (`layout.html`, `header.html`, `footer.html`). ## Libraries and Dependencies * **Spring Boot Starter Web** (`spring-boot-starter-webmvc`): For building web, including RESTful, applications using Spring MVC. * **Spring Boot Starter Thymeleaf** (`spring-boot-starter-thymeleaf`): For HTML templating. * **Thymeleaf Layout Dialect** (`nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect`): Provides decorator pattern for Thymeleaf, allowing the use of a common layout (`layout.html`) that other pages inject content into. * **Spring Boot DevTools** (`spring-boot-devtools`): For fast application restarts and live reload during development. * **Frontend Libraries:** * jQuery (`jquery.min.js`) * Lazysizes (`lazysizes.min.js`) for lazy loading images. * Various Lottie scripts and custom scripts copied into static folders. ## Coding Conventions & Best Practices 1. **Templating & Layouts:** The project relies on the Thymeleaf Layout Dialect. Pages should define their content within a `layout:fragment="content"` block and reference the master layout (`layout.html`). Reusable parts (like headers/footers) are stored in the `fragments` folder and included via `th:replace`. 2. **Asset Management:** Static assets (CSS, images, JS) are referenced via absolute paths starting from the root `/` (e.g., ``). This relies on Spring Boot's default static resource mapping. 3. **Controllers:** Keep controllers lightweight. Endpoints should generally just return the template name as a String. 4. **Language Level:** The project uses Java 21, allowing for modern Java features (records, pattern matching, etc.) if backend logic is expanded in the future.