A Java backend project built with Spring Boot, Spring Data JPA, and MySQL, focused on REST API development, CRUD operations, and maintainable application architecture.
CRUD Spring Boot is a backend project designed to explore the foundations of building REST APIs with the Spring ecosystem.
The project starts with a Spring Boot application configured with Spring Web MVC, Spring Data JPA, MySQL connectivity, Maven, and testing dependencies. Its goal is to evolve into a structured backend application that demonstrates resource management, database persistence, validation, and reliable HTTP error handling.
The repository is currently a foundation for development. CRUD endpoints, business entities, validation, and other features should be considered implemented only when they are present in the source code.
| Technology | Purpose |
|---|---|
| Java 17+ | Backend programming language |
| Spring Boot 4 | Application framework and configuration |
| Spring Web MVC | HTTP request handling and REST API development |
| Spring Data JPA | Persistence abstraction and repository support |
| Hibernate | Object-relational mapping through JPA |
| MySQL | Relational database |
| Maven | Dependency management and build automation |
| Spring Boot testing dependencies | Application testing |
The intended design follows a layered architecture that separates HTTP handling, business logic, and data access.
Client
|
| HTTP / JSON
v
REST Controller
|
v
Service Layer
|
v
Repository Layer
|
v
JPA / Hibernate
|
v
MySQL Database
- Controller: Handles HTTP requests and defines API endpoints.
- Service: Contains business rules and coordinates operations.
- Repository: Provides database access through Spring Data JPA.
- Entity: Represents persistent domain objects.
- DTO: Defines request and response structures independently of database entities.
- Exception handling: Provides consistent API error responses.
This is the target architecture; the corresponding layers must be implemented and verified in the codebase before being considered complete.
- JDK 17 or a compatible version required by the selected Spring Boot release.
- MySQL Server.
- Git.
- Maven, or the Maven Wrapper included in the repository.
git clone https://github.com/ELGHAD/CRUD_SpringBoot.git
cd CRUD_SpringBootCREATE DATABASE crud_springboot_db;Update src/main/resources/application.properties with your local database settings:
spring.datasource.url=jdbc:mysql://localhost:3306/crud_springboot_db
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.hibernate.ddl-auto=updateSet DB_USERNAME and DB_PASSWORD in your environment before launching the application. Adapt the configuration to the properties already present in the repository.
Security: Never commit real database credentials. Schema auto-update is convenient during development, but production environments should use a controlled database migration strategy.
On Linux or macOS:
./mvnw clean packageOn Windows:
.\mvnw.cmd clean packageOn Linux or macOS:
./mvnw spring-boot:runOn Windows:
.\mvnw.cmd spring-boot:runThe default Spring Boot port is 8080, unless changed in the application configuration.
The application will start according to the features and configuration currently implemented in the repository.
The following table describes the intended API contract for a future generic resource. These endpoints are examples, not a claim that the routes already exist.
| Method | Example endpoint | Intended operation |
|---|---|---|
POST |
/api/v1/items |
Create a resource |
GET |
/api/v1/items |
Retrieve resources |
GET |
/api/v1/items/{id} |
Retrieve one resource |
PUT |
/api/v1/items/{id} |
Update a resource |
DELETE |
/api/v1/items/{id} |
Delete a resource |
Once implemented, the API should use appropriate HTTP status codes, validate incoming data, and return consistent error responses.
The project aims to reinforce practical backend development principles:
- Separation of concerns and layered architecture.
- Clear REST API conventions.
- Maintainable Java code and meaningful naming.
- Reliable database access and transaction management.
- Input validation and predictable error handling.
- Automated testing and reproducible builds.
- Secure configuration and responsible secret management.
ELGHAD
- GitHub: https://github.com/ELGHAD
- Portfolio: https://elghad.github.io/hamza-elrhadiouini-portfolio