A comprehensive RESTful e-commerce API built using Spring Boot with automated endpoint generation.
Technologies Used: Java, Spring Boot 3, Spring Data REST, Hibernate, MySQL, Maven, Apache Tomcat
- RESTful API Design: Automated endpoint generation for seamless CRUD operations.
- Product Management: Complete product catalog with detailed information and inventory tracking.
- User Management: User profile management and data persistence.
- Order Processing: Comprehensive order management system with purchase tracking.
- Complex Database Relationships: Many-to-many mappings between orders and products with proper cascade operations.
- Spring Data REST Integration: Automatic REST endpoint exposure with HATEOAS support.
- Database Integration: Robust MySQL integration with Hibernate ORM for efficient data persistence.
- Product: Product catalog management with inventory details
- User: User data management and profile information
- Purchase: Order processing and purchase history tracking
- Repository Layer: Dedicated repositories for each entity with Spring Data JPA
-
Clone the repository:
git clone https://github.com/rohan282/quickcart.git
-
Navigate to the project directory:
cd quickcart -
Open the project in IntelliJ IDEA:
- Launch IntelliJ IDEA.
- Click on File > Open.
- Navigate to the folder where you cloned the repository (quickcart) and select it.
- IntelliJ will automatically detect the Maven project and import it.
-
Configure MySQL Database:
- Create a new MySQL database named
quickcart - Update the database configuration in
src/main/resources/application.properties:spring.datasource.url=jdbc:mysql://localhost:3306/quickcart spring.datasource.username=your_username spring.datasource.password=your_password
- Create a new MySQL database named
-
Build the project:
- Once imported, IntelliJ will resolve all Maven dependencies automatically.
- If dependencies are not resolved, click on View > Tool Windows > Maven, and then click on Reload Maven Projects.
-
Run the application:
- Locate the QuickCartApplication class (the main class with the @SpringBootApplication annotation).
- Right-click on the class and select Run 'QuickCartApplication'.
- The application will start, and you can access it at:
http://localhost:8080
The application automatically generates RESTful endpoints for all entities:
GET /api/products- Retrieve all productsGET /api/products/{id}- Retrieve a specific productPOST /api/products- Create a new productPUT /api/products/{id}- Update an existing productDELETE /api/products/{id}- Delete a product
GET /api/users- Retrieve all usersGET /api/users/{id}- Retrieve a specific userPOST /api/users- Create a new userPUT /api/users/{id}- Update user informationDELETE /api/users/{id}- Delete a user
GET /api/purchases- Retrieve all purchasesGET /api/purchases/{id}- Retrieve a specific purchasePOST /api/purchases- Create a new purchasePUT /api/purchases/{id}- Update purchase informationDELETE /api/purchases/{id}- Delete a purchase
-
Start the Application: Run the Spring Boot application to start the embedded Tomcat server.
-
API Testing: Use tools like Postman, curl, or any REST client to interact with the API endpoints.
-
Database Operations: The application automatically handles database schema creation and updates through Hibernate.
-
HATEOAS Navigation: Utilize the hypermedia links provided in API responses for easy navigation between related resources.
src/
├── main/
│ ├── java/
│ │ └── com/api/quickcart/
│ │ ├── entity/
│ │ │ ├── Product.java
│ │ │ ├── User.java
│ │ │ └── Purchase.java
│ │ ├── repository/
│ │ │ ├── ProductRepository.java
│ │ │ ├── UserRepository.java
│ │ │ └── PurchaseRepository.java
│ │ └── QuickCartApplication.java
│ └── resources/
│ └── application.properties
└── test/
└── java/
└── com/api/quickcart/
└── QuickCartApplicationTests.java
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.