How boanlai/todo-list works
Project Type and Purpose
• This is a classic full-stack CRUD application.
• Purpose: allow users to view/add/update “missions” (todo items), persisted in MySQL, with a Vue.js single-page frontend served by Spring Boot.
Main Architectural Components
a. Frontend (Vue.js SPA)
– Located under src/main/resources/static (index.html + JS/CSS bundles).
– Runs in the user’s browser, calls REST APIs.
b. Backend (Spring Boot Application)
– Entry point: TodoListApplication (src/main/java/com/boan/todo_list).
– Web layer:
• ViewController – serves homepage (index.html).
• ApiController – exposes REST endpoints (/api/… for CRUD).
• IpCaptureFilter – servlet filter capturing request IPs.
– Business layer:
• MissionService – business logic for missions.
• MissionAuditorAware – supplies auditing metadata.
• MyCommandLineRunner – initial data loader on startup.
– Data layer:
• MissionRepo – Spring Data JPA repository.
• Mission – @Entity mapping to MySQL table.
c. Database (MySQL)
– Schema defined by src/main/db/ddl.sql.
– Configured via application.properties and JpaConfig.
d. Config & Bootstrapping
– pom.xml / mvnw – Maven build & dependency management.
– application.properties – datasource, JPA settings.
– WebConfig – CORS, resource handlers.
Relationships & Data Flows
1. Browser → (HTTP) → Spring Boot Web Server
– ViewController returns index.html.
– Vue router loads the SPA.
2. SPA → (XHR/Fetch) → ApiController
– GET/POST/PUT/DELETE on /api/missions.
3. ApiController → MissionService → MissionRepo → MySQL
– JPA abstracts SQL operations.
4. MyCommandLineRunner → runs at startup → preload DB via MissionService.
5. IpCaptureFilter → intercepts all incoming requests → logs/stores IP (cross-cutting).
Architectural Patterns & Principles
• Layered (Controller → Service → Repository)
• MVC for view vs. REST API separation
• Single-page app served as static content
• Dependency Injection & Inversion of Control (Spring)
• Convention-over-Configuration (Spring Boot auto-config)
• Build Automation (Maven)
Detailed Steps to Sketch
a. Web Layer: IpCaptureFilter → ViewController, ApiController
b. Service Layer: MissionService, MissionAuditorAware, MyCommandLineRunner
c. Data Layer: MissionRepo → Mission (Entity)
4. Connect:
– Browser → ViewController (HTTP GET /)
– Browser → ApiController (XHR JSON API)
– ApiController → MissionService (method calls)
– MissionService → MissionRepo (JPA)
– MissionRepo → MySQL (JDBC)
5. Configuration files (application.properties, pom.xml) at the bottom or side.
6. Use arrowheads to indicate direction of data flow.