A modern Spring Boot solution for managing and optimizing product discounts and sales campaigns efficiently.
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.
-
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.
- Backend: Spring Boot, Spring Security, Hibernate
- Database: MySQL
- Caching: Caffeine
- Security: JWT, BCrypt
- Documentation: Swagger-UI, OpenAPI
- Monitoring: Spring Boot Actuator
- Rate Limiting: Resilience4j
-
Clone the Repository
git clone https://github.com/tirth063/Sale-Campaign-System.git cd Sale-Campaign-System
-
Configure the Database
- Set up a MySQL database named
salecampion
. - Update credentials in
application.properties
.
- Set up a MySQL database named
-
Run the Application
- Using Maven:
mvn spring-boot:run
- Or as a packaged JAR:
java -jar target/salecampion-1.jar
- Using Maven:
-
Access the Application
- API Base URL:
http://localhost:8081
- Swagger-UI:
http://localhost:8081/swagger-ui.html
- API Base URL:
📚 API Reference DEMO in Sale-Campaings-Apis
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.
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.
POST /api/auth/register
- Register a new user.POST /api/auth/#
- Log in and obtain a JWT token.
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.
- Role-based access control ensures only authorized users can access sensitive endpoints.
- JWT tokens secure API communications.
- Integrated with Swagger-UI and OpenAPI for seamless exploration of endpoints.
For any inquiries or feedback, please contact tirth063.patel@gmail.com.