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