Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bavlymo1/yarncraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧢 YarnCraft Marketplace β€” Modular Monolith Platform

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

πŸ“ Project Structure

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

πŸ— System Architecture

This is a single deployable unit that connects to a centralized MySQL database.

Core modules:

  1. User Module: Registration, login (JWT), role-based access control (Admin / Vendor / Customer).
  2. Product Module: Product CRUD, filtering, categories, vendor-product association.
  3. Order Module: Cart logic, placing orders, item customization.
  4. 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.

🌿 Branch Strategy

  • main β†’ Production-ready code
  • dev β†’ Shared development branch
  • module/user β†’ User module implementation
  • module/order β†’ Order module implementation
  • feature/* β†’ Feature branches

πŸš€ Getting Started (How to Run)

Two modes are supported: Coding Mode (fast iteration during development) and Production Mode (full Dockerized run).

Prerequisites

  • Java 17+
  • Docker Desktop (running)
  • MySQL client (MySQL Workbench / DBeaver optional)

πŸ›  Option 1 β€” Coding Mode (Recommended for development)

Use this when actively editing the code and running locally from your IDE.

  1. Clone the repository:
git clone https://github.com/your-username/yarncraft.git
cd yarncraft
  1. 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
  1. 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.

🐳 Option 2 β€” Production Mode (Full Docker)

Use this to test the final Dockerized setup (app + DB in containers).

  1. Stop any running compose services:
docker compose down
  1. Build and run everything:

Windows:

.\mvnw clean package -DskipTests
docker compose up --build

Mac / Linux:

./mvnw clean package -DskipTests
docker compose up --build
  1. Access the app:
  • Backend: http://localhost:8080

🧩 Task Division

🟦 Task 1 β€” Project Setup & Architecture

Assigned to: Anthony Ashraf & Bahy Mohy

  • Project skeleton, Docker setup, DB config, AOP setup, SRS & diagrams.

🟩 Task 2 β€” User Module

Assigned to: Bahy Mohy

  • User entity, JWT logic, vendor application flow, admin approval process.

🟧 Task 3 β€” Product Module

Assigned to: Eslam Ahmed

  • Product CRUD, category filtering, vendor-product linkage.

🟫 Task 4 β€” Order Module

Assigned to: Seif Emad

  • Cart logic, order placement, customization attributes (color, size).

🟨 Task 5 β€” Inventory Module & AOP

Assigned to: Aser ElSayed

  • Stock deduction logic; AOP aspects for logging and stock checks.

πŸŸͺ Task 6 β€” Frontend (React.js)

Assigned to: Aser ElSayed

  • Customer storefront (browse/order) and vendor dashboard (manage products).

πŸ“ Future Enhancements

  • Email notifications on order placement
  • Payment gateway simulation
  • Advanced analytics dashboard for admins

Contributing

If you want to contribute, please:

  1. Fork the repo
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Open a pull request against dev
  4. Ensure linting and tests (if any) pass

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages