Skip to content

jeevankumardev18/Back-end-practice

Repository files navigation

🚀 Java Backend Developer Learning Journey (Spring Boot + JPA + MySQL)

📌 Project Overview

This repository documents my structured journey toward becoming a job-ready Java Backend Developer (1–3 years experience level) by building real backend features step by step using industry practices.

This project follows the 80/20 learning rule: ---> 80% practical implementation and 20% theoretical understanding.

  • Real backend architecture
  • Production coding practices
  • Interview-focused development
  • Database-driven APIs

🛠️ Tech Stack

Technology Usage
Java 17 Core backend language
Spring Boot REST API development
Spring Data JPA Database operations
Hibernate ORM framework
MySQL Database
Maven Dependency management
Postman API testing
Git Version control

🧩 Skills Demonstrated

  • REST API Development
  • Layered Architecture Design
  • JPA Entity Relationships
  • Database Modeling
  • Pagination & Filtering APIs
  • Exception Handling Strategy
  • Query Optimization Basics
  • Clean Code Practices

🏗️ Architecture Used

Layered Architecture:

Controller → Service → Repository → Database

Design patterns implemented:

  • DTO Pattern
  • Repository Pattern
  • Service Layer Pattern
  • Global Exception Handling Pattern

📅 Learning Progress Tracker

✅ Day 1 – REST API Design

  • REST principles
  • HTTP methods
  • Controller design
  • ResponseEntity usage
  • CRUD endpoints

✅ Day 2 – DTO & Validation

  • DTO vs Entity
  • Request DTO
  • Response DTO
  • Bean validation
  • Input validation best practices

✅ Day 3 – Exception Handling

  • Global Exception Handling
  • Custom exceptions
  • Standard error responses
  • Production error handling

✅ Day 4 – Service Layer

  • Business logic separation
  • Constructor injection
  • Clean controller design
  • Industry architecture practices

✅ Day 5 – Repository Layer

  • JPA integration
  • Entity mapping
  • Database CRUD operations
  • Repository pattern

✅ Day 6 – Pagination & Sorting

  • Pageable
  • PageRequest
  • Sorting APIs
  • Pagination metadata

✅ Day 7 – Search & Filtering

  • Query derivation
  • Dynamic filtering
  • Keyword search
  • Combined pagination + search

✅ Day 8 – Custom Queries

  • JPQL queries
  • Native queries
  • @Query usage
  • Optional handling

✅ Day 9 – Entity Relationships

  • OneToMany relationship
  • ManyToOne relationship
  • Foreign key mapping
  • Bidirectional relationships
  • Order module integration

✅ Day 10 – Cascade & Fetch Types

  • CascadeType.ALL
  • FetchType.LAZY vs EAGER
  • Relationship lifecycle management
  • JSON infinite recursion fix (@JsonIgnore)
  • Performance considerations

✅ Day 11 – Transactions

  • Transaction management using @Transactional
  • ACID properties (Atomicity, Consistency basics)
  • Automatic rollback on failures
  • Database consistency during multistep operations
  • Testing transaction rollback scenarios
  • Understanding Runtime vs Checked exception rollback behavior

✅ Day 12 – Logging (SLF4J)

  • Logging using SLF4J Logger and LoggerFactory
  • Replacing System.out.println with structured logging
  • Understanding logging levels (INFO, DEBUG, WARN, ERROR)
  • Adding logs in Service layer for important operations
  • Proper logging format using {} placeholders
  • Logging exceptions and errors for debugging and monitoring

✅ Day 13 – Standard API Response Structure

  • Creating a generic ApiResponse wrapper for consistent responses
  • Standardizing success and error API responses
  • Implementing ResponseUtil to reduce boilerplate code
  • Refactoring controllers to use structured responses
  • Updating GlobalExceptionHandler to return standardized error responses
  • Improving API consistency for better frontend integration and debugging

✅ Day 14 – Advanced Validation

  • Improving DTO validation using @NotBlank, @Email, and @Size
  • Handling multiple validation errors instead of a single error
  • Enhancing GlobalExceptionHandler to return structured validation responses
  • Using Java Streams to collect validation error messages
  • Improving validation messages for better API usability
  • Implementing better error response design for frontend integration

✅ Day 15 – DTO Mapping (Mapper Pattern)

  • Implementing Mapper classes to convert Entity ↔ DTO
  • Removing manual conversion logic from Service layer
  • Using static mapper methods for reusable conversions
  • Improving code maintainability by centralizing mapping logic
  • Using Java Streams for list DTO conversion
  • Refactoring update operations using mapper update methods

✅ Day 16 – Swagger API Documentation

  • Swagger integration using SpringDoc OpenAPI
  • Auto generated REST API documentation
  • Testing APIs using Swagger UI
  • API request/response visualization
  • Adding @Operation and @Tag annotations
  • API response documentation using @ApiResponses
  • Improving API discoverability

✅ Day 17 – Spring Security Basics

  • Introduction to Spring Security and why APIs must be protected
  • Adding Spring Security dependency
  • Understanding authentication vs authorization
  • Default Spring Security behavior (all endpoints secured)
  • Configuring SecurityFilterChain
  • Allowing public endpoints (Swagger + create user)
  • Securing private endpoints
  • Disabling CSRF for REST APIs
  • Understanding Basic Authentication flow
  • Preparing project for JWT authentication (next step)

✅ Day 18 – JWT Authentication

  • Implementing JWT token generation after successful login
  • Creating authentication endpoint (/api/auth/login)
  • Understanding JWT structure (Header, Payload, Signature)
  • Implementing custom JWT authentication filter
  • Validating JWT token before accessing protected APIs
  • Using Authorization header with Bearer token
  • Integrating JWT with Spring Security filter chain
  • Stateless authentication using SecurityContextHolder
  • Protecting APIs using JWT instead of Basic Auth
  • Understanding 401 Unauthorized vs 403 Forbidden in JWT flow

✅ Day 19 – Role Based Access Control (RBAC)

  • Understanding Authentication vs Authorization
  • Introduction to RBAC (Role Based Access Control)
  • Adding roles to User entity (ADMIN, USER)
  • Storing roles in database
  • Adding roles inside JWT payload
  • Extracting roles from JWT during authentication
  • Using Spring Security authorities
  • Protecting endpoints using roles
  • Using @PreAuthorize for method-level security
  • Restricting APIs based on user roles
  • Testing role-based access using Swagger/Postman

✅ Day 20 – Unit Testing (JUnit + Mockito)

  • Introduction to unit testing in backend development
  • Writing tests using JUnit 5
  • Mocking dependencies using Mockito
  • Testing Service layer business logic
  • Testing success and failure scenarios
  • Verifying method calls using Mockito
  • Understanding @Mock vs @InjectMocks
  • Running tests without starting Spring Boot

🔎 Features Implemented

User Management APIs

  • Create User
  • Get User by ID
  • Get All Users
  • Update User
  • Delete User

Advanced APIs

  • Pagination API
  • Sorting API
  • Search API
  • Custom Query API

Backend Best Practices

  • DTO separation
  • Validation layer
  • Global exception handling
  • Clean architecture

📂 Project Structure

src/main/java/com/project

controller
UserController.java

service
UserService.java
UserServiceImpl.java

repository
UserRepository.java

entity
UserEntity.java

dto
UserRequestDto.java
UserResponseDto.java
ErrorResponse.java

exception
ResourceNotFoundException.java
GlobalExceptionHandler.java

🎯 Learning Objectives

This project focuses on mastering:

  • Backend API design
  • Database integration
  • JPA fundamentals
  • Clean architecture
  • Backend debugging
  • Interview preparation

📈 Current Progress

Completed: Day 1 → Day 20

Backend Skill Level: Intermediate Java Backend Developer (Building production-style APIs)

Next Focus:

  • Integration Testing
  • Performance optimization


🧠 Key Backend Concepts Learned

  • REST API Design
  • DTO Pattern
  • Service Layer Architecture
  • JPA CRUD Operations
  • Pagination
  • Filtering
  • Custom Queries
  • Exception Handling

🚀 Planned Improvements

Upcoming backend features:

  • JWT Security
  • API Documentation (Swagger)
  • Unit Testing
  • Docker basics
  • Microservice concepts

🔥 Project Highlights

  • Built a layered backend architecture from scratch
  • Implemented real-world entity relationships
  • Designed pagination and filtering APIs
  • Applied JPA best practices
  • Practiced production-style exception handling
  • Structured learning across multiple backend topics

💡 Interview Preparation Focus

This project prepares for:

  • Startup backend interviews
  • Product company backend roles
  • 1–3 year Java developer interviews

📬 Author

Jeevan Dev

Goal: Java Backend Developer

Focus: Java | Spring Boot | RestApi's | Backend Development | Problem-Solving


⭐ Motivation

Small progress daily builds strong engineers.

Consistency + Practical learning = Backend confidence.


📌 Status

Project Status: Active Learning Phase

Current Stage: Backend Fundamentals Completed

Next Milestone: Advanced Backend Topics


📖 Learning Philosophy

Build → Break → Fix → Improve → Repeat

About

Daily hands-on Java Back end tasks covering Spring Boot, Micro services, Security, SQL, System Design and real-world back end development concepts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors