Skip to content

engripaye/shopping-feedback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Shopping Feedback Backend

Spring Boot + MySQL REST API for Customer Feedback Collection

This project is a fully functional backend application built with Java 21 and Spring Boot 3.5.x, designed to collect, store, and manage customer feedback for a shopping platform. It includes RESTful API endpoints, form validation, database persistence via JPA, and an optional HTML form for quick feedback submission.


πŸš€ Features

βœ… REST API for feedback submission & retrieval βœ… MySQL persistence via Spring Data JPA βœ… Request validation using Jakarta Validation βœ… Docker Compose setup for MySQL βœ… Optional Thymeleaf form for direct user input βœ… Maven-based build for easy setup and deployment


🧩 Tech Stack

Component Technology
Language Java 21
Framework Spring Boot 3.5.x
Database MySQL 8
ORM Spring Data JPA (Hibernate)
Validation Jakarta Validation
Build Tool Maven
Containerization Docker & Docker Compose
Optional UI Thymeleaf Template Engine

πŸ—οΈ Project Structure

shopping-feedback/ β”‚ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ main/java/com/example/shoppingfeedback/ β”‚ β”‚ β”œβ”€β”€ controller/ # REST API endpoints β”‚ β”‚ β”œβ”€β”€ dto/ # Request DTOs & validation β”‚ β”‚ β”œβ”€β”€ model/ # JPA entity definitions β”‚ β”‚ β”œβ”€β”€ repository/ # Data access layer β”‚ β”‚ β”œβ”€β”€ service/ # Business logic layer β”‚ β”‚ └── ShoppingFeedbackApplication.java β”‚ └── resources/ β”‚ β”œβ”€β”€ application.properties β”‚ └── templates/ # Optional Thymeleaf HTML form β”‚ β”œβ”€β”€ pom.xml └── docker-compose.yml 

βš™οΈ Configuration

Edit the database credentials in src/main/resources/application.properties:

spring.datasource.url=jdbc:mysql://localhost:3306/shopping_feedback?useSSL=false&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=changeme spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true

🐳 Docker Setup (Recommended)

Run MySQL locally using Docker Compose:

docker compose up -d

MySQL will start with:

  • Database: shopping_feedback
  • User: appuser
  • Password: apppassword

Then update your application.properties:

spring.datasource.username=appuser spring.datasource.password=apppassword

🧠 API Overview

Base URL: http://localhost:8080/api/feedback

▢️ Submit Feedback

curl -X POST http://localhost:8080/api/feedback \ -H "Content-Type: application/json" \ -d '{  "name": "Jane Doe",  "contact": "+2348012345678",  "rating": 4,  "itemsNotFound": "Olive oil, Wheat flour",  "priceToReduce": "Tomatoes are expensive",  "improvementSuggestion": "Open more checkout counters"  }'

πŸ“‹ Get All Feedback

curl http://localhost:8080/api/feedback

πŸ” Get Feedback by ID

curl http://localhost:8080/api/feedback/1

πŸ§ͺ Run Locally

1️⃣ Start MySQL (either locally or via Docker). 2️⃣ Update your credentials in application.properties. 3️⃣ Build and run the app:

mvn clean package java -jar target/shopping-feedback-0.0.1-SNAPSHOT.jar

Or run directly from your IDE:

ShoppingFeedbackApplication.java 

Access the API at:

http://localhost:8080/api/feedback 

πŸ–₯️ Optional: Web Feedback Form

If you enabled Thymeleaf, open: src/main/resources/templates/feedback-form.html

You can serve this from a simple controller to collect feedback via a browser form.


🧰 Future Enhancements

  • Add authentication for feedback admins
  • Integrate Swagger/OpenAPI documentation
  • Add email notifications for new feedback
  • Introduce pagination and filtering
  • Deploy with Docker + Spring Boot container

🧾 License

This project is licensed under the MIT License β€” feel free to use and modify for your learning or production needs.


πŸ’‘ Inspiration

Designed as a learning-friendly yet production-ready Spring Boot starter demonstrating:

β€œHow to build a REST API with MySQL integration and validation β€” from code to container.”


About

πŸ›οΈThis project is a fully functional backend application built with Java 21 and Spring Boot 3.5.x, designed to collect, store, and manage customer feedback for a shopping platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors