How nozomi-75/soko works
Project type and purpose
• This is a monolithic, full-stack web application called “Sōko” for managing a product inventory.
• The backend is built with Spring Boot (Java), exposing REST endpoints under /api/products.
• The frontend is a single‐page, mobile-first UI (HTML/CSS/JS/Bootstrap) served from Spring’s static folder.
• The embedded database is H2 (in-memory or file mode).
File structure
• Top-level: standard Maven layout (pom.xml, mvnw, .mvn).
• src/main/java/com/keiaa/soko:
• SokoApplication.java (Spring Boot entry point)
• controller/ProductController.java (REST API layer)
• service/ProductService.java, CsvExportService.java (business logic)
• repository/ProductRepository.java (Spring Data JPA)
• model/Product.java (JPA entity)
• src/main/resources/static: front-end assets (index.html, main.js, CSS, service worker)
• application.properties: config for server port (9090) and H2 settings.
• Tests under src/test/java.
Key points from README
• RESTful API with CRUD endpoints and query parameters for filtering, sorting, searching.
• Tech stack: Spring Boot, H2, JavaScript, Bootstrap 5, Maven.
• Mobile-first, responsive UI.
Main components
a. Client Layer
• Browser (mobile/desktop) hosts the SPA (index.html, main.js, CSS, service worker).
b. Server Layer
• Spring Boot Application
• Controller Layer (ProductController)
• Service Layer (ProductService, CsvExportService)
• Repository Layer (Spring Data JPA → H2)
c. Data Layer
• H2 Database (in-memory or file)
d. Build & Deployment
• Maven Wrapper, pom.xml dependencies (Spring Boot Starter Web, Data JPA, H2)
e. External Interfaces
• HTTP REST API /api/products
• Static file serving for frontend
Relationships & interactions
• User’s browser sends HTTP requests to the Spring Boot server.
• Frontend main.js calls /api/products endpoints.
• Controller receives REST calls → delegates to Service → Service uses Repository → Repository queries H2.
• Service returns domain objects → Controller serializes to JSON → frontend updates UI.
• Optional CSV export service invoked by controller to generate downloadable CSV.
Architectural patterns & principles
• Layered (Controller → Service → Repository)
• MVC-inspired on backend, though view is decoupled as an SPA.
• Repository pattern via Spring Data JPA.
• Single-page application on the client.
Technologies & frameworks to annotate
• Spring Boot (embedded Tomcat)
• Spring MVC, Spring Data JPA
• H2 Database (JDBC)
• JavaScript, Bootstrap 5, Service Worker (PWA shell)
• Maven (build, dependency management)
Essential elements
• Component labels (e.g., “ProductController”, “ProductService”)