How kokoa454/medishare works
Project Type and Purpose
• This is a full-stack web application (PWA) for managing personal and family medication schedules.
• It’s built on Spring Boot (Java) with a Thymeleaf/HTML/CSS/JS front end, backed by MySQL and Elasticsearch, and integrates external notification services (LINE API, Gmail SMTP).
• A standalone Python scraper ingests medicine data from “くすりのしおり” and populates the database.
Main Architectural Layers and Components
a. Client / Frontend (PWA)
• Static assets: HTML templates (Thymeleaf), CSS, JavaScript, service worker (sw.js), manifest.json
• Responsible for rendering views (login, dashboard, edit medicine, etc.) and PWA offline support
b. Web Server / Reverse Proxy
• Nginx sits at the edge (not in codebase) to terminate HTTPS and proxy to the Spring Boot app
c. Application / Backend
• Controllers (HTTP entrypoints) – located under controller/ (e.g., LoginController, SearchController)
• Service layer – business logic in service/ (e.g., MedicineService, NotificationService, MailService, LineService)
• Data access layer (DAO/Repository) – JPA Repositories for MySQL, ElasticsearchDocumentRepository
• Configuration – SecurityConfig, ElasticsearchConfig, PasswordConfig
• Application entrypoint – MediShareApplication.java
d. Data Stores
• Primary relational store: MySQL (JPA Entities in model/)
• Secondary search index: Elasticsearch (document/ + DocumentRepository)
e. External Services
• Gmail SMTP for email notifications (MailService)
• LINE Messaging API for family notifications (LineService)
f. Offline ETL
• Python scripts under scripts/scrapeKusurinoshiori
• Scrape + transform “くすりのしおり” → medicine.json → MySQL ingestion
Component Interactions and Data Flows
• Browser ↔ Nginx ↔ Spring Boot Controllers (HTTP/HTTPS)
• Controller → Service → Repository → MySQL / Elasticsearch
• On schedule or event (e.g., reminder): Service triggers NotificationService → MailService (SMTP) and/or LineService (LINE API)
• Python scraper writes to MySQL directly (out of band)
• PWA assets served by Spring Boot’s static resource handler
Architectural Patterns and Principles
• Layered architecture: Presentation → Controller → Service → Repository → Database
• MVC within Spring MVC + Thymeleaf
• Use of external search index (Elasticsearch) for fuzzy search, fallback to MySQL
• PWA design pattern: manifest + service worker for offline caching
• Secure by Spring Security (form login, password encoding, reset tokens)