Shams
Back to blog

My Go-To Stack: React, NestJS, and Spring Boot

·5 min read·Shams K

As a full-stack developer, I've explored a wide range of frontend and backend technologies, but I keep coming back to a few that consistently deliver: React, NestJS, and Spring Boot.

The best stack isn't the newest — it's the one that lets you ship reliable software fast, and maintain it long after launch.

The Stack at a Glance

LayerTechnologyLanguageUse Case
FrontendReact / Next.jsTypeScriptUI, SSR, routing
API (Node)NestJSTypeScriptMicroservices, real-time
API (Java)Spring BootJava / KotlinDomain APIs, enterprise
DatabasePostgreSQL / MongoDBSQL / NoSQLPersistence
InfraDocker, K8s, AWSYAML / HCLDeployment, orchestration

Why React?

React lets me build fast, responsive, and modular user interfaces. With its component-based structure and rich ecosystem, it enables a smooth development experience and great scalability.

A typical component in my projects looks like this:

export function PostCard({ post }: { post: Post }) {
    return (
        <article className="rounded-lg border p-4 hover:bg-muted/50">
            <h2 className="font-semibold">{post.title}</h2>
            <p className="text-sm text-muted-foreground">
                {post.description}
            </p>
            <div className="mt-2 flex gap-2">
                {post.tags.map((tag) => (
                    <span key={tag} className="text-xs bg-muted px-2 py-0.5 rounded">
                        {tag}
                    </span>
                ))}
            </div>
        </article>
    )
}

Libraries I pair with React:

  • Next.js — SSR, file-based routing, API routes
  • RTK Query — data fetching and caching
  • react-hook-form — performant form handling
  • Tailwind CSS — utility-first styling

Why NestJS?

When building Node.js-based backends, NestJS provides a clean, structured, and scalable architecture out of the box. It brings the best parts of Angular's patterns into server-side development.

Here's a typical controller:

@Controller('users')
export class UsersController {
    constructor(private readonly usersService: UsersService) {}
 
    @Get()
    findAll(): Promise<User[]> {
        return this.usersService.findAll()
    }
 
    @Post()
    create(@Body() dto: CreateUserDto): Promise<User> {
        return this.usersService.create(dto)
    }
}

What makes NestJS stand out:

  1. Module system — clean dependency management and separation of concerns
  2. Decorators — expressive, declarative API definition
  3. Guards & interceptors — built-in middleware patterns for auth, logging, transforms
  4. TypeScript-first — full type safety across the entire backend

Why Spring Boot?

Spring Boot remains unmatched for Java-based backend services. It's powerful, production-ready, and offers great tools for building secure, testable, and robust APIs.

A REST endpoint with Spring Boot:

@RestController
@RequestMapping("/api/v1/invoices")
public class InvoiceController {
 
    private final InvoiceService invoiceService;
 
    @GetMapping("/{id}")
    public ResponseEntity<Invoice> getInvoice(@PathVariable Long id) {
        return invoiceService.findById(id)
            .map(ResponseEntity::ok)
            .orElse(ResponseEntity.notFound().build());
    }
 
    @PostMapping
    public ResponseEntity<Invoice> create(@Valid @RequestBody CreateInvoiceDto dto) {
        Invoice invoice = invoiceService.create(dto);
        return ResponseEntity.status(HttpStatus.CREATED).body(invoice);
    }
}

Spring Boot's opinionated defaults mean I spend less time on boilerplate and more time on business logic. Spring Security, scheduling, and dependency injection work out of the box.


How They Work Together

In a typical project, each piece handles what it does best:

Loading diagram...

Request Flow Example

  1. User interacts with the React frontend
  2. Next.js sends API request to the NestJS backend-for-frontend
  3. NestJS validates auth (JWT + DPoP), aggregates data from services
  4. NestJS calls Spring Boot domain API for core business operations
  5. Spring Boot queries PostgreSQL, applies business rules, returns response
  6. Response flows back through NestJS to the React UI

What This Stack Offers

BenefitHow
Rapid developmentReusable React components, NestJS generators, Spring Boot starters
Type safetyTypeScript on frontend + Node, Java/Kotlin on backend
SecuritySpring Security, NestJS guards, DPoP token validation
ScalabilityContainerized microservices on Kubernetes
CI/CDGitHub Actions, Docker builds, ArgoCD for GitOps deployments
ObservabilityStructured logging, health checks, metrics endpoints

Real-World Use Case

In a recent project, I built a distributed invoicing platform:

  • React + Next.js for the dashboard — SSR for fast initial loads, client-side interactivity for invoice editing
  • NestJS as the BFF layer — handling WebSocket connections for real-time updates, JWT validation, and API aggregation
  • Spring Boot for the core invoice API — complex business logic, PDF generation, PostgreSQL persistence, and scheduled batch processing

The deployment pipeline:

# Build and push Docker images
docker build -t registry.example.com/invoice-api:v1.2.0 .
docker push registry.example.com/invoice-api:v1.2.0
 
# Deploy via GitOps — update image tag in Helm values
# ArgoCD auto-syncs the change to the cluster
kubectl get pods -n production

Each piece handled what it does best — and together, they delivered a powerful and flexible solution.


Closing Thoughts

There's no single "right" stack. But for me, React + NestJS + Spring Boot strikes the perfect balance between developer experience, performance, and production reliability. It scales from side projects to enterprise platforms, and the communities around each are thriving.

Pick tools that make you productive today and won't hold you back tomorrow.

Want to collaborate or learn more about how I use these tools? Let's connect.