Skip to content

tirth063/Sale-Campaign-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sale Companion Automated Discount Scheduling

A modern Spring Boot solution for managing and optimizing product discounts and sales campaigns efficiently.


🌟 Overview

Sale Companion is a comprehensive backend solution built with Spring Boot, aimed at how e-commerce platforms manage discounts and sales campaigns. It provides dynamic campaign scheduling, detailed product # management, and secure user authentication to enhance promotional strategies.


🎯 Key Features

  • Dynamic Campaign Management

    • Schedule, activate, and expire campaigns seamlessly.
    • Automate price resets post-campaign expiration.
    • Access active, expired, and upcoming campaigns via intuitive APIs.
  • Product # Management

    • Maintain detailed price histories for insightful analytics.
    • Update or revert product prices and discounts programmatically.
  • User Authentication & Security

    • Implement role-based access control (Admin/User).
    • Secure authentication using JWT tokens.
    • Support user registration and login functionalities.
  • Automated Scheduling

    • Utilize configurable cron jobs for automated campaign processing.
  • Comprehensive API Documentation

    • Explore APIs effortlessly with integrated Swagger-UI and OpenAPI.

🛠️ Tech Stack

  • Backend: Spring Boot, Spring Security, Hibernate
  • Database: MySQL
  • Caching: Caffeine
  • Security: JWT, BCrypt
  • Documentation: Swagger-UI, OpenAPI
  • Monitoring: Spring Boot Actuator
  • Rate Limiting: Resilience4j

🚀 Getting Started

Installation

  1. Clone the Repository

    git clone https://github.com/tirth063/Sale-Campaign-System.git
    cd Sale-Campaign-System
  2. Configure the Database

    • Set up a MySQL database named salecampion.
    • Update credentials in application.properties.
  3. Run the Application

    • Using Maven:
      mvn spring-boot:run
    • Or as a packaged JAR:
      java -jar target/salecampion-1.jar
  4. Access the Application

    • API Base URL: http://localhost:8081
    • Swagger-UI: http://localhost:8081/swagger-ui.html

📚 API Reference DEMO in Sale-Campaings-Apis

API Diagram

Campaign Endpoints

  • GET /api/v1/campaigns/active - Retrieve active campaigns.
  • GET /api/v1/campaigns/expired - Retrieve expired campaigns.
  • GET /api/v1/campaigns/upcoming - Retrieve upcoming campaigns.
  • POST /api/v1/campaigns - Create a new campaign.
  • PUT /api/v1/campaigns/{id}/status - Update campaign status.

Product Endpoints

  • GET /api/v1/products - Fetch paginated product data.
  • GET /api/v1/products/{id} - Get product details by ID.
  • POST /api/v1/products - Add multiple products.
  • GET /api/v1/products/history/{id} - Retrieve product price history.

Authentication

  • POST /api/auth/register - Register a new user.
  • POST /api/auth/# - Log in and obtain a JWT token.

🏆 Features in Depth

Custom Scheduler

Automate campaign processes using cron jobs defined in application.properties. The scheduler handles:

  • Activating campaigns based on the start date.
  • Deactivating expired campaigns and resetting product prices.

Secure Authentication

  • Role-based access control ensures only authorized users can access sensitive endpoints.
  • JWT tokens secure API communications.

Comprehensive API Documentation

  • Integrated with Swagger-UI and OpenAPI for seamless exploration of endpoints.

Contact

For any inquiries or feedback, please contact tirth063.patel@gmail.com.