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=INFO

Maven 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.0

Run a container and map host port 8080 to container 8080.

docker run -d --name api app:1.0

Run detached with a named container.

docker ps

List running containers (add -a to include stopped).

docker logs -f api

Follow logs for the 'api' container.

docker exec -it api sh

Open an interactive shell inside a running container.

docker-compose up -d

Start all services defined in docker-compose.yml in the background.

docker-compose down

Stop and remove containers, networks created by compose.

docker volume create data

Create a named volume for persistent storage.

docker volume ls

List Docker volumes.

docker run -v data:/var/lib/app app:1.0

Mount a named volume into a container.

docker image prune -a

Remove all unused images to free disk space.

docker system prune -a --volumes

Aggressive 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 status

Show 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 main

Push commits on the current branch to the remote.

git pull --rebase

Fetch and rebase your local commits on top of remote changes.

git branch feature/login

Create a new branch (use -d to delete).

git checkout feature/login

Switch to an existing branch. Use -b to create+switch.

git merge feature/login

Merge another branch into the current one.

git rebase main

Reapply your commits on top of main for a linear history.

git stash | git stash pop

Temporarily shelve uncommitted changes and restore later.

git reset --hard HEAD~1

Discard the last commit and all changes (use with care).

Pod — smallest deployable unit; wraps one or more containers.
Deployment — manages a replicated set of Pods + rollouts.
Service — stable network endpoint for a set of Pods.
Ingress — HTTP/S routing into the cluster.
ConfigMap — non-secret configuration as key/value pairs.
Secret — sensitive data (base64-encoded, RBAC-protected).

Common kubectl commands

kubectl get pods

List 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.yaml

Create/update resources from a manifest.

kubectl rollout status deploy/app

Watch a deployment rollout.

kubectl exec -it <pod> -- sh

Shell into a running container.

kubectl port-forward svc/app 8080:80

Forward 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: ClusterIP

Core 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.