Warning: This project contains extreme levels of Clean Code, SOLID principles, and Polyglot Architecture. Viewer discretion is advised.
This isn't just a shop. This is a masterpiece of engineering.
It's a fully containerized, database-backed, enterprise-grade e-commerce platform built to demonstrate how Real Systems should be architected. We didn't just write code; we crafted an ecosystem.
- Java handles the heavy business logic.
- PostgreSQL holds the single source of truth.
- Python orchestrates the data seeding.
- Docker binds them all together.
Whether you're selling physical goods with complex shipping rules or digital assets with instant delivery, Java Shop handles it with elegance.
- SOLID to the Core: Every class has a single responsibility. Open/Closed principle allows adding new features without touching old code.
- Strategy Pattern Everywhere: Pricing, Taxes, Shipping — all pluggable strategies. Want a new tax law? Just add a class.
- Polymorphic Power:
ProducthandlesPhysicalandDigitalitems seamlessly through inheritance.
- Automated Seeding: No more manual SQL inserts. A dedicated Python micro-service (
seeder.py) waits for the DB to be healthy and populates it with rich test data automatically. - Zero-Touch Deployment: Just run
docker-compose upand watch the symphony of containers orchestrate themselves.
- Dynamic Pricing: BOGO (Buy One Get One), Bulk Discounts, Seasonal Sales.
- Smart Taxation: Flat VAT, Progressive Taxes, Digital Goods Tax exemptions.
- Logistics Logic: Volumetric weight calculation, Express vs Standard shipping, Free shipping thresholds.
- Real-time Calculator: Instant price estimation on product pages considering all active policies.
- SVG Sprite System: Ultra-optimized icon rendering (load once, use everywhere).
- Thymeleaf Templates: Server-side rendering for blazing fast initial loads.
- Admin Dashboard: Full control over Products, Categories, and dynamic Policy configuration (Pricing, Tax, Shipping).
| Technology | Role | Why? |
|---|---|---|
| Java 17 | Core Logic | LTS stability meets modern syntax. |
| Spring Boot 3 | Framework | The gold standard for enterprise Java. |
| Spring Data JPA | ORM | Hibernate on steroids. Database interactions made simple. |
| PostgreSQL | Database | The world's most advanced open source relational database. |
| Python 3.9 | Scripting | Fast, efficient data seeding and automation. |
| Docker Compose | Orchestration | One command to rule them all. |
You don't need to install Java. You don't need to install Postgres. You just need Docker.
git clone https://github.com/BadRabbit00/java_lab.git
cd java_labdocker-compose up --build -dWait for the magic to happen...
- Postgres wakes up.
- Python Seeder connects, checks the DB, and injects the data.
- Java App launches and serves the content.
Open your browser and behold:
- Storefront: http://localhost:8080
- Admin Command Center: http://localhost:8080/admin
.
├── docker-compose.yml # The Orchestrator
├── seeder.py # The Python Data Injector
├── src/main/java/com/shop/
│ ├── category/ # Category management logic
│ ├── controller/ # REST & Web Controllers (The Traffic Cops)
│ ├── product/ # The Heart of the Domain
│ │ ├── pricing/ # Promotion Strategies (BOGO, Fixed, %)
│ │ ├── shipping/ # Shipping Strategies (Express, Standard)
│ │ ├── tax/ # Tax Strategies (VAT, Progressive)
│ │ ├── DigitalProduct.java
│ │ └── PhysicalProduct.java
│ ├── repository/ # JPA Repositories (The Data Layer)
│ └── service/ # Business Logic Layer
Found a bug? Want to add a "Buy 10 Get 1 Free" strategy?
- Fork it.
- Create your feature branch (
git checkout -b feature/AmazingStrategy). - Commit your changes (
git commit -m 'Add some AmazingStrategy'). - Push to the branch (
git push origin feature/AmazingStrategy). - Open a Pull Request.