This repository contains the source code for a Spring Boot CRUD REST API with PostgreSQL Database. It is part of the Backend Verse YouTube series on Java Backend Development in Hindi.
π Watch the full tutorial series here:
YouTube Playlist
πΊ YouTube Videos:
- π Spring Boot + PostgreSQL CRUD API (in Hindi)
- π Pagination, Sorting & Search in Spring Boot | REST API in Hindi πΏ (Step-by-Step)
- Create, Read, Update, Delete (CRUD) operations for User Management
- REST API with Spring Boot
- PostgreSQL as database
- JPA & Hibernate for persistence
- Postman for API testing
- Docker & Docker Compose support
- Java 17
- Spring Boot 3
- Spring Data JPA
- PostgreSQL
- Gradle
- IntelliJ IDEA
- Postman
- Docker & Docker Compose
-
Clone the repository:
git clone https://github.com/learnwithdeveloper/spring-boot-postgresql-crud cd spring-boot-postgresql-crud
If you donβt want to install PostgreSQL manually, you can use Docker Compose.
-
Start containers:
docker compose up -d
-
Check running containers:
docker ps
Look for container named docker-spring-postgres.
-
Connect to PostgreSQL inside container:
docker exec -it <container_id> bash psql -U postgres
β Welcome! Now you are inside the PostgreSQL database.
- Run the Spring Boot application.
curl -X POST http://localhost:8080/users \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "johndoe@gmail.com"
}'
curl -X GET http://localhost:8080/users
curl --location 'http://localhost:8080/users?page=0&size=10&sortKey=name&sortValue=asc&name=it&email=das'
curl -X PATCH http://localhost:8080/users/{userId} \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe Updated Name",
"email": ""
}'
curl -X DELETE http://localhost:8080/users/{userId}
We have already included the Postman Collection file in this repo:
Spring Boot Crud Using PostgreSql.postman_collection.json
Follow these steps:
- Open Postman.
- Click on Import (top-left corner).
- Select the file β
Spring Boot Crud Using PostgreSql.postman_collection.json
. - Done β Now you can directly test APIs without writing cURL.
- π± Build Your First REST API using Spring Boot
- π Spring Boot + PostgreSQL CRUD Operations
- π Pagination & Sorting in Spring Boot REST APIs
- π Search Functionality for flexible queries
- β Payload Validation in Spring Boot
- π Global Exception Handler
- β‘ More advanced features (to be added in the series)