How jhordyess/dockerized-spring-react-mysql works
Project type and purpose
• This is a full-stack, Dockerized web application.
• Frontend: React single-page app served by Nginx.
• Backend: Spring Boot REST API.
• Data layer: MySQL database + phpMyAdmin for management.
• Orchestration: Docker Compose (production and development variants).
Main components
a. Frontend Container
• Nginx server hosting the compiled React app (index.html, static assets).
• Port 80 on the host → mapped to the container’s port 80.
b. Backend Container
• Spring Boot application (DemoUserApplication).
• Exposes a REST API on port 8080.
• Follows MVC:
– Controller (UserController)
– Domain & Repository (User, UserRepository)
c. Database Container
• MySQL server (3306)
• Uses environment variables from .env for credentials and schema.
d. phpMyAdmin Container
• Web UI for managing MySQL (default port 81).
e. Docker Network & Volumes
• Shared network allowing containers to communicate by service name.
• Volume for MySQL data persistence.
f. Docker Compose Orchestrator
• Defines service interdependencies and startup order (docker-compose.yml & docker-compose.dev.yml).
Relationships and data flows
• Browser → Nginx (frontend)
→ serves React assets.
• React app → Spring Boot API over HTTP (e.g., POST /api/users).
• Spring Boot → MySQL via JDBC.
• phpMyAdmin → MySQL for DB inspection/management.
Architectural patterns & design principles
• Separation of concerns: UI vs API vs persistence.
• Containerization: each component runs in its own Docker container.
• Dev vs Prod mode:
• Prod Compose file builds images and exposes ports 80 (frontend) & 3306.
• Dev Compose file adds code-volume mounting and phpMyAdmin service.
• Spring MVC pattern in backend
• Clear labels for each container/service.
• Callouts for major frameworks and languages:
• React (JavaScript, Vite)
• Nginx
• Spring Boot (Java, Maven)
• MySQL + phpMyAdmin