DevFlow is a RESTful backend application built with Java and Spring Boot for managing users.
The project demonstrates a clean layered backend architecture with validation, exception handling, pagination, search functionality, persistent database storage, DTO usage, and unit testing.
- Java 21
- Spring Boot
- Spring Web MVC
- Spring Data JPA
- Hibernate
- H2 Database
- Jakarta Validation
- Maven
- JUnit 5
- Mockito
- Create a user
- Get users
- Get user by ID
- Update a user
- Delete a user
- Search users by name
- Search users by email
- Pagination and sorting
- Request validation
- Duplicate email protection
- Global exception handling
- Persistent H2 database
- DTO-based API architecture
- Unit tests for the service layer
src/
├── main/
│ ├── java/com/devflow/devflow/
│ │ ├── controller/
│ │ ├── dto/
│ │ ├── exception/
│ │ ├── model/
│ │ ├── repository/
│ │ └── service/
│ └── resources/
└── test/
└── java/com/devflow/devflow/
└── service/
| Method | Endpoint | Description |
|---|---|---|
| POST | /users |
Create a user |
| GET | /users |
Get users with pagination |
| GET | /users/{id} |
Get user by ID |
| PUT | /users/{id} |
Update a user |
| DELETE | /users/{id} |
Delete a user |
| GET | /users/search?name=ali |
Search users by name |
| GET | /users/search/email?email=ali@example.com |
Search users by email |
{
"name": "Ali",
"email": "ali@example.com"
}{
"id": 1,
"name": "Ali",
"email": "ali@example.com"
}User input is validated before being processed.
Example invalid request:
{
"name": "",
"email": "abc"
}The API returns 400 Bad Request with validation details.
Duplicate email addresses return:
409 Conflict
Requests for users that do not exist return:
404 Not Found
Users can be retrieved using pagination and sorting.
Example:
GET /users?page=0&size=10&sort=name,descThe service layer includes unit tests using JUnit 5 and Mockito.
Tests cover scenarios such as:
- Successful user creation
- Duplicate email handling
- User not found handling
Run the tests with:
./mvnw testClone the repository and navigate to the project directory.
Run:
./mvnw spring-boot:runThe application will start on:
http://localhost:8080
The project uses H2 Database for development.
H2 Console:
http://localhost:8080/h2-console
Database configuration can be found in:
src/main/resources/application.properties
Developed as a backend software engineering project using Java and Spring Boot.
DevFlow now includes task management functionality linked to users.
- Create tasks for users
- List all tasks
- Get a task by ID
- Update task information and status
- Delete tasks
- User–Task relationship with JPA
- Task statuses:
TODOIN_PROGRESSDONE
- Automatic
createdAtandupdatedAttimestamps - Validation and centralized error handling
- Service-layer tests with JUnit and Mockito
| Method | Endpoint | Description |
|---|---|---|
| POST | /tasks |
Create a new task |
| GET | /tasks |
Get all tasks |
| GET | /tasks/{id} |
Get task by ID |
| PUT | /tasks/{id} |
Update a task |
| DELETE | /tasks/{id} |
Delete a task |
{
"id": 1,
"title": "Complete DevFlow",
"description": "Finish task management implementation",
"status": "IN_PROGRESS",
"createdAt": "2026-08-10T16:32:56",
"updatedAt": "2026-08-10T16:40:00",
"userId": 1
}