Skip to content
fernando.catalan
All projects

Duoc UCWeb · Backend · Cloud

Pastelería Mil Sabores: a full stack online store

An online store with a cart, checkout with a receipt and a role-based admin panel. It started in plain HTML and JavaScript, we migrated it to React with TypeScript and wired it to a Spring Boot API with JWT and MySQL. I deployed it to Azure with GitHub Actions.

Role
Repository owner. Frontend, security, checkout, tests and deployment
Period
Sep 2026 — Dec 2026
Status
Delivered
Team
Two people in the final stages and three in the first. My teammate migrated the store pages and set up the backend skeleton, the catalog and Swagger

Context

The semester project for the Full Stack Development II course at Duoc UC. The brief: a bakery needs to sell online and manage its catalog, users and orders.

It was delivered in three stages, each built on the previous one: a site in HTML, CSS and JavaScript, the migration to React and, finally, the backend and its integration. Products and users are fictional.

The problem

The course asked for a store with a cart and a real checkout, an admin panel with roles, database persistence, a documented REST API and tests.

The hard part was changing foundations between stages without rebuilding the screens each time: going from standalone pages backed by localStorage to a typed SPA and, later, from mock data to a real API.

What I built

  • A React 19 and TypeScript SPA: 20 routes (11 for the store and 9 for administration), separate layouts for store and panel, and the cart and session in the Context API.

  • A service layer that shields pages from where data comes from: a hand-written HTTP client on top of fetch (Bearer token, sign-out on a 401, typed errors) and a mock mode on localStorage switched on by an environment variable.

  • A Spring Boot REST API with 18 endpoints, errors in a single format and OpenAPI documentation.

  • Stateless authentication with JWT: 60-minute tokens with refresh, BCrypt passwords and a filter that re-reads the role from the database on every request.

  • Three roles (customer, seller and administrator), with rules by role and HTTP method in the API and protected routes on the client.

  • A transactional checkout: it validates existence and stock, decrements stock, takes the price from the database and stores the receipt and its lines in a single transaction. If stock runs short it answers 409 with a clear message.

  • An admin panel with products and a low-stock alert, users with validation of the Chilean national ID (RUN) and a region and district picker, and the order list.

  • The deployment on Azure: the frontend on Static Web Apps, the API on App Service and the database on Azure Database for MySQL. Every push to main deploys through GitHub Actions, and the API's workflow signs in to Azure with federated identity (OIDC).

Architecture

architecture.svgSwipe →

Frontend, API and database are three separate Azure resources. The API only accepts the origins configured through an environment variable.

  • Client
  • Edge and network
  • Compute
  • Data
  • CI/CD
  • Client:
    • Browser: store · panel
  • Azure:
    • Static Web Apps: React · Vite
    • App Service: Spring Boot · JWT
    • Azure MySQL: flexible server
  • CI/CD:
    • GitHub Actions: build · OIDC

Connections:

  • Browser → Static Web Apps
  • Browser → App Service (REST · JWT)
  • App Service → Azure MySQL (JPA)
  • GitHub Actions → Static Web Apps
  • GitHub Actions → App Service

Technical decisions

  1. Pages do not know where data comes from

    Every page asks a per-resource service for its data. With an environment variable, those services answer from localStorage, mimicking the API's responses and errors, which makes it possible to develop and test with no backend.

  2. The server decides price and stock

    Checkout does not trust what the browser sends: the price is read from the database, and stock is validated and decremented inside the same transaction that stores the receipt.

  3. The role is re-read on every request

    The token says who the person is, but the filter looks up their role in the database every time. The API also tells 401 from 403 and answers both in JSON; on a 401, the client signs the user out.

  4. Vitest instead of what the brief suggested

    The brief suggested Jasmine with Karma. We used Vitest with Testing Library and I put the reasoning in writing in the test coverage document.

Stack

Frontend
  • React 19
  • TypeScript
  • Vite
  • React Router
  • Context API
  • Bootstrap 5
Backend
  • Java 21
  • Spring Boot 4
  • Spring Security
  • Spring Data JPA
  • JWT
  • OpenAPI
Data
  • MySQL 8
  • H2
  • Docker Compose
Cloud and CI/CD
  • Azure Static Web Apps
  • Azure App Service
  • Azure Database for MySQL
  • GitHub Actions
  • OIDC
Testing
  • Vitest
  • Testing Library
  • JUnit 5
  • Mockito
  • MockMvc

Outcome

  • Project delivered and presented, with frontend, API and database deployed on Azure and continuous deployment from GitHub Actions.

  • 108 test cases on the frontend, across 38 files, and 10 on the backend: 3 unit tests of the checkout logic with Mockito and 7 integration tests with MockMvc and H2.

  • For the second submission the team reported 96% line coverage on the frontend.

  • 16 pull requests on the frontend and 7 on the backend, with a branch per member, Conventional Commits and a written contribution guide.

What I learned

  • Migrating a multi-page site to an SPA with typed components, nested routes and global state in Context.

  • JWT end to end: issuing, filtering, expiry, the difference between 401 and 403 and route protection on the client.

  • Transactions and stock consistency with JPA, and the difference between a unit test with mocks and an integration test against an in-memory database.

  • Deploying a full web application to Azure coming from AWS: Static Web Apps, App Service, flexible MySQL and OIDC with GitHub Actions, within the region restrictions of a student subscription.

  • Organizing a team's work with branches, pull requests and conventional commits.

Links