You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Store is a full-stack web application built with Spring Boot 4 for managing products and categories. It provides a Thymeleaf-based server-rendered UI and a RESTful JSON API, both secured with role-based authentication.
Key Highlights
Dual Interface — Thymeleaf UI for browser users + REST API for programmatic access
Role-Based Access Control — ADMIN (full CRUD) and USER (read-only products)
Multi-Profile Architecture — Seamless switching between local, dev, staging, and production environments
Cloud-Native Database — Aiven MySQL for staging & production
Image Storage — Smart fallback: Cloudinary (cloud) → Local filesystem
OpenAPI 3.0 — Full Swagger documentation hosted on SwaggerHub with live "Try it out"
Docker Ready — Multi-stage Dockerfile + Docker Compose for local MySQL
{
"name": "MacBook Pro 14 inch",
"brand": "Apple",
"categoryId": 1,
"price": 19999000,
"description": "MacBook Pro 14 inch with M3 Pro chip for maximum performance",
"imageUrl": "https://example.com/macbook.jpg"
}
Field
Type
Required
Constraints
name
string
Yes
minLength: 1
brand
string
Yes
minLength: 1
categoryId
integer
Yes
min: 1
price
number
Yes
min: 0
description
string
Yes
minLength: 10, maxLength: 2000
imageUrl
string
No
Valid URI
CategoryRequest
{
"name": "Elektronik"
}
Field
Type
Required
Constraints
name
string
Yes
minLength: 1, must be unique
Example Requests
# List all products
curl http://localhost:8080/api/products
# Search products
curl http://localhost:8080/api/products?search=macbook
# Get single product
curl http://localhost:8080/api/products/1
# Create product
curl -X POST http://localhost:8080/api/products \
-H "Content-Type: application/json" \
-d '{ "name": "MacBook Pro 14 inch", "brand": "Apple", "categoryId": 1, "price": 19999000, "description": "MacBook Pro 14 inch with M3 Pro chip for maximum performance" }'# Create category
curl -X POST http://localhost:8080/api/categories \
-H "Content-Type: application/json" \
-d '{"name": "Elektronik"}'# Delete product
curl -X DELETE http://localhost:8080/api/products/1
Quick Start
Prerequisites
Java 17 or newer
Maven 3.8+ (or use the included Maven Wrapper ./mvnw)
MySQL 8.0 (optional — H2 is used for local development)
1. Clone Repository
git clone https://github.com/hendwunga/store.git
cd store
Use the generated https://*.trycloudflare.com URL for public access.
Docker Hub (via GitHub Actions)
Push to main triggers CI/CD:
Build & Test — mvn verify
Docker Build — Multi-stage image
Push — Image to Docker Hub
Required GitHub Secrets:
Secret
Description
DOCKER_USERNAME
Docker Hub username
DOCKER_PASSWORD
Docker Hub access token
Testing
# Run all tests
./mvnw verify
# Run specific test
./mvnw test -Dtest=ProductsRepositoryTest
# Run with test profile (H2 in-memory)
./mvnw test -Dspring.profiles.active=test
Distributed under the MIT License. See LICENSE for details.
Built with Spring Boot 4 + Thymeleaf + REST API + OpenAPI 3.0
About
Aplikasi web manajemen produk dan kategori full-stack berbasis Spring Boot, Thymeleaf, dan MySQL, lengkap dengan dokumentasi REST API interaktif via SwaggerHub.