A full-stack, modular monolithic marketplace for custom handmade yarn products such as bags, purses, mirrors, tablecloths, and keychains.
YarnCraft supports:
- ✔ Vendor onboarding & admin approval
- ✔ Product customization (attributes like color and size)
- ✔ Customer ordering & cart management
- ✔ Real-time inventory tracking
- ✔ Aspect-Oriented Programming (AOP) for logging & stock checks
- ✔ Dockerized deployment
This project follows a Modular Monolith approach: a single Spring Boot application with separate packages for each business module to maintain loose coupling.
yarncraft/
├── .mvn/wrapper/ <-- Maven Wrapper
├── docker/
│ └── init.sql <-- DB Init Script (Users, tables)
├── src/
│ ├── main/
│ │ ├── java/com/swe2project/yarncraft/
│ │ │ ├── aspect/ <-- AOP
│ │ │ │ └── LoggingAspect.java <-- Execution time logging
│ │ │ ├── common/ <-- Shared Resources
│ │ │ │ ├── dto/ <-- ApiResponse.java (Standard JSON format)
│ │ │ │ ├── exception/ <-- GlobalExceptionHandler.java
│ │ │ │ └── util/ <-- SecurityUtils.java
│ │ │ ├── config/ <-- System Config
│ │ │ │ ├── OpenApiConfig.java <-- Swagger UI Setup
│ │ │ │ ├── SecurityConfig.java <-- JWT & Role Security
│ │ │ │ └── WebConfig.java <-- CORS Settings
│ │ │ ├── modules/ <-- THE MODULAR MONOLITH CORE
│ │ │ │ ├── inventory/ <-- [Inventory Module]
│ │ │ │ │ ├── controller/ <-- InventoryController.java
│ │ │ │ │ ├── entity/ <-- InventoryItem.java (Stock logic)
│ │ │ │ │ ├── repository/ <-- InventoryRepository.java
│ │ │ │ │ └── service/ <-- InventoryService.java (Restock/Reserve)
│ │ │ │ ├── order/ <-- [Order Module]
│ │ │ │ │ ├── controller/ <-- OrderController.java
│ │ │ │ │ ├── dto/ <-- OrderRequest.java
│ │ │ │ │ ├── entity/ <-- Order.java, OrderItem.java
│ │ │ │ │ ├── repository/ <-- OrderRepository.java
│ │ │ │ │ └── service/ <-- OrderService.java (Transaction logic)
│ │ │ │ ├── product/ <-- [Product Module]
│ │ │ │ │ ├── controller/ <-- ProductController.java
│ │ │ │ │ ├── dto/ <-- ProductRequest.java
│ │ │ │ │ ├── entity/ <-- Product.java, Category.java
│ │ │ │ │ ├── repository/ <-- ProductRepository.java
│ │ │ │ │ └── service/ <-- ProductService.java (Calls Inventory)
│ │ │ │ └── user/ <-- [User Module]
│ │ │ │ ├── controller/ <-- Auth/Admin/UserController.java
│ │ │ │ ├── dto/ <-- Login/Register/Profile DTOs
│ │ │ │ ├── entity/ <-- User.java, Role.java, VendorApplication.java
│ │ │ │ ├── repository/ <-- UserRepository.java
│ │ │ │ └── service/ <-- AuthService.java, UserService.java
│ │ │ ├── security/ <-- JWT Implementation
│ │ │ │ ├── CustomUserDetailsService.java
│ │ │ │ ├── JwtAuthenticationFilter.java
│ │ │ │ └── JwtService.java
│ │ │ └── YarncraftApplication.java <-- Main Entry Point
│ │ └── resources/
│ │ ├── application.properties <-- Points to Config Server (Port 8888)
│ │ ├── application.properties.backup <-- Original Config (Safe keeping)
│ │ └── schema.sql <-- Database Schema
│ └── test/ <-- Tests
├── compose.yaml <-- Docker Compose (MySQL + App)
├── Dockerfile <-- App Container Config
├── mvnw / mvnw.cmd <-- Maven Wrapper
├── pom.xml <-- Dependencies (Spring Cloud Client)
└── README.md <-- Project Documentation
This is a single deployable unit that connects to a centralized MySQL database.
Core modules:
- User Module: Registration, login (JWT), role-based access control (Admin / Vendor / Customer).
- Product Module: Product CRUD, filtering, categories, vendor-product association.
- Order Module: Cart logic, placing orders, item customization.
- Inventory Module: Stock level management and prevention of over-selling.
Technical highlights:
- Database: Single MySQL instance with foreign keys connecting User ⇄ Product ⇄ Order.
- Security: Spring Security with a JWT filter chain.
- AOP: Cross-cutting concerns like execution-time logging and stock validation are implemented with Spring AOP.
- Docker: App and DB can run in containers for consistent deployment.
main→ Production-ready codedev→ Shared development branchmodule/user→ User module implementationmodule/order→ Order module implementationfeature/*→ Feature branches
Two modes are supported: Coding Mode (fast iteration during development) and Production Mode (full Dockerized run).
- Java 17+
- Docker Desktop (running)
- MySQL client (MySQL Workbench / DBeaver optional)
Use this when actively editing the code and running locally from your IDE.
- Clone the repository:
git clone https://github.com/your-username/yarncraft.git
cd yarncraft- Start only the database:
- Runs MySQL in the background on port
3306. - Ensure you do not have another MySQL instance running on the same port.
docker compose up -d mysql- Run the backend from your IDE:
- Open the project in IntelliJ IDEA (or your preferred IDE).
- Run
YarncraftApplication.java. - The app will be available at
http://localhost:8080.
Use this to test the final Dockerized setup (app + DB in containers).
- Stop any running compose services:
docker compose down- Build and run everything:
Windows:
.\mvnw clean package -DskipTests
docker compose up --buildMac / Linux:
./mvnw clean package -DskipTests
docker compose up --build- Access the app:
- Backend:
http://localhost:8080
Assigned to: Anthony Ashraf & Bahy Mohy
- Project skeleton, Docker setup, DB config, AOP setup, SRS & diagrams.
Assigned to: Bahy Mohy
- User entity, JWT logic, vendor application flow, admin approval process.
Assigned to: Eslam Ahmed
- Product CRUD, category filtering, vendor-product linkage.
Assigned to: Seif Emad
- Cart logic, order placement, customization attributes (color, size).
Assigned to: Aser ElSayed
- Stock deduction logic; AOP aspects for logging and stock checks.
Assigned to: Aser ElSayed
- Customer storefront (browse/order) and vendor dashboard (manage products).
- Email notifications on order placement
- Payment gateway simulation
- Advanced analytics dashboard for admins
If you want to contribute, please:
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-feature - Open a pull request against
dev - Ensure linting and tests (if any) pass