Skip to content

learnwithdeveloper/spring-boot-postgresql-crud

Repository files navigation

πŸš€ Spring Boot + PostgreSQL CRUD API (in Hindi)

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

β–Ά Watch the Tutorial

πŸ“Ί YouTube Videos:


πŸ“Œ Features

  • 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

πŸ›  Tools & Technologies Used

  • Java 17
  • Spring Boot 3
  • Spring Data JPA
  • PostgreSQL
  • Gradle
  • IntelliJ IDEA
  • Postman
  • Docker & Docker Compose

βš™οΈ Project Setup

  1. Clone the repository:

    git clone https://github.com/learnwithdeveloper/spring-boot-postgresql-crud
    cd spring-boot-postgresql-crud
  2. 🐳 Run with Docker Compose (Recommended)

If you don’t want to install PostgreSQL manually, you can use Docker Compose.

  1. Start containers:

    docker compose up -d
  2. Check running containers:

    docker ps

    Look for container named docker-spring-postgres.

  3. Connect to PostgreSQL inside container:

    docker exec -it <container_id> bash
    psql -U postgres

    βœ… Welcome! Now you are inside the PostgreSQL database.


  1. Run the Spring Boot application.

πŸ“¬ API Endpoints with cURL

1️⃣ Create User

curl -X POST http://localhost:8080/users \
   -H "Content-Type: application/json" \
   -d '{
     "name": "John Doe",
     "email": "johndoe@gmail.com"
   }'

2️⃣ Get All Users

curl -X GET http://localhost:8080/users

3️⃣ Get All Users (Searching, Sorting, Pagination) - API

curl --location 'http://localhost:8080/users?page=0&size=10&sortKey=name&sortValue=asc&name=it&email=das'

4️⃣ Update User

curl -X PATCH http://localhost:8080/users/{userId} \
   -H "Content-Type: application/json" \
   -d '{
     "name": "John Doe Updated Name",
     "email": ""
   }'

5️⃣ Delete User

curl -X DELETE http://localhost:8080/users/{userId}

πŸ§ͺ Import Postman Collection

We have already included the Postman Collection file in this repo: Spring Boot Crud Using PostgreSql.postman_collection.json

Follow these steps:

  1. Open Postman.
  2. Click on Import (top-left corner).
  3. Select the file β†’ Spring Boot Crud Using PostgreSql.postman_collection.json.
  4. Done βœ… Now you can directly test APIs without writing cURL.

πŸ“š What We've Covered So Far

  • 🌱 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

πŸ“Œ Upcoming Tutorials

  • βœ… Payload Validation in Spring Boot
  • πŸ“Œ Global Exception Handler
  • ⚑ More advanced features (to be added in the series)

About

Spring Boot + PostgreSQL CRUD in Hindi | Java Backend Development Tutorial πŸš€πŸŒΏ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages