Skip to content
← Back to projects
Hero image for Melik Bakery

Melik Bakery

A complete, production-ready bakery web application — from checkout to deployment.

ReactViteJavaSpring BootSpring SecurityJWTMySQLRedisDockerDocker ComposeNginxGitHub Actions

Motivation

I wanted to build something beyond a tutorial project: a full e-commerce system with real constraints — authentication, persistent state, a stateless backend that could scale horizontally, and an actual production deployment on a self-hosted server, not just a local demo.

Problem Solved

Small bakery businesses need an online storefront where customers can browse products, manage a shopping cart, and check out securely, while the business owner needs a reliable, low-maintenance system that keeps running unattended on modest hardware.

Architecture

Client requests hit Nginx, which serves the React SPA directly and proxies API calls to the stateless Spring Boot backend. The backend reads and writes MySQL for persistent data and Redis for cart state. GitHub Actions deploys the whole Docker Compose stack to the self-hosted Linux server.

Melik Bakery is a complete, production-ready web application for an online bakery storefront. It covers the full stack: a React single-page frontend, a Java/Spring Boot REST API, persistent storage, caching, and a containerized production deployment behind a reverse proxy.

Architecture

The system is split into independently deployable layers, all orchestrated with Docker Compose:

  • Frontend — a React SPA built with Vite, served as static assets.
  • Backend — a stateless Spring Boot REST API. Statelessness means any backend container can handle any request, which makes the service trivial to scale horizontally or restart without losing in-flight sessions.
  • Database — MySQL for persistent, relational data (products, orders, users).
  • Cache — Redis, used to back the shopping cart so cart state survives backend restarts without needing a database write on every cart mutation.
  • Reverse proxy — Nginx sits in front of both the frontend and backend, routing API traffic and serving static assets, and is the single public entry point into the Docker network.
  • CI/CD — GitHub Actions builds and deploys the application to a self-hosted Linux server on every push to the main branch.

Interesting Implementation Details

  • Stateless backend — no server-side session state; every request is authenticated independently via a JWT, which is what makes horizontal scaling and zero-downtime restarts possible.
  • Redis-backed shopping cart — cart contents live in Redis keyed by user/session, decoupling cart state from both the database and any single backend instance.
  • JWT authentication with Spring Security — stateless auth integrated directly into the Spring Security filter chain, issuing and validating tokens without server-side session storage.
  • Image storage — product images are persisted outside the application containers so they survive redeploys.
  • Docker networking — each service (frontend, backend, MySQL, Redis, Nginx) runs in its own container on a shared Docker network, communicating over internal service names rather than exposed ports.

Challenges Encountered

Getting the Nginx reverse proxy to correctly route API calls to the backend while serving the React SPA's static assets — including handling client-side routing fallbacks — required careful configuration. Coordinating Docker networking so containers could reach each other by service name, while only exposing the reverse proxy publicly, was another key piece of getting the production deployment right.

Lessons Learned

Designing for statelessness from day one made horizontal scaling and deployments trivial — any backend instance can serve any request because session state lives in Redis, not memory. Getting Docker networking and the Nginx reverse proxy configuration right up front saved a lot of debugging later, and JWT-based auth removed the need for sticky sessions entirely.