How djatjs/kihibooks works
Project Type and Purpose
• KiHiBooks is a monolithic, server-rendered full-stack web application built with Spring Boot and Thymeleaf. It provides user management features—signup, login, profile editing—persisted to a relational database via MyBatis.
File-Structure Analysis
• Top-level:
• kihibooks/ – Maven project root containing source, config, resources
• DB/키히북스 DDL.sql – database schema definition
• package.json & package-lock.json – client-side dependency manifest (e.g., for static asset build)
• Under src/main/java:
• config/ – Spring and MyBatis configuration classes
• controller/ – MVC controllers handling HTTP routes
• service/ – business logic services
• dao/ – data access objects using MyBatis mappers
• model/vo/ – value objects for User and Email
• Under src/main/resources:
• mappers/ – MyBatis XML mapping files
• static/ – CSS/JS/images/banners served directly to the client
• templates/ – Thymeleaf HTML views and layout fragments
Key Architectural Patterns
• Classic layered MVC: Presentation (Thymeleaf + static), Controller, Service, DAO, Database
• Dependency Injection via Spring
• Persistence abstraction via MyBatis
• Build & dependency management via Maven; optional front‐end tooling via npm
Main System Components
a. Client Browser
b. Spring Boot Application
1. Static Resource Handler (serves CSS/JS/images)
2. Thymeleaf View Resolver & Templates
3. Controllers (UserController, MainController)
4. Service Layer (UserService)
5. DAO Layer (UserDAO)
6. MyBatis Mapper (UserMapper.xml)
7. Configuration (MyBatisConfig, WebMvcConfig)
c. Database (e.g., MySQL with the schema in DDL.sql)
d. Optional External Tools (npm scripts for static builds)
Relationships and Data Flows
• Browser → HTTP Request → Controller
• Controller ↔ Service for business rules
• Service ↔ DAO for CRUD operations
• DAO ↔ MyBatis Mapper → SQL → Database
• On reads, data bubbles back up to Controller → Model → Thymeleaf view → Browser
• Static resources are fetched directly by the browser via Spring’s resource handler