Skip to content
denzzbaki06-sysPublic

About

RESTful User Management API built with Java and Spring Boot

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

DevFlow

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.

Technologies

  • Java 21
  • Spring Boot
  • Spring Web MVC
  • Spring Data JPA
  • Hibernate
  • H2 Database
  • Jakarta Validation
  • Maven
  • JUnit 5
  • Mockito

Features

  • 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

Project Structure

src/
├── main/
│   ├── java/com/devflow/devflow/
│   │   ├── controller/
│   │   ├── dto/
│   │   ├── exception/
│   │   ├── model/
│   │   ├── repository/
│   │   └── service/
│   └── resources/
└── test/
    └── java/com/devflow/devflow/
        └── service/

API Endpoints

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

Example Request

{
  "name": "Ali",
  "email": "ali@example.com"
}

Example Response

{
  "id": 1,
  "name": "Ali",
  "email": "ali@example.com"
}

Validation

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

Pagination and Sorting

Users can be retrieved using pagination and sorting.

Example:

GET /users?page=0&size=10&sort=name,desc

Testing

The 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 test

Running the Project

Clone the repository and navigate to the project directory.

Run:

./mvnw spring-boot:run

The application will start on:

http://localhost:8080

Database

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

Author

Developed as a backend software engineering project using Java and Spring Boot.

Task Management

DevFlow now includes task management functionality linked to users.

Task Features

  • 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:
    • TODO
    • IN_PROGRESS
    • DONE
  • Automatic createdAt and updatedAt timestamps
  • Validation and centralized error handling
  • Service-layer tests with JUnit and Mockito

Task API Endpoints

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

Example 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
}

About

RESTful User Management API built with Java and Spring Boot

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages