Free Resources
Backend Developer Starter Pack
A free practical toolkit for backend developers learning Spring Boot, Docker, Kubernetes, Git, and technical interview preparation.
Access a free backend engineering starter pack with essential cheat sheets, commands, and interview prep resources designed for real-world software engineers.
Project structure
src/main/java/com/example/app/
├── Application.java // @SpringBootApplication entry point
├── controller/ // @RestController classes
├── service/ // @Service business logic
├── repository/ // @Repository data access
├── model/ // Entities & DTOs
└── config/ // @Configuration beans
src/main/resources/
├── application.properties
└── static/ templates/Common annotations
@RestController— JSON REST endpoints@Service— business logic component@Repository— data access component@Autowired— dependency injection@Configuration— defines @Bean providers
application.properties
server.port=8080
spring.datasource.url=jdbc:postgresql://localhost:5432/app
spring.datasource.username=postgres
spring.datasource.password=secret
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
logging.level.org.springframework=INFOMaven dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>REST controller pattern
@RestController
@RequestMapping("/api/users")
public class UserController {
private final UserService service;
public UserController(UserService service) { this.service = service; }
@GetMapping("/{id}")
public ResponseEntity<User> get(@PathVariable Long id) {
return ResponseEntity.ok(service.findById(id));
}
@PostMapping
public ResponseEntity<User> create(@Valid @RequestBody User user) {
return ResponseEntity.status(201).body(service.save(user));
}
}Global error handling
@RestControllerAdvice
public class ApiExceptionHandler {
@ExceptionHandler(EntityNotFoundException.class)
public ResponseEntity<Map<String,String>> notFound(Exception e) {
return ResponseEntity.status(404).body(Map.of("error", e.getMessage()));
}
}Spring Security basics
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
SecurityFilterChain filter(HttpSecurity http) throws Exception {
return http
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(a -> a
.requestMatchers("/api/public/**").permitAll()
.anyRequest().authenticated())
.httpBasic(Customizer.withDefaults())
.build();
}
}Testing basics
@SpringBootTest
@AutoConfigureMockMvc
class UserControllerTest {
@Autowired MockMvc mvc;
@Test
void getUserReturns200() throws Exception {
mvc.perform(get("/api/users/1"))
.andExpect(status().isOk());
}
}docker build -t app:1.0 .Build an image from a Dockerfile in the current directory.
docker run -p 8080:8080 app:1.0Run a container and map host port 8080 to container 8080.
docker run -d --name api app:1.0Run detached with a named container.
docker psList running containers (add -a to include stopped).
docker logs -f apiFollow logs for the 'api' container.
docker exec -it api shOpen an interactive shell inside a running container.
docker-compose up -dStart all services defined in docker-compose.yml in the background.
docker-compose downStop and remove containers, networks created by compose.
docker volume create dataCreate a named volume for persistent storage.
docker volume lsList Docker volumes.
docker run -v data:/var/lib/app app:1.0Mount a named volume into a container.
docker image prune -aRemove all unused images to free disk space.
docker system prune -a --volumesAggressive cleanup of containers, images, networks and volumes.
Sample Dockerfile (Spring Boot)
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY target/app.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]git clone <url>Clone a remote repository to your machine.
git statusShow changed, staged and untracked files.
git add <file> | git add .Stage specific files or all changes.
git commit -m "feat: add login"Commit staged changes with a message.
git push origin mainPush commits on the current branch to the remote.
git pull --rebaseFetch and rebase your local commits on top of remote changes.
git branch feature/loginCreate a new branch (use -d to delete).
git checkout feature/loginSwitch to an existing branch. Use -b to create+switch.
git merge feature/loginMerge another branch into the current one.
git rebase mainReapply your commits on top of main for a linear history.
git stash | git stash popTemporarily shelve uncommitted changes and restore later.
git reset --hard HEAD~1Discard the last commit and all changes (use with care).
Common kubectl commands
kubectl get podsList pods in the current namespace.
kubectl describe pod <name>Detailed status, events and conditions.
kubectl logs -f <pod>Stream container logs.
kubectl apply -f deploy.yamlCreate/update resources from a manifest.
kubectl rollout status deploy/appWatch a deployment rollout.
kubectl exec -it <pod> -- shShell into a running container.
kubectl port-forward svc/app 8080:80Forward a local port to a Service.
Deployment + Service YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
spec:
replicas: 3
selector:
matchLabels: { app: app }
template:
metadata:
labels: { app: app }
spec:
containers:
- name: app
image: app:1.0
ports: [{ containerPort: 8080 }]
---
apiVersion: v1
kind: Service
metadata:
name: app
spec:
selector: { app: app }
ports:
- port: 80
targetPort: 8080
type: ClusterIPCore Java
Difference between == and .equals() in Java?
== compares references (identity) for objects; .equals() compares logical value. Override equals() and hashCode() together.
What is the JVM, JRE and JDK?
JVM runs bytecode, JRE = JVM + libraries to run apps, JDK = JRE + compiler and tools to build apps.
Checked vs unchecked exceptions?
Checked must be declared/handled (IOException). Unchecked extend RuntimeException and don't have to be declared (NullPointerException).
HashMap vs ConcurrentHashMap?
HashMap is not thread-safe; ConcurrentHashMap uses fine-grained locking/CAS and is safe for concurrent reads/writes.
Spring Boot
What does @SpringBootApplication do?
It's @Configuration + @EnableAutoConfiguration + @ComponentScan, bootstrapping config, scanning and auto-config in one annotation.
Constructor vs field injection?
Constructor injection is preferred — it makes dependencies explicit, supports immutability and is easy to test without a Spring context.
How does Spring Boot auto-configuration work?
Conditional @Configuration classes on the classpath are evaluated against @Conditional annotations to register beans only when needed.
REST APIs
What makes an API RESTful?
Stateless, resource-oriented URIs, standard HTTP verbs, representations (JSON), and use of HTTP status codes & hypermedia where appropriate.
PUT vs PATCH?
PUT replaces the entire resource (idempotent). PATCH applies a partial update.
How do you version a REST API?
URI versioning (/v1/...), header versioning, or content negotiation. URI versioning is the most common for public APIs.
Microservices
How do microservices communicate?
Synchronously via REST/gRPC or asynchronously via message brokers (Kafka, RabbitMQ). Async helps with decoupling and resilience.
What is the Circuit Breaker pattern?
It stops calls to a failing dependency for a cooldown period (e.g. Resilience4j) to avoid cascading failures.
How do you handle distributed transactions?
Prefer Sagas (choreography or orchestration) with compensating actions over 2PC, which doesn't scale well.
System Design
How would you design a URL shortener?
Hash or base62-encoded ID, write to KV/SQL store, cache hot keys in Redis, async analytics pipeline, rate limiting at the edge.
How do you scale a read-heavy service?
Cache aggressively (Redis/CDN), add read replicas, denormalize for read patterns, and use async write paths.
CAP theorem in one sentence?
In a network partition you must choose between consistency and availability — you can't have all three at the same time.
Keep learning
Pair these cheat sheets with our in-depth tutorials and roadmaps.
