What are microservices?

Microservices are an architectural style where an application is built as a collection of small, independently deployable services, each responsible for a specific business capability.

Key Points

Example

An online store built as microservices might have separate services for User Accounts, Product Catalog, Shopping Cart, and Payments, each deployed and scaled on its own, communicating over REST APIs to complete a customer's purchase.

// A microservice is a small, independently deployable application.
// Order Service: its own codebase, port, database and release cycle.
@SpringBootApplication
public class OrderServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderServiceApplication.class, args);
    }
}

@RestController
@RequestMapping("/orders")
class OrderController {
    private final OrderRepository orders;          // talks only to the Order DB
    OrderController(OrderRepository orders) { this.orders = orders; }

    @GetMapping("/{id}")
    Order get(@PathVariable Long id) { return orders.findById(id).orElseThrow(); }
}

# application.yml
spring:
  application:
    name: order-service
  datasource:
    url: jdbc:postgresql://orders-db:5432/orders
server:
  port: 8081

Interview Tip

A concise interview answer is

Microservices are an architectural style that structures an application as a set of small, independently deployable services, each owning a specific business capability and communicating over the network, typically via REST or messaging. It's the opposite of a monolith, where everything is built and deployed as one large unit.

Last updated: 1 November 2026

Next question: How do microservices differ from monolithic architectures?

More Microservices - Level I interview questions

All Microservices - Level I questions