π Full-Stack E-Commerce Demo (Next.js + Spring Boot + OAuth2 + PayPal + Docker)
This is a full-stack e-commerce demo project built as a portfolio piece, showcasing:
β Multi-layer Spring Boot backend β Next.js 14 frontend β OAuth2 login (Google, GitHub, Internal Auth Server) β PayPal payments β Three independent microservices β Full Docker & Docker Swarm setup β JWT + refresh tokens β SQL Server database β Clean environment variable setup (no secrets in GitHub)
π¦ Tech Stack Frontend Next.js 14 React TypeScript JWT auth (HTTP-only cookies) Backend
Three independent Spring Boot services:
Service Description
Auth Server Issues OAuth2 tokens / JWT Client API Main e-commerce REST API RSS Server Demo RSS microservice Payments PayPal Sandbox integration (Orders API + Captures API) Database Microsoft SQL Server (via Docker) Security OAuth2 Login (Google / GitHub / Internal Server) JWT + Refresh Tokens CSRF protection Password hashing (BCrypt) Deployment Docker Docker Compose
π Project Structure project-root/ β ββ backend/ β ββ as/ # Auth Server (Spring Boot) β ββ client/ # Main API (Spring Boot) β ββ rss/ # RSS Microservice (Spring Boot) β ββ frontend/ # Next.js 14 App β ββ docker/ # Dockerfiles for each service β ββ docker-compose.yml ββ docker-stack.yml # For Docker Swarm ββ .env.example
βοΈ Environment Setup
Secrets are NOT included in this repository. Copy the example env file: cp .env.example .env Then fill in your values:
GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET=
PAYPAL_CLIENT_ID= PAYPAL_CLIENT_SECRET=
SPRING_DATASOURCE_URL= SPRING_DATASOURCE_USERNAME= SPRING_DATASOURCE_PASSWORD=
Each backend uses these placeholders inside application.properties, e.g.: spring.security.oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
π³ Running with Docker (Local) Build and start all services:
docker compose up --build
Frontend: π http://localhost:3000
Client Backend: π http://localhost:8080
Auth Server: π http://localhost:8000
RSS Server: π http://localhost:9000
SQL Server: π localhost:1433
π₯οΈ Local Development (Without Docker) Backend cd backend/client mvn spring-boot:run
Frontend cd frontend npm install npm run dev
π Security Features
OAuth2 login (Google / GitHub / custom auth server) HTTPS-ready configuration CSRF tokens (Next.js fetch wrapper) Secure JWT & refresh token strategy BCrypt password hashing Strict CORS + cookie configuration
π³ PayPal Integration
Implemented features: Create order Capture payment Save transaction to database PayPal Webhook ready Return/cancel pages
π What This Project Demonstrates This project is designed as a portfolio showcase, demonstrating:
β Real full-stack architecture β Multi-service backend β OAuth2 + JWT authentication β Secure payment workflow β Dockerized production-ready stack β Clean code & proper project structure
π Notes for Testers
This repository does not include secrets.
Before running: Fill .env or application.properties Add your own OAuth client IDs Set your PayPal sandbox keys Configure your own SQL Server credentials
π§βπ» Author
Tayza Thiha Full-Stack Developer (Singapore)