Simple full‑stack mini e‑shop built with a Spring Boot backend and a Vite + React + TypeScript frontend.
This README explains the project's intent, technology stack, how to run it in development (locally and with Docker), what environment variables are required, and common build commands.
- Backend: Spring Boot (Java 21) providing REST endpoints for products, categories, orders, users and authentication (JWT). Integrations: PostgreSQL, Stripe, email sending, and scheduled tasks.
- Frontend: Vite + React + TypeScript application that consumes the backend API and implements shopping, cart, checkout, account management, and admin views.
- Dev tooling: Docker Compose for local stacks (Postgres + pgAdmin + backend), Maven wrapper for backend builds, and pnpm (preferred) / npm for the frontend.
- Backend:
backend/— Spring Boot application (Java 21). Uses Spring Data JPA (Postgres), Spring Security (JWT), Stripe, Spring Mail and actuator endpoints. - Frontend:
frontend/— Vite + React + TypeScript app (React 19 + TanStack libraries, TailwindCSS). Development server runs on port 5173 by default. - Database: PostgreSQL (defined in
backend/docker-compose.yaml).
- Backend: http://localhost:8080
- Frontend (Vite dev): http://localhost:5173
- PostgreSQL: 5432
- pgAdmin: http://localhost:8081
- Java 21 (JDK 21) for backend development
- Maven (optional if you use the included
mvnwwrapper) - Node.js (16+ recommended) and pnpm (preferred) or npm/yarn for frontend
- Docker & Docker Compose (for easy local stack)
If you don't have pnpm, you can still use npm or yarn; the commands below use pnpm where applicable but notes include npm alternatives.
- Copy or create
backend/.envwith the environment variables listed below (an example is provided further down). - From the
backend/folder run:
# from repository root
cd backend
docker compose up --buildThis will start the backend (built from the backend Dockerfile), a Postgres container with a persistent volume, and pgAdmin on port 8081.
The frontend can be run separately (see local development below) and should point to the backend URL configured via FRONTEND_URL / BASE_URL.
Backend (run with Maven wrapper):
# from repository root
cd backend
./mvnw spring-boot:runBuild and run the produced jar:
./mvnw clean package
java -jar target/*.jarFrontend (pnpm preferred):
# from repository root
cd frontend
pnpm install
pnpm dev
# if you don't have pnpm, use: npm install && npm run devOpen the frontend at http://localhost:5173. The frontend expects the backend API at the URL configured in the backend's env (default: http://localhost:8080).
Create backend/.env and set values appropriate for your environment. Minimal example for local development with Dockerized Postgres:
# App
BASE_URL=http://localhost:8080
FRONTEND_URL=http://localhost:5173
# Database (used by Spring datasource URL below)
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/minieshop
SPRING_DATASOURCE_USERNAME=username
SPRING_DATASOURCE_PASSWORD=password
# JWT
JWT_SECRET_KEY=change_this_to_a_long_random_value
# Stripe (test keys)
STRIPE_PUBLISH_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
# Mail (if you want to test email sending)
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=you@example.com
MAIL_PASSWORD=secretNotes:
- When running the backend with Docker Compose (from
backend/docker-compose.yaml), the PostgreSQL service name ispostgres. The exampleSPRING_DATASOURCE_URLuses that service name so the backend container can reach the DB. - For local non-Docker development, set
SPRING_DATASOURCE_URLtojdbc:postgresql://localhost:5432/minieshop(or your DB host).
-
Backend (in
backend/):./mvnw spring-boot:run— run backend in dev mode./mvnw clean package— build jardocker compose up --build— start backend + postgres + pgadmin via Docker Compose (frombackend/)
-
Frontend (in
frontend/):pnpm install— install deps (ornpm install)pnpm dev— start Vite dev serverpnpm build— build production bundle (runstsc -b && vite build)pnpm preview— preview production build
- Backend tests are available under
backend/src/test. Run them with:
cd backend
./mvnw test- JWT authentication and user management
- Product listing, categories and simple admin CRUD
- Cart, orders and a Stripe-based checkout integration
- Email sending support (Spring Mail)
- Health and info endpoints via Spring Actuator
backend/— Spring Boot app,pom.xml,Dockerfile,docker-compose.yaml,.envusagefrontend/— Vite + React app,package.json, TypeScript source undersrc/
PRs are welcome. For small changes:
- Fork the repo
- Create a feature branch
- Open a PR describing the change
If you plan larger changes, open an issue first so we can discuss scope.